using ButcherFactory.BO;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ButcherFactory.SegmentProduction_
{
  public partial class TrunOutDialog : Form
  {
    public SegmentProduction Back;
    BindingList<SegmentProduction> list;
    public TrunOutDialog(BindingList<SegmentProduction> trunOutList)
    {
      this.list = trunOutList;
      InitializeComponent();
      uDataGridView1.CellContentClick += uDataGridView1_CellContentClick;
    }

    protected override void OnLoad(EventArgs e)
    {
      base.OnLoad(e);
      uDataGridView1.DataSource = list;
      uDataGridView1.Refresh();
    }

    void uDataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
    {
      if (e.ColumnIndex != 3)
        return;
      Back = uDataGridView1.CurrentRow.DataBoundItem as SegmentProduction;
      DialogResult = DialogResult.OK;
      this.Close();
    }

    private void closeBtn_Click(object sender, EventArgs e)
    {
      this.Close();
    }
  }
}
