private void btnDelete_Click(object sender, EventArgs e) { DialogResult kq = MessageBox.Show("Bạn có muốn xóa sản phẩm này không?", "Thông báo", MessageBoxButtons.OKCancel); if (kq != DialogResult.Cancel) { DetailBillBUS.DeleteOneProduct(idBill, idProduct); if (DetailBillBUS.IsEmpty(idBill)) { return; } BillBUS.DeleteBill(idBill); } }
private void lstProductCart_MouseClick(object sender, MouseEventArgs e) { if (lstProductCart.SelectedItems.Count > 0) { MenuDTO order = lstProductCart.SelectedItems[0].Tag as MenuDTO; frm_ThongTinChiTietSanPham de = new frm_ThongTinChiTietSanPham(currentBillId, order.IdProduct, Convert.ToInt32(order.Quantity) + 1); de.lblProductName.Text = order.NameProduct; if (order.PriceBasic == 0) { de.lblPrice.Text = "Miễn phí"; } else { de.lblPrice.Text = String.Format("{0:0,0}", order.PriceBasic); } de.cbQuantity.SelectedIndex = Convert.ToInt32(order.Quantity) - 1; if (order.TotalPrice == 0) { de.lblTotal.Text = "Miễn phí"; } else { de.lblTotal.Text = String.Format("{0:0,0}", order.TotalPrice); } DialogResult kq = de.ShowDialog(); if (kq == DialogResult.OK) { DetailBillBUS.InsertDetailBill(currentBillId, order.ID, de.cbQuantity.SelectedIndex + 1); LoadListOrder(currentBillId); } else if (kq == DialogResult.Yes) { LoadListOrder(currentBillId); if (!DetailBillBUS.IsEmpty(currentBillId)) { btnTamTinh.Enabled = false; btnThanhToan.Enabled = false; txttotalPrice.Text = ""; txtHD.Text = ""; } } } }