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>(); }
/// <summary> /// Gets the bill from DB. /// </summary> /// <param name="workflowInstId">The workflow inst id.</param> /// <returns></returns> public BillData GetBillFromDB(Guid workflowInstId) { BillItemsTableAdapter bia = new BillItemsTableAdapter(); var rows = bia.GetDataByWorkflowID(workflowInstId); BillData bd = new BillData(); bd.BillTotal = 0.00M; bd.Items = new List<BillItem>(); foreach (var row in rows) { BillItem bi = new BillItem(); bi.ItemName = row.Name; bi.ItemPrice = row.Price; bi.Person = row.Person; bd.Items.Add(bi); bd.BillTotal += bi.ItemPrice; } return bd; }