private void btnThem_Click(object sender, EventArgs e) { TGDTO TGDTO = new TGDTO() { ConQuanLy = true }; ThemTG frm = new ThemTG(true, TGDTO); frm.ShowDialog(); hienThi(); }
public ThemTG(bool _isAddNew1, TGDTO TGDTO) { InitializeComponent(); _isAddNew = _isAddNew1; txtMa.Text = TGDTO.MaTG; txtTen.Text = TGDTO.TenTG; txtTGQuyDoi.Text = TGDTO.TGQuyDoi.ToString(); ckbConQuanLy.Checked = TGDTO.ConQuanLy; if (!_isAddNew) { txtMa.Enabled = false; } }
private void btnSua_Click(object sender, EventArgs e) { _currentRowIndex = gridView1.FocusedRowHandle; if (_currentRowIndex < 0) { return; } TGDTO TGDTO = new TGDTO() { MaTG = gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["MaKV"]).ToString(), TenTG = gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["TenKV"]).ToString(), TGQuyDoi = int.Parse(gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["ghichu"]).ToString()), ConQuanLy = bool.Parse(gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["ConQuanLy"]).ToString()), }; ThemTG frm = new ThemTG(false, TGDTO); frm.ShowDialog(); hienThi(); }