Пример #1
0
        private ApplicationListItem[] GetApplicationListItems(long?senderId, long?carrierId, long?forwarderId,
                                                              string language)
        {
            var stateIds = _stateFilter.GetStateVisibility();

            var data = _applications.List(stateIds, new[]
            {
                new Order {
                    Desc = true, OrderType = OrderType.AirWaybill
                },
                new Order {
                    Desc = false, OrderType = OrderType.Client
                },
                new Order {
                    Desc = true, OrderType = OrderType.Id
                }
            }, null, 0, null, senderId, carrierId, forwarderId, _stateConfig.CargoReceivedStateId,
                                          _stateConfig.CargoReceivedDaysToShow);

            var withoutAwb = data.Where(x => !x.AirWaybillId.HasValue)
                             .OrderByDescending(x => x.Id);

            var withAwb = data.Where(x => x.AirWaybillId.HasValue);

            data = withoutAwb.Concat(withAwb).ToArray();

            return(_itemMapper.Map(data, language));
        }
Пример #2
0
        public ApplicationListCollection List(
            string language, int?take = null, int skip      = 0, Order[] groups      = null,
            long?clientId             = null, long?senderId = null, long?forwarderId = null, long?carrierId = null)
        {
            long total;
            var  data = GetList(take, skip, groups, clientId, senderId, forwarderId, carrierId, out total);

            var applications = _mapper.Map(data, language);

            if (groups == null || groups.Length == 0)
            {
                return new ApplicationListCollection
                       {
                           Data  = applications,
                           Total = total,
                       }
            }
            ;

            return(GetGroupedResult(groups, applications, total, clientId, senderId, forwarderId, carrierId));
        }