public List<BillItem> GetReceipt(string sessionID, int tblNumber) { if (Auth.VerifySession(sessionID, "waiter")) { Guid id = getWorkflowIdFromTable(tblNumber); WorkflowInterface.WorkflowInterface.CustomerWF.RaiseCheckRequest(new System.Workflow.Activities.ExternalDataEventArgs(id)); ManualWorkflowSchedulerService manualScheduler = AppDomain.CurrentDomain.GetData("ManualScheduler") as ManualWorkflowSchedulerService; manualScheduler.RunWorkflow(id); List<BillItem> returnList = new List<BillItem>(); CRySTALDataConnections.CRySTALDataSet.BillItemsDataTable bit; CRySTALDataConnections.CRySTALDataSetTableAdapters.BillItemsTableAdapter bia = new CRySTALDataConnections.CRySTALDataSetTableAdapters.BillItemsTableAdapter(); bit = bia.GetDataByWorkflowID(id); foreach (CRySTALDataConnections.CRySTALDataSet.BillItemsRow row in bit.Rows) { BillItem bi = new BillItem(); bi.ItemName = row.Name; bi.ItemPrice = row.Price; bi.Person = row.Person; returnList.Add(bi); } return returnList; } else { throwSessionExp(sessionID); } return new List<BillItem>(); }
private void AddFoodOrderToBill(object sender, ExternalDataEventArgs e) { CRySTAL.FoodOrder order = (e as WorkflowLocalService.FoodOrderEventArgs).Order; CRySTALDataConnections.CRySTALDataSetTableAdapters.BillItemsTableAdapter bia = new CRySTALDataConnections.CRySTALDataSetTableAdapters.BillItemsTableAdapter(); CRySTAL.CrystalMenuDataContext db = new CRySTAL.CrystalMenuDataContext(); foreach (CRySTAL.ItemOrder item in order.FoodOrders) { var product = from p in db.MenuItems where p.ID == item.productID select p; if (product.Count() > 0) { bia.InsertBillItem(e.InstanceId, product.First().Name, (decimal)product.First().Price, item.DeleverToPerson); } } }