예제 #1
0
        public static OrderPipelineProcessResult CreateSO(OrderInfo orderInfo)
        {
            OrderPipelineProcessResult order = BuildCheckOut(orderInfo);

            if (order.HasSucceed)
            {
                OrderPipeline pipeline            = OrderPipeline.Create("CreateSO");
                OrderPipelineProcessResult result = null;
                try
                {
                    result = pipeline.Process(order.ReturnData);
                }
                catch (BusinessException bizEx)
                {
                    if (result == null)
                    {
                        result = new OrderPipelineProcessResult();
                    }
                    result.HasSucceed = false;
                    result.ErrorMessages.Add(bizEx.Message.ToString());
                }
                catch (Exception ex)
                {
                    if (result == null)
                    {
                        result = new OrderPipelineProcessResult();
                    }
                    ECommerce.Utility.Logger.WriteLog(ex.ToString(), "SOPipeline");
                    result.HasSucceed = false;
                    result.ErrorMessages.Add("系统繁忙,请稍后再试");
                }
                return(result);
            }
            return(order);
        }
예제 #2
0
        public static OrderPipelineProcessResult BuildShoppingCart(ShoppingCart shoppingCart)
        {
            #region 1.Check
            OrderPipelineProcessResult checkResult = _BuildShoppingCartBaseCheck(shoppingCart);
            if (!checkResult.HasSucceed)
            {
                return(checkResult);
            }
            #endregion

            #region 2.转换为orderinfo
            OrderInfo orderInfo = Convert2OrderInfo(shoppingCart);
            #endregion

            #region 3.订单和促销计算
            OrderPipeline pipeline            = OrderPipeline.Create("BuildShoppingCart");
            OrderPipelineProcessResult result = pipeline.Process(orderInfo);
            #endregion

            return(result);
        }