Пример #1
0
        private BatchReportModel LoadOrders(BatchKey key, int ordersPageNumber)
        {
            var orders = m_ordersFacade.GetOrdersByUsedBatch(key, c_pageSize, ordersPageNumber).ToList();

            var entry = new BatchOrdersReportEntry(key)
            {
                CanLoadMoreOrders = orders.Count == c_pageSize,
                NextOrdersPage    = ordersPageNumber + 1
            };

            foreach (var entity in orders)
            {
                entry.Orders.Add(new BatchOrderModel
                {
                    OrderId          = entity.Item1.Id,
                    Customer         = entity.Item1.CustomerEmail,
                    OrderNumber      = entity.Item1.OrderNumber,
                    PurchaseDate     = StringUtil.FormatDateTime(entity.Item1.PurchaseDate),
                    Status           = m_orderStatusRepository.Translate(entity.Item1.OrderStatusId),
                    Quantity         = StringUtil.FormatDecimal(entity.Item2),
                    IsAllocation     = !OrderStatus.IsSent(entity.Item1.OrderStatusId),
                    AllocationHandle = OrderStatus.IsSent(entity.Item1.OrderStatusId) ? null : $"{entity.Item1.Id}|{key.ToString(m_batchFacade)}"
                });
            }

            var result = new BatchReportModel();

            result.Report.Add(entry);

            return(result);
        }