コード例 #1
0
 public MealMenuOrderReportResponse GetOrderReport(MealMenuOrderReportRequest request)
 {
     return(Execute <MealMenuOrderReportRequest, MealMenuOrderReportResponse>(
                request,
                response =>
     {
         int totalCount;
         response.Orders = MealMenuOrderFacade.GetOrderReport(request.Filter, request.PageSize,
                                                              request.PageIndex,
                                                              request.OrderByField,
                                                              request.OrderByAsc, out totalCount);
         response.TotalCount = totalCount;
     }));
 }
コード例 #2
0
        public ActionResult OrderList()
        {
            var mealTypeId = (int)MealTypes.Breakfast;

            if (!string.IsNullOrWhiteSpace(Request["MealTypeId"]))
            {
                mealTypeId = Int32.Parse(Request["MealTypeId"]);
            }


            var mealTypes = Lookups.GetItems <MealTypes>().Where(d => d.Id > 0).Select(d => new SelectListItem
            {
                Value    = d.Id.ToString(),
                Text     = d.Text,
                Selected = d.Id == mealTypeId
            }).ToList();

            ViewBag.MealTypes = mealTypes;

            var schoolTypeId = 0;

            if (!string.IsNullOrWhiteSpace(Request["SchoolTypeId"]))
            {
                schoolTypeId = Int32.Parse(Request["SchoolTypeId"]);
            }

            var schoolTypes = SysMngConfig.Lookups.GetItems <SysMngConfig.SchoolTypes>();

            ViewBag.SchoolTypes = schoolTypes.Select(d => new SelectListItem {
                Text = d.Text, Value = d.Id.ToString(), Selected = (d.Id == schoolTypeId)
            }).ToList();


            var recordCount = 25;

            if (!string.IsNullOrWhiteSpace(Request["RecordCount"]))
            {
                recordCount = Int32.Parse(Request["RecordCount"]);
            }

            ViewBag.RecordCounts = new List <SelectListItem>
            {
                new SelectListItem {
                    Value = "25", Text = "25", Selected = recordCount == 25
                },
                new SelectListItem {
                    Value = "50", Text = "50", Selected = recordCount == 50
                },
                new SelectListItem {
                    Value = "100", Text = "100", Selected = recordCount == 100
                },
                new SelectListItem {
                    Value = "250", Text = "250", Selected = recordCount == 250
                },
                new SelectListItem {
                    Value = "500", Text = "500", Selected = recordCount == 500
                },
                new SelectListItem {
                    Value = "1000", Text = "1000", Selected = recordCount == 1000
                }
            };



            //var orderStartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            //var orderEndDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(orderStartDate.Year, orderStartDate.Month));

            var orderStartDate = DateTime.Now.AddDays(-6);
            var orderEndDate   = DateTime.Now;

            if (!string.IsNullOrWhiteSpace(Request["OrderStartDate"]))
            {
                orderStartDate = DateTime.Parse(Request["OrderStartDate"]);
            }
            if (!string.IsNullOrWhiteSpace(Request["OrderEndDate"]))
            {
                orderEndDate = DateTime.Parse(Request["OrderEndDate"]);
            }



            var request = new MealMenuOrderReportRequest
            {
                Filter = new OrderReportFilterView
                {
                    OrderStartDate       = orderStartDate,
                    OrderEndDate         = orderEndDate,
                    SchoolNameStartsWith = Request["SchoolNameStartsWith"] ?? string.Empty,
                    MealTypeId           = mealTypeId,
                    SchoolTypeId         = schoolTypeId
                },
                OrderByAsc   = true,
                OrderByField = "SchoolName",
                PageIndex    = 1,
                PageSize     = recordCount,
            };
            var result = MealMenuOrderService.GetOrderReport(request);

            return(View(result.Orders));
        }