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 }
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); }
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); }
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); }