protected virtual async Task <Dictionary <Guid, TrackingInfoViewModel> > GetShipmentsTrackingInfoViewModels(
            OrderQueryResult orderQueryResult,
            GetCustomerOrdersParam param)
        {
            var shipmentsTrackingInfos = new Dictionary <Guid, TrackingInfoViewModel>();

            var getOrderTasks = orderQueryResult.Results.Select(order => OrderRepository.GetOrderAsync(new GetCustomerOrderParam
            {
                OrderNumber = order.OrderNumber,
                Scope       = param.Scope
            }));

            var orders = await Task.WhenAll(getOrderTasks).ConfigureAwait(false);

            foreach (var order in orders)
            {
                foreach (var shipment in order.Cart.Shipments)
                {
                    var shippingTrackingProvider = ShippingTrackingProviderFactory.ResolveProvider(shipment.FulfillmentMethod.Name);
                    var trackingInfoVm           = shippingTrackingProvider.GetTrackingInfoViewModel(shipment, param.CultureInfo);
                    shipmentsTrackingInfos.Add(shipment.Id, trackingInfoVm);
                }
            }

            return(shipmentsTrackingInfos);
        }
Exemple #2
0
        protected virtual Dictionary <Guid, TrackingInfoViewModel> GetShipmentsTrackingInfoViewModels(
            List <Overture.ServiceModel.Orders.Order> orders,
            GetCustomerOrdersParam param)
        {
            var shipmentsTrackingInfos = new Dictionary <Guid, TrackingInfoViewModel>();

            foreach (var order in orders)
            {
                foreach (var shipment in order.Cart.Shipments)
                {
                    var shippingTrackingProvider = ShippingTrackingProviderFactory.ResolveProvider(shipment.FulfillmentMethod.Name);
                    var trackingInfoVm           = shippingTrackingProvider.GetTrackingInfoViewModel(shipment, param.CultureInfo);
                    shipmentsTrackingInfos.Add(shipment.Id, trackingInfoVm);
                }
            }

            return(shipmentsTrackingInfos);
        }