コード例 #1
0
        public static void RefreshCart(this OrdersRequest request, bool refresh)
        {
            var info = CartRequestInformation.Get(request);

            if (info == null)
            {
                info = new CartRequestInformation(request, refresh);
            }
            else
            {
                info.Refresh = refresh;
            }
        }
コード例 #2
0
        /// <summary>
        /// To the loyalty card payment information.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns>The CommerceLoyaltyCardPaymentInfo instance.</returns>
        //public static LoyaltyCardPaymentInfo ToLoyaltyCardPaymentInfo(LoyaltyCardPaymentInputModelItem item)
        //{
        //    var paymentInfo = new LoyaltyCardPaymentInfo
        //    {
        //        Amount = item.Amount,
        //        PaymentMethodID = item.PaymentMethodID
        //    };

        //    return paymentInfo;
        //}

        public CartRequestInformation RefreshCartOnOrdersRequest(OrdersRequest request)
        {
            var info = CartRequestInformation.Get(request);

            if (info == null)
            {
                info = new CartRequestInformation(request, true);
            }
            else
            {
                info.Refresh = true;
            }
            return(info);
        }
コード例 #3
0
        public OrdersResponse(OrdersRequest req)
        {
            // получение списка заявок
            // как новых так и завершенных



            switch (req.Action)
            {
            case "OLD": Orders = Order._GetOldOrders(req.Sessionid); break;

            case "NEW": Orders = Order.GetNewOrders(req.Sessionid); break;

            default: Orders = new List <Order>(); break;
            }
        }
コード例 #4
0
        public IEnumerable <OrderDTO> GetOrders(OrdersRequest request = null)
        {
            if (request == null || AreAllPropertiesNull(request))
            {
                using (var unitOfWork = _factory.GetInstance())
                {
                    return(unitOfWork.GetOrders());
                }
            }

            Expression <Func <OrderDTO, bool> > finalExpression = null;

            if (request.Cost != null)
            {
                Expression <Func <OrderDTO, bool> > exp = x => x.Cost == request.Cost;
                finalExpression = CombineExpressions(finalExpression, exp);
            }

            if (request.CustomersRequest != null)
            {
                if (request.CustomersRequest.LastName != null)
                {
                    Expression <Func <OrderDTO, bool> > exp = x => x.Customer.LastName == request.CustomersRequest.LastName;
                    finalExpression = CombineExpressions(finalExpression, exp);
                }

                if (request.CustomersRequest.FirstName != null)
                {
                    Expression <Func <OrderDTO, bool> > exp = x => x.Customer.FirstName == request.CustomersRequest.FirstName;
                    finalExpression = CombineExpressions(finalExpression, exp);
                }
            }


            if (request.ManagersRequest != null && request.ManagersRequest.LastName != null)
            {
                Expression <Func <OrderDTO, bool> > exp = x => x.Manager.LastName == request.ManagersRequest.LastName;
                finalExpression = CombineExpressions(finalExpression, exp);
            }

            using (var unitOfWork = _factory.GetInstance())
            {
                return(unitOfWork.GetOrders(finalExpression));
            }
        }
コード例 #5
0
        public object Get(OrdersRequest request)
        {
            if (request.Ids != null && request.Ids.Any())
            {
                var orders = Db.GetByIds<Order>(request.Ids);

                return orders;
            }

            if (request.OrderStatus != OrderStatus.None)
            {
                var orders = Db.Where<Order>(new {request.OrderStatus});

                return orders;
            }

            return Db.Select<Order>();
        }
コード例 #6
0
        public static async Task <OrdersResponse> GetCurrentOrders()
        {
            var post = new OrdersRequest();

            try
            {
                var json        = JsonConvert.SerializeObject(post);
                var httpContent = new StringContent(json, Encoding.UTF8, "application/json");

                return(await MakeRequest <OrdersResponse>(ProjectConfig.GetCurrentOrdersUrl, httpContent));
            }
            catch (WebException ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(null);
        }
コード例 #7
0
        public async Task <IActionResult> ValidateClientOrders(string clientId, [FromBody] OrdersRequest request)
        {
            if (request == null)
            {
                return(BadRequest(OrdersValidationResponses.NullRequest));
            }

            var response = _validationService.ValidateOrders(clientId, request);

            if (!response.Success)
            {
                return(BadRequest(response));
            }

            _logger.LogInformation($"Validating orders for {clientId}");

            return(Ok(response));
        }
コード例 #8
0
ファイル: SqlOrdersService.cs プロジェクト: a864610877/src
        public DataTables <Ordersss> Query(OrdersRequest request)
        {
            SqlParameter[] param =
            {
                new SqlParameter("@userId",     request.userId),
                new SqlParameter("@mobile",     request.mobile),
                new SqlParameter("@orderNo",    request.orderNo),
                new SqlParameter("@orderState", request.orderState),
                new SqlParameter("@type",       request.type),
                new SqlParameter("@useScope",   request.useScope),
                new SqlParameter("@Bdate",      request.Bdate),
                new SqlParameter("@Edate",      request.Edate),
                new SqlParameter("@pageIndex",  request.pageIndex),
                new SqlParameter("@pageSize",   request.pageSize)
            };
            StoreProcedure sp = new StoreProcedure("P_getOrders", param);

            return(_databaseInstance.GetTables <Ordersss>(sp));
        }
コード例 #9
0
        public async Task <IActionResult> GetSearchMethodForOrder(string Email, OrdersRequest request)
        {
            var result = new OrdersResponse();

            var orders = await _context.Orders.Take(request.Quantity).Where(c => c.Email.StartsWith(Email) || c.Email.Contains(Email) || c.Email.EndsWith(Email)).Select(p => new Order {
                OrderId = p.Id, Email = p.Email
            }).ToListAsync();

            if (orders.Count == 0)
            {
                result.Code    = -100;
                result.Message = "Can't get products with given parameters.";
                return(Ok(result));
            }

            result.Code    = 100;
            result.Message = "Success";
            result.Orders  = orders;
            return(Ok(result));
        }
コード例 #10
0
        public async Task <IActionResult> GetOrders(OrdersRequest request)
        {
            var result = new OrdersResponse();

            var orders = await _context.Orders.Skip(request.Skip).Take(request.Quantity).Select(p => new Order {
                OrderId = p.Id, Email = p.Email
            }).ToListAsync();

            if (orders.Count == 0)
            {
                result.Code    = -100;
                result.Message = "Can't get products with given parameters.";
                return(Ok(result));
            }

            result.Code    = 100;
            result.Message = "Success";
            result.Orders  = orders;
            return(Ok(result));
        }
コード例 #11
0
        private bool AreAllPropertiesNull(OrdersRequest request)
        {
            if (request.Cost == null &&
                request.CustomersRequest == null &&
                request.ManagersRequest == null)
            {
                return(true);
            }
            if (request.CustomersRequest != null &&
                request.ManagersRequest != null &&
                request.Cost == null &&
                request.CustomersRequest.LastName == null &&
                request.CustomersRequest.FirstName == null &&
                request.ManagersRequest.LastName == null)
            {
                return(true);
            }

            return(false);
        }
コード例 #12
0
        public OrdersValidationResponse ValidateOrders(string clientId, OrdersRequest request)
        {
            _logger.LogInformation($"Validating orders request for client: {clientId}...");

            var portfolio = new Portfolio()
            {
                request.Stocks
            };

            _logger.LogInformation("Created portfolio");

            var validationState = _portfolioService.ValidatePortfolio(portfolio, clientId);

            _logger.LogInformation("Received validation state ");

            var response = BuildResponse(validationState);

            _logger.LogInformation("Validation response retrieved");

            return(response);
        }
コード例 #13
0
        public ActionResult ConsumptionLogPage(int pageIndex)
        {
            int userId = 0;
            var result = new ConsumptionLogResult();

            result.pageIndex = pageIndex;
            result.pageSize  = 15;
            var cookieId = Request.Cookies[SessionKeys.USERID].Value.ToString();

            int.TryParse(cookieId, out userId);
            var request = new OrdersRequest();

            request.userId     = userId;
            request.pageIndex  = result.pageIndex;
            request.pageSize   = result.pageSize;
            request.orderState = OrderStates.paid;
            var query = ordersService.Query(request);

            if (query != null)
            {
                result.ListConsumptionLog = query.ModelList.Select(x => new ConsumptionLogModel(x)).ToList();
            }
            return(Json(result));
        }
コード例 #14
0
 public async Task <OrdersResponse> GetOrders(OrdersRequest request)
 {
     return(await GetResult <OrdersResponse, OrdersRequest>(PrivateApiCall.GetOrders, request));
 }