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