Esempio n. 1
0
        OrdersInfoRequest GetOrdersInfoRequest()
        {
            if (_ordersInfoRequest == null)
            {
                _ordersInfoRequest = new OrdersInfoRequest {
                    BuyersID = new List <long>()
                };
            }
            _ordersInfoRequest.Statuses.Clear();
            _ordersInfoRequest.UniqueNumber = null;

            if (txtOrderNumberFilter.Text != "")
            {
                _ordersInfoRequest.CreatedOnFrom = null;
                _ordersInfoRequest.CreatedOnTo   = null;

                _ordersInfoRequest.UniqueNumber = txtOrderNumberFilter.Text;
                return(_ordersInfoRequest);
            }

            _ordersInfoRequest.CreatedOnFrom = dateRangeControl_Orders.From;
            _ordersInfoRequest.CreatedOnTo   = dateRangeControl_Orders.To;

            foreach (object o in ccboOrderStatus.Properties.Items.GetCheckedValues())
            {
                _ordersInfoRequest.Statuses.Add((OrderStatus)Enum.Parse(typeof(OrderStatus), o.ToString(), true));
            }
            if (_ordersInfoRequest.Statuses.Count > 12)
            {
                _ordersInfoRequest.Statuses.Clear();
            }

            if (cbIgnoreBuyerFilter.Checked)
            {
                _ordersInfoRequest.BuyersID.Clear();
            }
            else
            if (treeBuyers.Selection.Count > 0)
            {
                //if (_ordersInfoRequest.BuyersID == null)
                //_ordersInfoRequest.BuyersID = new List<long>();
                _ordersInfoRequest.BuyersID.Clear();
                foreach (TreeListNode node in treeBuyers.Selection)
                {
                    int    a = 0;
                    string s = node.RootNode.GetDisplayText(2);
                    if (Int32.TryParse(s, out a))
                    {
                        _ordersInfoRequest.BuyersID.Add(a);
                    }
                }
            }
            return(_ordersInfoRequest);
        }
Esempio n. 2
0
        //public static List<OrderDecorator> GetOrders(OrdersInfoRequest ordersInfoRequest)
        //public static IList<PaymentReportDecorator> GetPaymentReports(PaymentReportsRequest paymentReportsRequest)


        public static List <OrderInfoDecorator> GetOrders(OrdersInfoRequest ordersInfoRequest)
        {
            var restClient = (OrdersRestClient)GetRestClient("OrdersRestClient");

            var ordersInfo        = restClient.GetOrdersInfo(ordersInfoRequest);
            var ordersInfoPayload = ordersInfo.Payload as OrdersInfoPayloadElement;
            var orders            = ordersInfoPayload.OrdersInfo;

            return(orders.ConvertAll(delegate(OrderInfo x)
            {
                var orderDecorator = new OrderInfoDecorator(x);
                return orderDecorator;
            }));
        }
Esempio n. 3
0
        public void GetOrders()
        {
            var restClient = CreateRestClient();

            var ordersInfoRequest = new OrdersInfoRequest();

            ordersInfoRequest.PageSize = 10;
            ordersInfoRequest.Statuses = new List <OrderStatus> {
                OrderStatus.Pending, OrderStatus.Confirmed
            };
            ordersInfoRequest.CreatedOnFrom = DateTime.Parse("2011.08.01");

            var ordersInfo = restClient.GetOrdersInfo(ordersInfoRequest);

            Assert.NotNull(ordersInfo);

            var ordersInfoPayload = ordersInfo.Payload as OrdersInfoPayloadElement;

            Assert.NotNull(ordersInfoPayload);

            var orders = ordersInfoPayload.OrdersInfo;

            Assert.AreEqual(orders.Count, 10);
        }