示例#1
0
 public void btnDeleteProductStore_Click(object sender, EventArgs e)
 {
     if (txtIDProductCH.Text == "" || txtNameProductCH.Text == "" || txtUnitCH.Text == "" || txtPriceCH.Text == "" || txtAmountOfProductCH.Text == "")
     {
         XtraMessageBox.Show("Bạn phải chọn Sản phẩm để xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         ClearDisplay();
         return;
     }
     try
     {
         SanPhamCH_DTO sanpham = new SanPhamCH_DTO();
         sanpham.MaSPCH = txtIDProductCH.Text;
         if (SanPhamCH_BUS.XoaSPCH(sanpham))
         {
             LoadSanPhamCH1();
             XtraMessageBox.Show("Xóa Sản phẩm trong Cửa hàng thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             lvListImageProduct.Items.Clear();
             imageList.Images.Clear();
             Display();
             ClearDisplay();
             return;
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
 }
示例#2
0
 public void btnDeleteProductStore_Click(object sender, EventArgs e)
 {
     if (txtIDProductCH.Text == "")
     {
         MessageBox.Show("Bạn phải chọn Sản phẩm để xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         ClearDisplay();
         return;
     }
     try
     {
         SanPhamCH_DTO sanpham = new SanPhamCH_DTO();
         sanpham.MaSPCH = (string)dtgvProductListOfStore.CurrentRow.Cells["MaSPCH"].Value;
         if (SanPhamCH_BUS.XoaSPCH(sanpham))
         {
             LoadSanPhamCH();
             MessageBox.Show("Xóa Sản phẩm trong Cửa hàng thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             ClearDisplay();
             return;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#3
0
        private void btnUpdateProductStore_Click(object sender, EventArgs e)
        {
            if (txtIDProductCH.Text == "" || txtNameProductCH.Text == "" || txtUnitCH.Text == "" || txtPriceCH.Text == "" || txtAmountOfProductCH.Text == "")
            {
                MessageBox.Show("Bạn phải điền đầy đủ thông tin !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ClearDisplay();
                return;
            }


            SanPhamCH_DTO sanpham = new SanPhamCH_DTO();

            sanpham.MaSPCH = txtIDProductCH.Text;
            sanpham.TenSP  = txtNameProductCH.Text;

            sanpham.DonVi   = txtUnitCH.Text;
            sanpham.Gia     = Double.Parse(txtPriceCH.Text.ToString());
            sanpham.SoLuong = Int32.Parse(txtAmountOfProductCH.Text.ToString());
            sanpham.HinhAnh = convertImageToBytes();


            if (SanPhamCH_BUS.SuaSPCH(sanpham))
            {
                MessageBox.Show("Sửa thông tin Sản phẩm trong Cửa hàng thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadSanPhamCH();
                ClearDisplay();

                return;
            }
            MessageBox.Show("Sửa thông tin Sản Phẩm trong Cửa hàng thất bại !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#4
0
        private void LoadMaSP()
        {
            List <SanPhamCH_DTO> sanpham = SanPhamCH_BUS.LoadSanPHamCH();

            cmbIDProductDetailStore.DataSource    = sanpham;
            cmbIDProductDetailStore.ValueMember   = "MaSPCH";
            cmbIDProductDetailStore.DisplayMember = "MaSPCH";
        }
示例#5
0
        private void btnUpdateProductStore_Click(object sender, EventArgs e)
        {
            if (txtIDProductCH.Text == "" || txtNameProductCH.Text == "" || txtUnitCH.Text == "" || txtPriceCH.Text == "" || txtAmountOfProductCH.Text == "")
            {
                XtraMessageBox.Show("Bạn phải điền đầy đủ thông tin !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                ClearDisplay();
                return;
            }
            try
            {
                SanPhamCH_DTO sanpham = new SanPhamCH_DTO();
                sanpham.MaSPCH = txtIDProductCH.Text;
                sanpham.TenSP  = txtNameProductCH.Text;

                sanpham.DonVi   = txtUnitCH.Text;
                sanpham.Gia     = Double.Parse(txtPriceCH.Text.ToString());
                sanpham.SoLuong = Int32.Parse(txtAmountOfProductCH.Text.ToString());
                sanpham.HinhAnh = imageLocation;
                sanpham.ThongSo = txtParameter.Text;

                if (cbRetail.Checked == true)
                {
                    sanpham.BanLe     = 1;
                    sanpham.SoLuongLe = Convert.ToInt32(txtAmonutRetail.Text);
                }
                else
                {
                    sanpham.BanLe     = 0;
                    sanpham.SoLuongLe = 0;
                }


                if (SanPhamCH_BUS.SuaSPCH(sanpham))
                {
                    XtraMessageBox.Show("Sửa thông tin Sản phẩm trong Cửa hàng thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadSanPhamCH1();

                    lvListImageProduct.Items.Clear();
                    imageList.Images.Clear();
                    Display();
                    ClearDisplay();

                    return;
                }
            }catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
示例#6
0
        private void lvListImageProduct_Click(object sender, EventArgs e)
        {
            var          firstSelectedItem = lvListImageProduct.SelectedItems[0];
            string       s = firstSelectedItem.SubItems[0].Text;
            DataGridView d = new DataGridView();

            SanPhamCH_DTO sanpham = SanPhamCH_BUS.TimKiemTenSP(s);

            try
            {
                txtIDProductCH.Text       = sanpham.MaSPCH;
                txtNameProductCH.Text     = sanpham.TenSP;
                txtPriceCH.Text           = sanpham.Gia.ToString();
                txtUnitCH.Text            = sanpham.DonVi;
                txtAmountOfProductCH.Text = sanpham.SoLuong.ToString();
                txtParameter.Text         = sanpham.ThongSo.ToString();
                if (sanpham.BanLe == 1)
                {
                    txtAmonutRetail.Text = sanpham.SoLuongLe.ToString();
                    cbRetail.Checked     = true;
                }
                else
                {
                    cbRetail.Checked        = false;
                    txtAmonutRetail.Enabled = false;
                    txtAmonutRetail.Text    = "";
                }
                string str = sanpham.HinhAnh.ToString();

                imageLocation = str;
                if (str == "" || str == null)
                {
                    pictureBox.Image = Resources.noimage;
                }
                else
                {
                    pictureBox.Image = Image.FromFile(str);
                }
            }
            catch
            {
                return;
            }
        }