public bool AddBill(DateTime date, float BillValue, float MoneyReceive, float MoneyChange, string customerID, ListView ListBookImport) { if (BillDAL.AddBill(date, BillValue, MoneyReceive, MoneyChange, customerID)) { try { foreach (ListViewItem book in ListBookImport.Items) { string id = book.SubItems[1].Text; int count = Int32.Parse(book.SubItems[3].Text); float price = float.Parse(book.SubItems[4].Text); float total = float.Parse(book.SubItems[5].Text); if (!BillDAL.AddBillInfo(id, count, price, total)) { return(false); } } return(true); } catch { return(false); } } return(false); }
public void SaveBill(string cusId, string staffId, int sum, List <BillProduct> proList) { string now = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); string lastBillId = dal.GetLastBillId().Rows.Count == 0?"":dal.GetLastBillId().Rows[0][0].ToString(); dal.AddBill(AddBillBLL.NextId("HD", lastBillId, 2), now, cusId, staffId, sum, proList); }