public ActionResult Edit(BillViewResult billViewResult) { ViewBag.TimePeriod = ConverterDictionary.TimePeriodDictionary.FirstOrDefault(p => p.Key == billViewResult.TimePeriod).Value; var detailsViewResults = billViewResult.Details; if (detailsViewResults == null) { GetModelError(DBResult.WrongParameter); return(View("EditPage", billViewResult)); } for (int i = detailsViewResults.Count() - 1; i >= 0; i--) { if (detailsViewResults[i] == null) { detailsViewResults.Remove(detailsViewResults[i]); } } if (!ModelState.IsValid) { return(View("EditPage", billViewResult)); } var service = new BillBusinessService(); var result = service.Edit(billViewResult); if (GetModelError(result)) { return(View("EditPage", billViewResult)); } return(Index()); }
public ActionResult Pay(BillViewResult billViewResult) { ViewBag.TimePeriod = ConverterDictionary.TimePeriodDictionary.FirstOrDefault(p => p.Key == billViewResult.TimePeriod).Value; var service = new BillBusinessService(); var result = service.Pay(billViewResult); if (GetModelError(result)) { return(View("PayPage", billViewResult)); } return(Index()); }
public ActionResult AddPage() { DateTime nowDate = DateTime.Now; int nowHour = nowDate.Hour; int timePeriod = ConverterDictionary.NowTimePeriodDictionary.FirstOrDefault(p => nowHour >= p.Key[0] && nowHour < p.Key[1]).Value; var orderForeID = BuilderDictionary.ForeIDDictionary.FirstOrDefault(i => i.Key == typeof(BillViewResult)).Value; var viewResult = new BillViewResult(); viewResult.ID = orderForeID + nowDate.ToString("yyyyMMddHHmmss"); viewResult.Date = nowDate; viewResult.TimePeriod = timePeriod; ViewBag.TimePeriods = new SelectList(ConverterDictionary.TimePeriodDictionary, "Key", "Value"); return(View("AddPage", viewResult)); }
public ActionResult Add(BillViewResult billViewResult) { ViewBag.TimePeriods = new SelectList(ConverterDictionary.TimePeriodDictionary, "Key", "Value"); if (!ModelState.IsValid) { return(View("AddPage", billViewResult)); } var service = ServiceHelper.GetOrderService <BillViewResult>(); var result = service.Add(billViewResult); if (GetModelError(result)) { return(View("AddPage", billViewResult)); } return(Index()); }
public ActionResult Discount(BillViewResult billViewResult) { var newBillViewResult = new BillViewResult(); ViewBag.Discounts = GetSelectList <Discount>(new DiscountQueryConditions { OrderBy = "ID", IgnoredProperties = new string[] { "IsMemberOnly" } }, "Description", "Description"); ViewBag.TimePeriod = ConverterDictionary.TimePeriodDictionary.FirstOrDefault(p => p.Key == billViewResult.TimePeriod).Value; var service = new BillBusinessService(); var result = service.Discount(billViewResult, out newBillViewResult); if (GetModelError(result)) { return(View("DiscountPage", billViewResult)); } return(PayPage(newBillViewResult)); }
public ActionResult PayPage(BillViewResult billViewResult) { ViewBag.TimePeriod = ConverterDictionary.TimePeriodDictionary.FirstOrDefault(p => p.Key == billViewResult.TimePeriod).Value; return(View("PayPage", billViewResult)); }