Ejemplo n.º 1
0
        public static void GetMall_ShipRateDetailByCardIDList(int ProductID, List <int> CartIDList, int OrderID, out List <Dictionary <string, object> > list, int ProvinceID = 0, int Quantity = 0, int UserID = 0)
        {
            list = new List <Dictionary <string, object> >();
            var ship_rate_list = Mall_ShipRate.GetMall_ShipRates().ToArray();

            if (ProductID > 0)
            {
                var data = Mall_Product.GetMall_Product(ProductID);
                CalculateRateByProductOutDic(ship_rate_list, out list, ProvinceID: ProvinceID, Quantity: Quantity, BusinessID: data.BusinessID);
                return;
            }
            if (OrderID > 0)
            {
                var orderitem_list = Mall_OrderItem.GetMall_OrderItemListByOrderID(OrderID);
                if (orderitem_list.Length == 0)
                {
                    return;
                }
                var product_list  = Mall_Product.GetMall_ProductListByIDList(orderitem_list.Select(p => p.ProductID).ToList());
                int TotalQuantity = orderitem_list.Sum(p => p.Quantity);
                CalculateRateByProductOutDic(ship_rate_list, out list, ProvinceID: ProvinceID, Quantity: TotalQuantity, BusinessID: orderitem_list[0].BusinessID);
                return;
            }
            if (CartIDList.Count > 0)
            {
                var     cart_list      = Foresight.DataAccess.Mall_ShoppingCart.GetMall_ShoppingCartListByIDList(CartIDList, UserID);
                var     product_list   = Foresight.DataAccess.Mall_ProductDetail.GetMall_ProductDetailListByIDList(cart_list.Select(p => p.ProductID).ToList());
                var     variant_list   = Foresight.DataAccess.Mall_Product_VariantDetail.GetMall_Product_VariantDetailListByIDList(cart_list.Select(p => p.VariantID).ToList());
                var     business_list  = Foresight.DataAccess.Mall_Business.GetMall_BusinessListByIDList(product_list.Select(p => p.BusinessID).ToList());
                decimal totalprice     = 0;
                int     totalsalepoint = 0;
                int     TotalQuantity  = 0;
                string  totalpricedesc = string.Empty;
                var     productlist    = Mall_ShoppingCart.getshoppingcartitems(cart_list, product_list, variant_list, 0, string.Empty, out totalprice, out totalsalepoint, out TotalQuantity, out totalpricedesc);
                var     my_list        = new List <Dictionary <string, object> >();
                CalculateRateByProductOutDic(ship_rate_list, out my_list, ProvinceID: ProvinceID, Quantity: TotalQuantity, BusinessID: 0);
                list.AddRange(my_list);
                foreach (var business in business_list)
                {
                    totalprice     = 0;
                    totalsalepoint = 0;
                    TotalQuantity  = 0;
                    totalpricedesc = string.Empty;
                    productlist    = Mall_ShoppingCart.getshoppingcartitems(cart_list, product_list, variant_list, business.ID, string.Empty, out totalprice, out totalsalepoint, out TotalQuantity, out totalpricedesc);
                    my_list        = new List <Dictionary <string, object> >();
                    CalculateRateByProductOutDic(ship_rate_list, out my_list, ProvinceID: ProvinceID, Quantity: TotalQuantity, BusinessID: business.ID);
                    list.AddRange(my_list);
                }
            }
            return;
        }
Ejemplo n.º 2
0
 public static void GetMall_ShipRateDetailByKeywords(int ProductID, List <int> CartIDList, int OrderID, out string RateTitle, out decimal RateAmount, out int RateID, out int RateType, int ProvinceID = 0, int Quantity = 0, int UserID = 0)
 {
     RateTitle  = "快递 免邮";
     RateAmount = 0;
     RateID     = 0;
     RateType   = 0;
     if (ProductID > 0)
     {
         var data = Mall_Product.GetMall_Product(ProductID);
         CalculateRateByProduct(data, out RateTitle, out RateAmount, out RateID, out RateType, ProvinceID: ProvinceID, Quantity: Quantity);
         return;
     }
     if (OrderID > 0)
     {
         var orderitem_list = Mall_OrderItem.GetMall_OrderItemListByOrderID(OrderID);
         var product_list   = Mall_Product.GetMall_ProductListByIDList(orderitem_list.Select(p => p.ProductID).ToList());
         foreach (var item in orderitem_list)
         {
             var     product        = product_list.FirstOrDefault(p => p.ID == item.ProductID);
             decimal my_rate_amount = 0;
             string  my_rate_title  = string.Empty;
             CalculateRateByProduct(product, out my_rate_title, out my_rate_amount, out RateID, out RateType, ProvinceID: ProvinceID, Quantity: item.Quantity);
             RateAmount += my_rate_amount;
             RateTitle  += my_rate_title + " ";
         }
         return;
     }
     if (CartIDList.Count > 0)
     {
         var cartitem_list = Mall_ShoppingCart.GetMall_ShoppingCartListByIDList(CartIDList, UserID);
         var product_list  = Mall_Product.GetMall_ProductListByIDList(cartitem_list.Select(p => p.ProductID).ToList());
         foreach (var item in cartitem_list)
         {
             var     product        = product_list.FirstOrDefault(p => p.ID == item.ProductID);
             decimal my_rate_amount = 0;
             string  my_rate_title  = string.Empty;
             CalculateRateByProduct(product, out my_rate_title, out my_rate_amount, out RateID, out RateType, ProvinceID: ProvinceID, Quantity: item.Quantity);
             RateAmount += my_rate_amount;
             RateTitle  += my_rate_title + " ";
         }
         return;
     }
 }