private void AddHD(HOI_DONG hd)
 {
     hd.MaHoiDong = "HD" + _maDT + "_" + hd.MaGV;
     foreach (var item in _hds)
     {
         if (item.MaHoiDong == hd.MaHoiDong)
         {
             return;
         }
     }
     _hds.Add(hd);
     LoadHD();
 }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0 && senderGrid.Columns[e.ColumnIndex].Name == "ChiTiet")
            {
                HOI_DONG HD = _hds[e.RowIndex];
                _curIndex = e.RowIndex;
                HoiDongThem f = new HoiDongThem(HD);
                f.d += new HoiDongThem.ThemNguoiDelegate(EditHD);
                f.Show();
            }
            else if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                     e.RowIndex >= 0 && senderGrid.Columns[e.ColumnIndex].Name == "Xoa")
            {
                _hds.RemoveAt(e.RowIndex);
                LoadHD();
            }
        }
 private void EditHD(HOI_DONG hd)
 {
     hd.MaHoiDong    = _hds[_curIndex].MaHoiDong;
     _hds[_curIndex] = hd;
     LoadHD();
 }
Ejemplo n.º 4
0
 public HoiDongThem(HOI_DONG s = null)
 {
     InitializeComponent();
     _HD = s;
 }