Ejemplo n.º 1
0
        private IQueryable <WOrder_Order> GetOrder(GetUserWorkInput input)
        {
            var orderData = orderRepository.GetAll().Where(u => u.TStatus == TStatus.Finish);

            if (input.SDate.HasValue)
            {
                orderData = orderData.Where(u => u.EndDate >= input.SDate.Value);
            }

            if (input.EDate.HasValue)
            {
                orderData = orderData.Where(u => u.EndDate >= input.EDate.Value.AddDays(1));
            }

            if (input.OrderType.HasValue)
            {
                orderData = orderData.Where(u => u.OrderType.Equals(input.OrderType.Value));
            }

            if (!string.IsNullOrEmpty(input.UserName))
            {
                orderData = orderData.Where(u => u.Handler.UserName.Contains(input.UserName));
            }


            if (!string.IsNullOrEmpty(input.OAdress))
            {
                orderData = orderData.Where(u => u.OAddress.Contains(input.OAdress));
            }

            return(orderData);
        }
Ejemplo n.º 2
0
        public async Task <PagedResultDto <TypeCount> > GetTypeCount(GetUserWorkInput input)
        {
            var orderData = GetOrder(input);
            var data      = from a in orderData
                            group a by new { a.OAddress } into g
                select new TypeCount
            {
                Name  = g.Key.OAddress,
                Value = g.Count()
            };

            return(await Task.FromResult(new PagedResultDto <TypeCount>()
            {
                TotalCount = data.Count(),
                Items = data.ToList()
            }));
        }
Ejemplo n.º 3
0
        public async Task <PagedResultDto <UserWorkDto> > GetUserWork(GetUserWorkInput input)
        {
            var orderData = GetOrder(input).
                            Include("Handler");
            var data = from a in orderData
                       group a by new { a.Handler.UserName, a.Handler.Position } into g
                select new UserWorkDto
            {
                UserName = g.Key.UserName,
                Position = g.Key.Position,
                UserNum  = g.Count()
            };

            return(await Task.FromResult(new PagedResultDto <UserWorkDto>()
            {
                TotalCount = data.Count(),
                Items = data.ToList()
            }));
        }