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); }
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; } }