Exemplo n.º 1
0
        private Order mapRecipt(SalesOrderToWms salesOrder)
        {
            Order order = new Order
            {
                Customer    = Mapper.Map <Customers, Customer>(salesOrder.Customers),
                OrderHeader = Mapper.Map <SalesOrders, OrderHeader>(salesOrder.SalesOrder),
                OrderLines  = Mapper.Map <List <SalesOrderLines>, List <OrderLine> >(salesOrder.SalesOrderLines)
            };

            order.OrderLines.ForEach(x => x.CurrencyId = salesOrder.SalesOrder.CurrencyId);
            return(order);
        }
Exemplo n.º 2
0
        private List <SalesOrderToWms> getAllSalesOrderToSend()
        {
            var salesOrderToWmsList = new List <SalesOrderToWms>();
            var salesOrders         = db.SalesOrders.Where(x => x.WmsUpdate == null && x.SalesOrderStatusId == (int)SalesOrderStatusId.InProgres).ToList();

            foreach (var salesOrder in salesOrders)
            {
                var salesOrderList = db.SalesOrderLines.Where(x => x.SalesOrderId == salesOrder.SalesOrderId).ToList();
                var customers      = db.Customers.Where(x => x.CustomerId == salesOrder.CustomerId).FirstOrDefault();

                var salesOrderToWms = new SalesOrderToWms()
                {
                    SalesOrder      = salesOrder,
                    Customers       = customers,
                    SalesOrderLines = salesOrderList
                };
                salesOrderToWmsList.Add(salesOrderToWms);
            }
            return(salesOrderToWmsList);
        }