private void ProceedPayment() { if (txtTotalMoney.Text != "0") { StaffDAO1 staff = new StaffDAO1(); BillDAO1 bill = new BillDAO1(); hoadon h = new hoadon(); h.mahd = bill.getnewID(); h.hoten = txtCustomerName.Text; h.sdt = txtCustomerPhoneNumber.Text; h.ngaylap = DateTime.Now; h.macn = Program.station; h.tong = TotalValue; h.manv = staff.getIDbyUsername(Program.idLoged); if (bill.create(h) == 1) { //MessageBox.Show("Thêm thành công"); ProceedPayment_Detail(h.mahd); } else { MessageBox.Show("Thêm thất bại"); } //int totalValue = TotalValue; //int DiscountMoney = totalValue - Pay; //string CustomerName = txtCustomerName.Text; //string CustomerPhone = txtCustomerPhoneNumber.Text; //int IDCustomer = BillDAO.Instance.AddCustomerInfor(CustomerName, CustomerPhone); //int IDBill = BillDAO.Instance.AddBillInfor(IDCustomer, StaffID, totalValue, DiscountMoney,Pay); } }
private void ProceedPayment_Detail(string IDBill) { foreach (SellItemInfor item in ListSellItem) { BillDAO1 bill = new BillDAO1(); chitiethoadon cthd = new chitiethoadon(); cthd.mahd = IDBill; cthd.masp = item.ProductID; cthd.soluong = item.Amount; if (bill.createDetailbill(cthd) == 1) { updateInventory(item.SID, item.ProductID, item.Amount); } else { MessageBox.Show("Thêm thất bại"); } //int money = item.Money; //BillDAO.Instance.DetailBill(IDBill, idProduct, amount, money); } }