예제 #1
0
        public IEnumerable <Order> GetOrders(DateTime dateFrom, DateTime dateTo)
        {
            var getSalesRequest = new GetSalesRequest(dateFrom, dateTo);

            var rawOrders = new List <Order>();

            ActionPolicies.Submit.Do(() =>
            {
                rawOrders =
                    _webRequestServices.GetResponse <OrderList>(getSalesRequest).Sale.Where(s => s.SaleLines != null).ToList();
            });

            var items     = GetItems(rawOrders);
            var shipInfos = GetShipInfo(rawOrders);

            rawOrders.ForEach(o =>
            {
                o.SaleLines.ForEach(s =>
                                    o.Products.Add(items.ToList().Find(i => i.ItemId == s.ItemId))
                                    );

                if (shipInfos.ContainsKey(o.SaleId))
                {
                    o.ShipTo = shipInfos.GetValue(o.SaleId);
                }
            });

            return(rawOrders);
        }
        public IEnumerable <Shop> GetShops()
        {
            var getShopsRequest = new GetShopRequest();

            return(_webRequestServices.GetResponse <ShopsList>(getShopsRequest).Shop);
        }