Exemplo n.º 1
0
        public PagedList <DeliveryListItemDto> ShipmentFilterPage(DeliveryListOptions options)
        {
            var queryable = _context.Documents
                            .AsNoTracking();

            queryable = queryable.Where(d => d.DocumentType.Code == "OG");

            if (options.FromLocationId != 0)
            {
                queryable = queryable.Where(d => d.LocationId == options.FromLocationId);
            }

            if (options.IsClosed != null)
            {
                queryable = queryable.Where(d => d.IsClosed == options.IsClosed);
            }

            return(queryable
                   .OrderByDescending(d => d.DocumentDate)
                   .Select(d => new DeliveryListItemDto
            {
                DeliveryNoteId = d.Id,
                DeliveryNo = d.DocumentNo,
                ToLocationName = "Muud hankijad",
                FromLocationName = d.Location.Name,
                DeliveryDate = d.DocumentDate,
                StatusName = d.IsClosed ? "Suletud" : "Avatud"
            })
                   .GetPagedList(options.CurrentPage, options.PageSize));
        }
Exemplo n.º 2
0
        public PagedList <LocationDeliveryListItemDto> ReceiptFilterPage(DeliveryListOptions options)
        {
            var queryable = _context.Documents
                            .AsNoTracking()
                            .Where(d => d.DocumentType.Code == "VL");

            if (options.ToLocationId != 0)
            {
                queryable = queryable.Where(d => d.LocationId == options.ToLocationId);
            }

            if (options.FromLocationId != 0)
            {
                queryable = queryable.Where(d => d.ToFromLocationId == options.FromLocationId);
            }
            else if (options.FromLocationTypeId != 0)
            {
                queryable = queryable.Where(d => d.ToFromLocation.LocationTypeId == options.FromLocationTypeId);
            }

            if (options.IsClosed != null)
            {
                queryable = queryable.Where(d => d.IsClosed == options.IsClosed);
            }

            return(queryable
                   .OrderByDescending(d => d.DocumentDate)
                   .Select(d => new LocationDeliveryListItemDto
            {
                DocumentId = d.Id,
                DocumentNo = d.DocumentNo,
                ToLocationName = d.Location.Name,
                FromLocationName = d.ToFromLocation.Name,
                DocumentDate = d.DocumentDate,
                StatusName = d.IsClosed ? "Suletud" : "Avatud"
            })
                   .GetPagedList(options.CurrentPage, options.PageSize));
        }