Пример #1
0
        public ActionResult ListAllOrders(string srchParam, string startDate, string endDate, int page = 1, int itemsperpage = 10)
        {
            var user = _userRepository.GetUser(this.User.Identity.Name);
            DateTime baseDate = DateTime.Today;
            if(itemsperpage != null)
            {
                ViewModelBase.ItemsPerPage = itemsperpage;
            }
            
            ViewBag.srchText = srchParam;
            ViewBag.itemsPerPage = itemsperpage;
            int currentPageIndex = page < 0 ? 0 : page - 1;
            int take = itemsperpage;
            int skip = currentPageIndex*take;

            var query = new QueryOutletOrder() {Skip = skip, Take = take, Name = srchParam};
            query.OutletId = user != null ? user.CostCentre : Guid.Empty;
            query.From = startDate == null ? baseDate.AddDays(1 - baseDate.Day) : Convert.ToDateTime(startDate);
            query.To = endDate == null
                           ? baseDate.AddDays(1 - baseDate.Day).AddMonths(1).AddSeconds(-1)
                           : Convert.ToDateTime(endDate).AddDays(1);

            ViewBag.startDate = query.From;
            ViewBag.endDate = query.To;

            var result = _outletMainOrderRepository.ListAllOrders(query);
            var data = result.Data;
            var count = result.Count;

            return View(data.ToPagedList(currentPageIndex, ViewModelBase.ItemsPerPage, count));
        }
Пример #2
0
        public ActionResult Index()
        {
            var query = new QueryOutletOrder();
            query.From = DateTime.Now.AddDays(-10);
             query.To =  query.From.AddDays(20);
             query.OutletId = new Guid("17C666DA-1238-45E3-988F-5A6D14042B5E");
             var ss = _outletMainOrderRepository.PendingApprovalQuery(query);
            return View();

        }