public fThemSimple(bool isAdd = true, CBoPhan bp = null, fBoPhan.sendMessage send = null, double action = 1) { InitializeComponent(); if (isAdd == false && bp == null) { XtraMessageBox.Show("ERROR : Dữ liệu không được cung cấp để thực hiện hành động !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } if (isAdd == true) { table = BUS_NhanVien.LayBoPhan(); Text = "Thêm bộ phận"; } else { editBP = bp; Text = "Sửa thông tin bộ phận"; } add = isAdd; sendBP = send; flag = 3; InitBP(); }
public void SuaBP(CBoPhan bp) { Provider dao = new Provider(); try { dao.Connect(); string sql = "DEPARTMENT_Update"; CommandType type = CommandType.StoredProcedure; dao.ExeCuteNonQuery(type, sql, new SqlParameter { ParameterName = "@Department_ID", Value = bp.MaBP }, new SqlParameter { ParameterName = "@Department_Name", Value = bp.TenBP }, new SqlParameter { ParameterName = "@Description", Value = bp.GhiChu }, new SqlParameter { ParameterName = "@Active", Value = bp.ConQL }); } catch (SqlException ex) { throw ex; } finally { dao.DisConnect(); } }
public static void SuaBP(CBoPhan bp) { try { NhanVien dao = new NhanVien(); dao.SuaBP(bp); } catch (SqlException ex) { throw ex; } }
private void ThemBP() { CBoPhan bp = new CBoPhan(txtMa.Text, txtTen.Text, txtGhiChu.Text, ceConQL.Checked); BUS_NhanVien.ThemBP(bp); sendBP?.Invoke(); Action.Module = "Bộ Phận"; Action.ActionName = "Thêm"; Action.Reference = txtMa.Text; Action.LuuThongTin(); this.Close(); }
private void BtnSua_ItemClick(object sender, ItemClickEventArgs e) { int rowIndex = gvMain.FocusedRowHandle; CBoPhan bp = new CBoPhan { MaBP = gvMain.GetRowCellValue(rowIndex, "Department_ID").ToString(), TenBP = gvMain.GetRowCellValue(rowIndex, "Department_Name").ToString(), GhiChu = gvMain.GetRowCellValue(rowIndex, "Description").ToString(), ConQL = bool.Parse(gvMain.GetRowCellValue(rowIndex, "Active").ToString()) }; fThemSimple sua = new fThemSimple(false, bp, LoadData); sua.ShowDialog(); }