Exemple #1
0
        public fThemSimple(bool isAdd = true, CNhomHang nh = null, fNhomHang.sendMessage send = null, float action = 1)
        {
            InitializeComponent();

            if (isAdd == false && nh == 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_HangHoa.LayNhomHang();
                Text  = "Thêm nhóm hàng";
            }
            else
            {
                editNH = nh;
                Text   = "Sửa thông tin nhóm hàng";
            }
            add    = isAdd;
            sendNH = send;

            flag = 2;

            InitNH();
        }
Exemple #2
0
        public void SuaNhomHang(CNhomHang nh)
        {
            Provider dao = new Provider();

            try
            {
                dao.Connect();
                string      sql  = "PRODUCT_GROUP_Update";
                CommandType type = CommandType.StoredProcedure;
                dao.ExeCuteNonQuery(type, sql,
                                    new SqlParameter {
                    ParameterName = "@ProductGroup_ID", Value = nh.MaNH
                },
                                    new SqlParameter {
                    ParameterName = "@ProductGroup_Name", Value = nh.TenNH
                },
                                    new SqlParameter {
                    ParameterName = "@Description", Value = nh.GhiChu
                },
                                    new SqlParameter {
                    ParameterName = "@Active", Value = nh.ConQL
                });
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                dao.DisConnect();
            }
        }
Exemple #3
0
 public static void SuaNH(CNhomHang nh)
 {
     try
     {
         HangHoa dao = new HangHoa();
         dao.SuaNhomHang(nh);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
 }
Exemple #4
0
        private void ThemNH()
        {
            CNhomHang nh = new CNhomHang(txtMa.Text, txtTen.Text, txtGhiChu.Text, ceConQL.Checked);

            BUS_HangHoa.ThemNH(nh);
            sendNH?.Invoke();

            Action.Module     = "Nhóm Hàng";
            Action.ActionName = "Thêm";
            Action.Reference  = txtMa.Text;
            Action.LuuThongTin();

            this.Close();
        }
Exemple #5
0
        private void BtnSua_ItemClick(object sender, ItemClickEventArgs e)
        {
            int       rowIndex = gvMain.FocusedRowHandle;
            CNhomHang nh       = new CNhomHang
            {
                MaNH   = gvMain.GetRowCellValue(rowIndex, "ProductGroup_ID").ToString(),
                TenNH  = gvMain.GetRowCellValue(rowIndex, "ProductGroup_Name").ToString(),
                GhiChu = gvMain.GetRowCellValue(rowIndex, "Description").ToString(),
                ConQL  = bool.Parse(gvMain.GetRowCellValue(rowIndex, "Active").ToString())
            };
            fThemSimple sua = new fThemSimple(false, nh, LoadData);

            sua.ShowDialog();
        }