示例#1
0
        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();
        }
示例#2
0
        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();
            }
        }
示例#3
0
 public static void SuaBP(CBoPhan bp)
 {
     try
     {
         NhanVien dao = new NhanVien();
         dao.SuaBP(bp);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
 }
示例#4
0
        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();
        }
示例#5
0
        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();
        }