private void StoreData() { var cashier = AccountInformation.GetInstance().CurrentAccount.Employee; var bill = new MaintenanceBill() { BikeID = bike.ID, Date = DateTime.Now, CashierID = cashier.ID, StoreID = cashier.StoreID, CustomerPayment = customer }; bill.ID = MaintenanceBillDAL.GetInstance().Insert(bill); foreach (var item in currentList) { item.BillID = bill.ID; var billDetailID = BillDetailDAL.GetInstance().Insert(item); //foreach (var billEmp in item.BillEmployees) //{ // billEmp.BillDetailID = billDetailID; // BillEmployeesDAL.GetInstance().Insert(billEmp); //} } MessageBox.Show("Create Bill Success"); this.Close(); }
public long Insert(MaintenanceBill bill) { long id = 1; using (var db = new MotorcycleShopsEntities()) { db.MaintenanceBills.Add(bill); db.SaveChanges(); id = bill.ID; } return(id); }