Пример #1
0
        public static decimal GetMainSkuShippingCost(Cart cart)
        {
            decimal            shippingCost    = 0;
            List <SkuShipping> skuShippingList = ShippingDAL.GetSkuShipping();

            SitePreference sitePreference = CSFactory.GetCartPrefrence(cart);

            if (sitePreference != null)
            {
                foreach (Sku sku in cart.CartItems)
                {
                    if (SiteBasePage.IsMainSku(sku.SkuId))
                    {
                        CSData.SkuShipping skuShipping = skuShippingList.FirstOrDefault(x =>
                        {
                            return(x.PrefId == sitePreference.ShippingPrefID &&
                                   x.SkuId == sku.SkuId);
                        });

                        if (skuShipping != null)
                        {
                            shippingCost += (skuShipping.Cost * sku.Quantity);
                        }
                    }
                }
            }

            return(shippingCost);
            // TODO: add rush sku cost support
        }
Пример #2
0
        private decimal GetMerchandiseSubtotal(Order orderItem)
        {
            SitePreference sitePreference = CSFactory.GetCartPrefrence();

            List <SkuShipping> shippingCosts = ShippingDAL.GetSkuShipping();

            decimal rushCharge = 0;

            foreach (Sku sku in orderItem.SkuItems)
            {
                if (!sku.AttributeValuesLoaded)
                {
                    sku.LoadAttributeValues();
                }

                if (!sku.GetAttributeValue("RushSku", false))
                {
                    continue;
                }

                CSData.SkuShipping skuShipping = shippingCosts.FirstOrDefault(x =>
                {
                    return(x.PrefId == sitePreference.ShippingPrefID &&
                           x.SkuId == sku.SkuId);
                });

                if (skuShipping != null)
                {
                    rushCharge += (skuShipping.Cost * sku.Quantity);
                }
            }

            return(rushCharge);
        }
Пример #3
0
        private decimal GetSurchargeAmt(Order orderItem)
        {
            SitePreference sitePreference = CSFactory.GetCartPrefrence();

            List <SkuShipping> shippingCosts = ShippingDAL.GetSkuShipping();

            decimal surcharge = 0;

            foreach (Sku sku in orderItem.SkuItems)
            {
                if (!sku.AttributeValuesLoaded)
                {
                    sku.LoadAttributeValues();
                }

                if (!sku.SkuCode.ToUpper().Contains("SURCHARGE"))
                {
                    continue;
                }

                CSData.SkuShipping skuShipping = shippingCosts.FirstOrDefault(x =>
                {
                    return(x.PrefId == sitePreference.ShippingPrefID &&
                           x.SkuId == sku.SkuId);
                });

                if (skuShipping != null)
                {
                    surcharge += (skuShipping.Cost * sku.Quantity);
                }
            }

            return(surcharge);
        }
Пример #4
0
        private decimal GetRushShippingCost(List <Sku> skuItems, ref ShippingMethodEnum shippingMethod)
        {
            SitePreference sitePreference = CSFactory.GetCartPrefrence();

            List <SkuShipping> shippingCosts = ShippingDAL.GetSkuShipping();

            decimal rushCharge = 0;

            foreach (Sku sku in skuItems)
            {
                if (!sku.AttributeValuesLoaded)
                {
                    sku.LoadAttributeValues();
                }

                if (!sku.GetAttributeValue("RushSku", false))
                {
                    continue;
                }

                CSData.SkuShipping skuShipping = shippingCosts.FirstOrDefault(x =>
                {
                    return(x.PrefId == sitePreference.ShippingPrefID &&
                           x.SkuId == sku.SkuId);
                });

                if (skuShipping != null)
                {
                    // this will set shippingmethod to last one in list - there should really be on rush sku in cart, however
                    switch (sku.SkuCode.ToUpper())
                    {
                    case "OVERNIGHT":
                        shippingMethod = ShippingMethodEnum.NextDay;
                        break;

                    case "002UPS":
                        shippingMethod = ShippingMethodEnum.SecondDay;
                        break;
                    }

                    rushCharge += (skuShipping.Cost * sku.Quantity);
                }
            }

            return(rushCharge);
        }