Exemplo n.º 1
0
        public static IDictionary <int, decimal> CalcFreight(int regionId, ShoppingCartInfo shoppingCart, out decimal totalFreight)
        {
            IDictionary <int, decimal> dictionary = new Dictionary <int, decimal>();

            totalFreight = default(decimal);
            if (shoppingCart != null)
            {
                var list = (from i in shoppingCart.LineItems
                            select new
                {
                    i.SupplierId,
                    i.SupplierName
                }).Distinct().ToList();
                if ((from i in shoppingCart.LineItems
                     where i.SupplierId == 0
                     select i).Count() <= 0)
                {
                    list.Add(new
                    {
                        SupplierId   = 0,
                        SupplierName = "平台"
                    });
                }
                for (int j = 0; j < list.Count; j++)
                {
                    var     anon = list[j];
                    decimal num  = ShoppingProcessor.CalcSupplierFreight(anon.SupplierId, regionId, shoppingCart);
                    totalFreight += num;
                    dictionary.Add(anon.SupplierId, num);
                }
            }
            return(dictionary);
        }
Exemplo n.º 2
0
        public static decimal CalcFreight(int regionId, ShoppingCartInfo shoppingCart)
        {
            decimal num = default(decimal);

            if (shoppingCart != null)
            {
                var list = (from i in shoppingCart.LineItems
                            select new
                {
                    i.SupplierId,
                    i.SupplierName
                }).Distinct().ToList();
                if ((from i in shoppingCart.LineItems
                     where i.SupplierId == 0
                     select i).Count() <= 0)
                {
                    list.Add(new
                    {
                        SupplierId   = 0,
                        SupplierName = "平台"
                    });
                }
                for (int j = 0; j < list.Count; j++)
                {
                    var anon = list[j];
                    num += ShoppingProcessor.CalcSupplierFreight(anon.SupplierId, regionId, shoppingCart);
                }
            }
            return(num);
        }