Exemplo n.º 1
0
        /// <summary>
        /// 订单汇总信息
        /// </summary>
        /// <param name="norMalShoppingCart">购物车列表</param>
        /// <param name="channelId">区域ID</param>
        /// <param name="userId">用户id</param>
        /// <param name="payId">支付id</param>
        /// <param name="logisticsId">配送id</param>
        /// <param name="cityId">城市id</param>
        /// <returns></returns>
        public static OrderSumaryEntity SummaryOrderInfo(List <ShoppingCartEntity> norMalShoppingCart, int channelId, int userId, int payId, int logisticsId, int cityId)
        {
            var result = new OrderSumaryEntity();

            try
            {
                result.TotalScore    = norMalShoppingCart.Sum(c => c.intScore * c.intBuyCount);
                result.TotalGoodsFee = norMalShoppingCart.Sum(c => c.intBuyCount * c.numSalePrice);
                result.TotalWeight   = norMalShoppingCart.Sum(c => c.intBuyCount * c.intWeight ?? 0);
                result.TotalOriginal = norMalShoppingCart.Sum(c => c.intBuyCount * c.numOrgPrice);
                result.TotalFreight  =
                    BaseDataBLL.GetLogisticsInfo(
                        channelId,
                        userId,
                        MCvHelper.To <int>(cityId, 0),
                        payId, logisticsId,
                        result.TotalWeight, result.TotalGoodsFee).info;
                result.TotalDiscountFee = result.TotalGoodsFee -
                                          result.TotalOriginal;
                result.TotalOrderFee = result.TotalFreight +
                                       result.TotalGoodsFee -
                                       result.TotalDiscountFee;
            }
            catch (Exception ex)
            {
                MLogManager.Error(MLogGroup.Order.订单汇总信息, null, "", ex);
            }
            return(result);
        }