private void FillData() { lblCapNhat.Text = "Thêm"; if (MaPhongBan !=null&& MaPhongBan != "") { txtMaPhongBan.Enabled = false; lblCapNhat.Text = "Cập nhật"; clsDM_PhongBan obj = new clsDM_PhongBan(); obj.GetByKey(MaPhongBan); txtMaPhongBan.Text = obj.MaPhongBan; txtTenPhongBan.Text = obj.TenPhongBan; txtLoaiPhongBan.Text = obj.LoaiPhongBan; cbActive.Checked=(bool)obj.Active ; } }
private int Update(string strMa) { int kq = 0; clsDM_PhongBan obj = new clsDM_PhongBan(); obj.MaPhongBan = strMa; obj.GetByKey(strMa); obj.TenPhongBan = txtTenPhongBan.Text; obj.LoaiPhongBan = txtLoaiPhongBan.Text; obj.Active = cbActive.Checked; kq = obj.Update(); return kq; }