/// <summary>
        /// filter orders by pending
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public ActionResult Pending(int pageIndex)
        {
            var query  = new OrdersQueryRequest(pageIndex, PageSize, CurrentUser.Id);
            var orders = _orderQueryService.GetPendingOrders(query);

            return(View("Pending", orders));
        }
        /// <summary>
        /// Orders which have been completed the process
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public ActionResult Completed(int pageIndex)
        {
            var query  = new OrdersQueryRequest(pageIndex, PageSize, CurrentUser.Id);
            var orders = _orderQueryService.GetCompletedOrders(query);

            return(View("Completed", orders));
        }
Beispiel #3
0
        public ActionResult List(int pageIndex, int pageSize)
        {
            var query  = new OrdersQueryRequest(pageIndex, pageSize);
            var orders = _orderQueryService.GetOrders(query);

            return(View("List", orders));
        }
Beispiel #4
0
        public async Task <ActionResult> DirectorOrders(OrdersQueryRequest request)
        {
            if (!Request.IsAjaxRequest())
            {
                return(View());
            }

            var manager = new OrderManager(User);

            var paging = await manager.GetDirectorOrdersAsync(request.Start, request.Take, request.GetOrderListQueryFilter(User));

            var colorForms = await new BasicDataManager(User).GetColorFormsAsync();

            var orders = paging.List.Select(u =>
            {
                var colorForm = colorForms.FirstOrDefault(f => f.Id == u.ColorFormId);
                return(new OrderListItemViewModel(u)
                {
                    ColorFormName = colorForm == null ? "" : colorForm.Name
                });
            });

            return(Json(true, string.Empty, new
            {
                paging.Total,
                List = orders
            }));
        }
Beispiel #5
0
        public async Task <ActionResult> List(OrdersQueryRequest request)
        {
            if (!Request.IsAjaxRequest())
            {
                return(View(request));
            }

            var manager = new OrderManager(User);
            var paging  = await manager.GetOrdersAsync(request.Start, request.Take, request.GetOrderListQueryFilter(User), request.OutPutWaxDate);

            var users  = await new UserManager().GetUsersAsync(paging.List.Select(o => o.CurrentUserId));
            var orders = paging.List.Select(u => new OrderListItemViewModel(u)
            {
                CurrentUserName = users.FirstOrDefault(s => s.Id == u.CurrentUserId)?.Name
            });

            return(Json(true, string.Empty, new
            {
                paging.Total,
                List = orders,
            }));
        }
Beispiel #6
0
        /// <summary>
        /// Fetch store orders.
        /// </summary>
        public virtual async Task <List <Order> > GetAsync(OrdersQueryRequest query = null)
        {
            var req = PrepareRequest("orders");

            if (query != null)
            {
                req.QueryParams.AddRange(query.ToQueryParameters());
            }

            try
            {
                return(await ExecuteRequestAsync <List <Order> >(req, HttpMethod.Get));
            }
            catch (QuickbutikException e)
            {
                if (e.Code == 404)
                {
                    return(new List <Order>());
                }
                throw;
            }
        }
Beispiel #7
0
        public async Task <ActionResult> MyOrders(OrdersQueryRequest request)
        {
            if (!Request.IsAjaxRequest())
            {
                return(View());
            }

            var manager = new OrderManager(User);

            var paging = await manager.GetDesignOrdersAsync(request.Start, request.Take, request.GetOrderListQueryFilter(User));

            var basicDataManager = new BasicDataManager(User);
            var colorForms       = await basicDataManager.GetColorFormsAsync();

            var designs = await new UserManager().GetUserByRoleAsync(SaleManagentConstants.SystemRole.Design);

            var orders = paging.List.Select(u =>
            {
                var colorForm = colorForms.FirstOrDefault(f => f.Id == u.ColorFormId);
                return(new OrderListItemViewModel(u)
                {
                    ColorFormName = colorForm == null ? "" : colorForm.Name,
                    CurrentUserName = designs.FirstOrDefault(s => s.Id == u.CurrentUserId)?.Name,
                    Attachments = u.Attachments.Where(r => designs.Any(d => d.Id == r.CreatorId)).Select(a => new AttachmentItem
                    {
                        Id = a.FileInfoId,
                        Url = "/Attachment/" + a.FileInfoId + "/Thumbnail"
                    }).ToList()
                });
            });

            return(Json(true, string.Empty, new
            {
                paging.Total,
                List = orders,
            }));
        }