Пример #1
0
        public fThemSimple(bool isAdd = true, CDonViTinh dv = null, fDonViTinh.sendMessage send = null, int action = 1)
        {
            InitializeComponent();

            if (isAdd == false && dv == 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_DonViTinh.GetDVT();
                Text  = "Thêm đơn vị tính";
            }
            else
            {
                editDV = dv;
                Text   = "Sửa thông tin đơn vị tính";
            }
            add    = isAdd;
            sendDV = send;

            flag = 1;

            InitDV();
        }
Пример #2
0
        public void SuaDV(CDonViTinh dv)
        {
            Provider dao = new Provider();

            try
            {
                dao.Connect();
                string      sql  = "UNIT_Update";
                CommandType type = CommandType.StoredProcedure;
                dao.ExeCuteNonQuery(type, sql,
                                    new SqlParameter {
                    ParameterName = "@Unit_ID", Value = dv.MaDV
                },
                                    new SqlParameter {
                    ParameterName = "@Unit_Name", Value = dv.TenDV
                },
                                    new SqlParameter {
                    ParameterName = "@Description", Value = dv.GhiChu
                },
                                    new SqlParameter {
                    ParameterName = "@Active", Value = dv.ConQL
                });
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                dao.DisConnect();
            }
        }
Пример #3
0
 public static void SuaDV(CDonViTinh dv)
 {
     try
     {
         DonViTinh dao = new DonViTinh();
         dao.SuaDV(dv);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
 }
Пример #4
0
        private void ThemDV()
        {
            CDonViTinh dv = new CDonViTinh(txtMa.Text, txtTen.Text, txtGhiChu.Text, ceConQL.Checked);

            BUS_DonViTinh.ThemDV(dv);
            sendDV?.Invoke();

            Action.Module     = "Đơn Vị Tính";
            Action.ActionName = "Thêm";
            Action.Reference  = txtMa.Text;
            Action.LuuThongTin();

            this.Close();
        }
Пример #5
0
        private void BtnSua_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int        rowIndex = gvMain.FocusedRowHandle;
            CDonViTinh dv       = new CDonViTinh
            {
                MaDV   = gvMain.GetRowCellValue(rowIndex, "Unit_ID").ToString(),
                TenDV  = gvMain.GetRowCellValue(rowIndex, "Unit_Name").ToString(),
                GhiChu = gvMain.GetRowCellValue(rowIndex, "Description").ToString(),
                ConQL  = bool.Parse(gvMain.GetRowCellValue(rowIndex, "Active").ToString())
            };
            fThemSimple sua = new fThemSimple(false, dv, LoadData);

            sua.ShowDialog();
        }