public static DistributorShoppingCartItem GetCatalogItems(int id, int qty, string sku, string countrylocal) { CatalogItem_V01 catalog = CatalogProvider.GetCatalogItem(sku, countrylocal.Substring(3)); if (catalog == null) { return(new DistributorShoppingCartItem { ID = id, MinQuantity = 1, PartialBackordered = false, Quantity = qty, SKU = sku, Updated = DateTime.Now, }); } else { return(new DistributorShoppingCartItem { ID = id, MinQuantity = 1, PartialBackordered = false, Quantity = qty, SKU = sku, Updated = DateTime.Now, CatalogItem = catalog, Description = catalog.Description }); } }
private bool CheckInventory(CatalogItem_V01 catItem) { int inventoryQty = 0; int quantity = 0; if (null != catItem) { if (!string.IsNullOrEmpty(tbQuantity.Text)) { int.TryParse(tbQuantity.Text.Trim(), out quantity); } else { quantity = 0; } MyHLShoppingCart cart = (ProductsBase).ShoppingCart; if (null != cart && null != cart.DeliveryInfo) { inventoryQty = ShoppingCartProvider.CheckInventory(catItem, quantity, cart.DeliveryInfo.WarehouseCode); } } return(inventoryQty > 0); }
private bool CheckInventory(string skuToCheck, int quantity) { int inventoryQty = 0; if (!string.IsNullOrEmpty(skuToCheck)) { CatalogItem_V01 catItem = CatalogProvider.GetCatalogItem(skuToCheck, this.ProductsBase.CountryCode); if (catItem != null) { WarehouseInventory warehouseInventory; if (catItem.InventoryList != null && catItem.InventoryList.TryGetValue(ProductsBase.CurrentWarehouse, out warehouseInventory)) { var warehouseInventory01 = warehouseInventory as WarehouseInventory_V01; if (warehouseInventory01 != null && !warehouseInventory01.IsBlocked) { inventoryQty = ShoppingCartProvider.CheckInventory(catItem, quantity, this.ProductsBase.CurrentWarehouse); } } } } lblError.Text = inventoryQty > 0 ? string.Empty : string.Format(MyHL_ErrorMessage.OutOfInventory, skuToCheck); return(inventoryQty > 0); }
private bool isEventTicketSKU(CatalogItem_V01 item, string sku) { return(item.IsEventTicket && !_systemSKUS.Contains(sku) && !APFDueProvider.IsAPFSku(sku) && !HLConfigManager.Configurations.CheckoutConfiguration.SpecialSKUList.Exists(s => s.Equals(sku)) && !(sku.Equals(HLConfigManager.Configurations.DOConfiguration.HFFHerbalifeSku) || HLConfigManager.Configurations.DOConfiguration.HFFSkuList.Exists(s => s.Equals(sku)))); }
private void displayLocaleSpecificRadioButtons() { string primarySku = HLConfigManager.Configurations.DOConfiguration.TodayMagazineSku; string secondarySku = HLConfigManager.Configurations.DOConfiguration.TodayMagazineSecondarySku; MyHLShoppingCart cart = (ProductsBase).ShoppingCart; //checks if primary sku is present in the catalog. CatalogItem_V01 catItem = CatalogProvider.GetCatalogItem(primarySku, (this.Page as ProductsBase).CountryCode); if (catItem != null && !IsBlocked(catItem)) { this.divTodaysMagazine.Visible = true; displayTodaysMagazine(true); //SetlocaleDescription(Locale.Substring(3)); //this.rbSecondaryLanguage.Visible = false; } else //Primary sku not present, do not display both primary and secondary. { this.rbPrimaryLanguage.Visible = false; this.rbSecondaryLanguage.Visible = false; this.divTodaysMagazine.Visible = false; this.divTodaysMagazine.Style.Add(System.Web.UI.HtmlTextWriterStyle.Display, "none"); displayTodaysMagazine(false); return; } //if secondary sku is not present, then do not show the radio buttons. if (secondarySku.Equals(string.Empty)) { this.rbPrimaryLanguage.Visible = false; this.rbSecondaryLanguage.Visible = false; return; } //if primary sku is present, check for secondary sku in the catalog. CatalogItem_V01 catSecItem = CatalogProvider.GetCatalogItem(secondarySku, (this.Page as ProductsBase).CountryCode); if (catSecItem != null && !IsBlocked(catSecItem)) { //SetlocaleDescription(Locale.Substring(3)); this.rbSecondaryLanguage.Visible = true; } else { this.rbPrimaryLanguage.Visible = this.rbSecondaryLanguage.Visible = false; } //Set the default selection to primary... if ((this.rbPrimaryLanguage != null) && (this.rbSecondaryLanguage != null)) { this.rbPrimaryLanguage.Checked = true; this.rbSecondaryLanguage.Checked = false; } }
private ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart, ShoppingCartRuleReason reason, ShoppingCartRuleResult Result) { if (reason == ShoppingCartRuleReason.CartItemsBeingAdded) { CatalogItem_V01 currentItem = CatalogProvider.GetCatalogItem(cart.CurrentItems[0].SKU, Country); try { List <string> codes = new List <string>(CountryType.TH.HmsCountryCodes); codes.Add(CountryType.TH.Key); bool isCOPThai = codes.Contains(DistributorProfileModel.ProcessingCountryCode); TaxIdentification tid = null; var tins = DistributorOrderingProfileProvider.GetTinList(cart.DistributorID, true); tid = tins.Find(t => t.IDType.Key == "THID"); //Simulate the dummy tin with an foreign DS //TaxIdentification ti = new TaxIdentification() { CountryCode = "TH", ID = "dummy", IDType = new TaxIdentificationType(dummyTin) }; //ods.Value.TinList.Add(ti); if (CanPurchase(cart.DistributorID, Country)) { //Additional Check to allow DS COP = Thai Tin = No TIN, Can place only L and A items if (IsWithOutTinCode) { if (currentItem.ProductType == ProductType.Product) { Result.Result = RulesResult.Failure; Result.AddMessage(HttpContext.GetGlobalResourceObject(string.Format("{0}_Rules", HLConfigManager.Platform), "CantPurchase").ToString()); cart.RuleResults.Add(Result); } } } else { if (IsWithOutTinCode) { if (currentItem.ProductType == ProductType.Product) { Result.Result = RulesResult.Failure; Result.AddMessage(HttpContext.GetGlobalResourceObject(string.Format("{0}_Rules", HLConfigManager.Platform), "CantPurchase").ToString()); cart.RuleResults.Add(Result); } } } } catch (Exception ex) { LoggerHelper.Error(string.Format("Error while performing Add to Cart Rule for Singapore distributor: {0}, Cart Id:{1}, \r\n{2}", cart.DistributorID, cart.ShoppingCartID, ex.ToString())); } } return(Result); }
private bool IsBlocked(CatalogItem_V01 catItem) { MyHLShoppingCart cart = (ProductsBase).ShoppingCart; if (null != cart && null != cart.DeliveryInfo && catItem.InventoryList != null && catItem.InventoryList.ContainsKey(cart.DeliveryInfo.WarehouseCode)) { WarehouseInventory warehouseInventory = catItem.InventoryList[cart.DeliveryInfo.WarehouseCode]; if (null != warehouseInventory) { WarehouseInventory_V01 inventory = warehouseInventory as WarehouseInventory_V01; if (inventory != null) { return(inventory.IsBlocked); } } } return(true); }
protected override ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart, ShoppingCartRuleReason reason, ShoppingCartRuleResult Result) { if (reason == ShoppingCartRuleReason.CartItemsBeingAdded) { var currentLimits = base.GetPurchasingLimits(cart.DistributorID, string.Empty); var theLimits = currentLimits[PurchasingLimitProvider.GetOrderMonth()]; // If it's threshold volume point for all product types is counted if (PurchasingLimitProvider.IsOrderThresholdMaxVolume(theLimits)) { Result = base.PerformRules(cart, reason, Result); } else if (!DistributorIsExemptFromPurchasingLimits(cart.DistributorID)) { CatalogItem_V01 currentItem = CatalogProvider.GetCatalogItem(cart.CurrentItems[0].SKU, Country); Result = base.PerformRules(cart, reason, Result); } } return(Result); }
protected override ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart, ShoppingCartRuleReason reason, ShoppingCartRuleResult Result) { decimal NewVolumePoints = 0m; decimal cartVolume = 0m; if (reason == ShoppingCartRuleReason.CartItemsBeingAdded) { CatalogItem_V01 currentItem = CatalogProvider.GetCatalogItem(cart.CurrentItems[0].SKU, Country); List <string> codes = new List <string>(CountryType.PH.HmsCountryCodes); codes.Add(CountryType.PH.Key); if (!codes.Contains(DistributorProfileModel.ProcessingCountryCode)) { MyHLShoppingCart myCart = cart as MyHLShoppingCart; if (!string.IsNullOrEmpty(myCart.VolumeInCart.ToString())) { cartVolume = myCart.VolumeInCart; } NewVolumePoints = currentItem.VolumePoints * cart.CurrentItems[0].Quantity; if (cartVolume + NewVolumePoints > MaxVolPoints) { var errorMessage = HttpContext.GetGlobalResourceObject(string.Format("{0}_Rules", HLConfigManager.Platform), "VolumePointExceeds") ?? "Item SKU:{0} has not been added to the cart since by adding that into the cart, you exceeded your volume points limit."; Result.AddMessage(string.Format(errorMessage.ToString(), cart.CurrentItems[0].SKU.ToString())); Result.Result = RulesResult.Failure; cart.RuleResults.Add(Result); } } } return(Result); }
protected override ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart, ShoppingCartRuleReason reason, ShoppingCartRuleResult Result) { decimal NewVolumePoints = 0m; decimal cartVolume = 0m; if (reason == ShoppingCartRuleReason.CartItemsBeingAdded) { CatalogItem_V01 currentItem = CatalogProvider.GetCatalogItem(cart.CurrentItems[0].SKU, Country); if (currentItem == null) { return(Result); } List <string> codes = new List <string>(CountryType.SG.HmsCountryCodes); codes.Add(CountryType.SG.Key); var tins = DistributorOrderingProfileProvider.GetTinList(cart.DistributorID, true); IPurchasingLimitManager manager = new PurchasingLimitManagerFactory().GetPurchasingLimitManager(cart.DistributorID); if (!codes.Contains(DistributorProfileModel.ProcessingCountryCode)) // foreign DS { //Foreign DS without local National ID they cannot purchase "P" type products. if (tins != null && tins.Find(t => t.IDType.Key == "SNID") == null) { if (currentItem.ProductType == ServiceProvider.CatalogSvc.ProductType.Product) { Result.Result = RulesResult.Failure; Result.AddMessage(HttpContext.GetGlobalResourceObject(string.Format("{0}_Rules", HLConfigManager.Platform), "CantPurchase").ToString()); cart.RuleResults.Add(Result); return(Result); } } //Foreign DS with local National ID they can purchase P L and A type items. } if (PurchasingLimitProvider.IsRestrictedByMarketingPlan(cart.DistributorID)) { return(base.PerformRules(cart, reason, Result)); } // DS with Dummy TIN No "S0000000S", can purchase any category of products up to 1100 vp per order if (tins != null && tins.Find(t => t.ID == "S0000000S") != null) { MyHLShoppingCart myCart = cart as MyHLShoppingCart; if (!string.IsNullOrEmpty(myCart.VolumeInCart.ToString())) { cartVolume = myCart.VolumeInCart; } NewVolumePoints = currentItem.VolumePoints * cart.CurrentItems[0].Quantity; if (cartVolume + NewVolumePoints > MaxVolPoints) { Result.AddMessage( string.Format( HttpContext.GetGlobalResourceObject( string.Format("{0}_Rules", HLConfigManager.Platform), "VolumePointExceeds") .ToString(), cart.CurrentItems[0].SKU)); Result.Result = RulesResult.Failure; cart.RuleResults.Add(Result); return(Result); } else { return(Result); } } } return(Result); }
public int CheckInventory(CatalogItem_V01 cItem, int quantity, string warehouse, string freightCode, ref bool isSplitted) { return(Providers.ShoppingCartProvider.CheckInventory(cItem, quantity, warehouse, freightCode, ref isSplitted)); }
public int CheckInventory(CatalogItem_V01 cItem, int quantity, string warehouse) { return(Providers.ShoppingCartProvider.CheckInventory(cItem, quantity, warehouse)); }
protected override ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart, ShoppingCartRuleReason reason, ShoppingCartRuleResult Result) { if (reason == ShoppingCartRuleReason.CartItemsBeingAdded) { var currentLimits = base.GetPurchasingLimits(cart.DistributorID, string.Empty); var theLimits = currentLimits[PurchasingLimitProvider.GetOrderMonth()]; // If it's threshold volume point for all product types is counted if (PurchasingLimitProvider.IsOrderThresholdMaxVolume(theLimits)) { Result = base.PerformRules(cart, reason, Result); } else if (!DistributorIsExemptFromPurchasingLimits(cart.DistributorID)) { CatalogItem_V01 currentItem = CatalogProvider.GetCatalogItem(cart.CurrentItems[0].SKU, Country); Result = base.PerformRules(cart, reason, Result); } } if (reason == ShoppingCartRuleReason.CartCreated && cart.CartItems.Any()) { var currentLimits = base.GetPurchasingLimits(cart.DistributorID, string.Empty); var theLimits = currentLimits[PurchasingLimitProvider.GetOrderMonth()]; // If it's threshold volume point for all product types is counted if (PurchasingLimitProvider.IsOrderThresholdMaxVolume(theLimits)) { Result = base.PerformRules(cart, reason, Result); } else if (!DistributorIsExemptFromPurchasingLimits(cart.DistributorID)) { var purchasingLimitManager = PurchasingLimitManager(cart.DistributorID); decimal DistributorRemainingVolumePoints = 0; decimal DistributorRemainingDiscountedRetail = 0; var myhlCart = cart as MyHLShoppingCart; if (null == myhlCart) { LoggerHelper.Error( string.Format("{0} myhlCart is null {1}", Locale, cart.DistributorID)); Result.Result = RulesResult.Failure; return(Result); } PurchasingLimits_V01 PurchasingLimits = PurchasingLimitProvider.GetCurrentPurchasingLimits(cart.DistributorID); purchasingLimitManager.SetPurchasingLimits(PurchasingLimits); if (null == PurchasingLimits) { LoggerHelper.Error( string.Format("{0} PurchasingLimits could not be retrieved for distributor {1}", Locale, cart.DistributorID)); Result.Result = RulesResult.Failure; return(Result); } DistributorRemainingVolumePoints = DistributorRemainingDiscountedRetail = PurchasingLimits.RemainingVolume; if (PurchasingLimits.PurchaseLimitType == PurchaseLimitType.Volume) { if (PurchasingLimits.maxVolumeLimit == -1) { return(Result); } decimal cartVolume = (cart as MyHLShoppingCart).VolumeInCart; if (DistributorRemainingVolumePoints - cartVolume < 0) { Result.Result = RulesResult.Failure; Result.AddMessage( PlatformResources.GetGlobalResourceString("ErrorMessage", "NoCheckoutPurchaseLimitsExceeded")); cart.RuleResults.Add(Result); } } else { Result.Result = RulesResult.Success; } } else { Result = base.PerformRules(cart, reason, Result); } } return(Result); }
/// <summary>Distributor is APF Due, add APF to the cart</summary> /// <param name="distributorID"></param> /// <param name="result"></param> /// <param name="cacheKey"></param> /// <param name="locale"></param> /// <param name="cartHasItems"></param> /// <param name="ruleResult"></param> private void DoApfDue(string distributorID, ShoppingCart_V01 result, string cacheKey, string locale, bool cartHasItems, ShoppingCartRuleResult ruleResult, bool justEntered) { var cart = result as MyHLShoppingCart; if (cart == null) { return; } try { string level; if (DistributorProfileModel != null) { level = DistributorProfileModel.TypeCode.ToUpper(); } else { level = GetMemberLevelFromDistributorProfile(cart.DistributorID); } //var distributorOrderingProfile = DistributorOrderingProfileProvider.GetProfile(cart.DistributorID, // cart.CountryCode); //if ((distributorOrderingProfile.HardCashOnly && // !HLConfigManager.Configurations.PaymentsConfiguration.AllowWireForHardCash)) //{ // return; //} var apfItems = new List <ShoppingCartItem_V01>(); if (cart.CartItems != null && cart.CartItems.Count > 0) { //Stash off all non-APF items - to be re-added if appropriate var nonApfItems = (from c in cart.CartItems where APFDueProvider.IsAPFSku(c.SKU.Trim()) == false select c) .ToList <ShoppingCartItem_V01>(); apfItems = (from c in cart.CartItems where APFDueProvider.IsAPFSku(c.SKU.Trim()) select c) .ToList <ShoppingCartItem_V01>(); if (nonApfItems.Count > 0 || HLConfigManager.Configurations.APFConfiguration.StandaloneAPFOnlyAllowed) { // Clear the cart cart.DeleteItemsFromCart(null, true); //if (APFDueProvider.CanEditAPFOrder(distributorID, locale, level)) //{ //Global rule - they can always edit the cart ie add remove products at least var list = CatalogProvider.GetCatalogItems((from p in nonApfItems select p.SKU).ToList(), Country); var products = (from c in list where c.Value.ProductType == ProductType.Product select c.Value.SKU).ToList(); var nonproducts = (from c in list where c.Value.ProductType != ProductType.Product select c.Value.SKU).ToList(); if (!HLConfigManager.Configurations.APFConfiguration.AllowNonProductItemsWithStandaloneAPF) //We don't allow non product items alone on an apf order { if (products.Count == 0) { if (nonproducts.Count > 0) { ruleResult.Result = RulesResult.Success; ruleResult.AddMessage( HttpContext.GetGlobalResourceObject( string.Format("{0}_ErrorMessage", HLConfigManager.Platform), "NonProductItemsRemovedForStandaloneAPF") as string); cart.RuleResults.Add(ruleResult); } } else { cart.AddItemsToCart(nonApfItems, true); } } else { if (!HLConfigManager.Configurations.APFConfiguration.StandaloneAPFOnlyAllowed) { cart.AddItemsToCart(nonApfItems, true); } } } } else if (null != cart && null != cart.RuleResults) { var rules = (from rule in cart.RuleResults where rule.RuleName == RuleName && rule.Result == RulesResult.Failure select rule); if (null != rules && rules.Count() > 0) { cart.RuleResults.Remove(rules.First()); } } //Add the APF in var apfSku = new List <ShoppingCartItem_V01>(); var sku = APFDueProvider.GetAPFSku(); apfSku.Add(new ShoppingCartItem_V01(0, sku, 1, DateTime.Now)); bool hasPreOrdering = false; if (!cart.APFEdited) { if (HLConfigManager.Configurations.DOConfiguration.IsChina) { if (cart.CartItems != null && cart.CartItems.Count > 0) { var warehouseInventorycartitemlist = new List <WarehouseInventory_V01>(); foreach (var cartitem in cart.CartItems) { CatalogItem_V01 catalogItem = CatalogProvider.GetCatalogItem(cartitem.SKU, "CN"); if (catalogItem.InventoryList != null && catalogItem.InventoryList.ContainsKey(cart.DeliveryInfo.WarehouseCode)) { warehouseInventorycartitemlist.Add(catalogItem.InventoryList[cart.DeliveryInfo.WarehouseCode] as WarehouseInventory_V01); } } if (warehouseInventorycartitemlist.Count > 0) //Check if the newly added product is preordering product. { if (warehouseInventorycartitemlist.Any(x => x.IsPreOrdering)) { hasPreOrdering = true; } } } if (!hasPreOrdering) { if (cart.CurrentItems != null && cart.CurrentItems.Count > 0) { var warehouseInventorycartitemlist = new List <WarehouseInventory_V01>(); foreach (var cartitem in cart.CurrentItems) { CatalogItem_V01 catalogItem = CatalogProvider.GetCatalogItem(cartitem.SKU, "CN"); if (catalogItem.InventoryList != null && catalogItem.InventoryList.ContainsKey(cart.DeliveryInfo.WarehouseCode)) { warehouseInventorycartitemlist.Add(catalogItem.InventoryList[cart.DeliveryInfo.WarehouseCode] as WarehouseInventory_V01); } } if (warehouseInventorycartitemlist.Count > 0) //Check if the newly added product is preordering product. { if (warehouseInventorycartitemlist.Any(x => x.IsPreOrdering)) { hasPreOrdering = true; } } } } } if (!hasPreOrdering) { var distributorProfile = DistributorOrderingProfileProvider.GetProfile(cart.DistributorID, cart.CountryCode); var notReInitiated = Settings.GetRequiredAppSetting("NotReInitiated"); if (notReInitiated.Contains(cart.CountryCode)) { apfSku[0].Quantity = CalcQuantity(distributorProfile.ApfDueDate); } else { apfSku[0].Quantity = 1; } if (cart.CartItems.Exists(c => c.SKU == apfSku[0].SKU)) { var apf = (from a in cart.CartItems where a.SKU == apfSku[0].SKU select a).First(); cart.DeleteItemsFromCart( (from a in cart.CartItems where a.SKU == apfSku[0].SKU select a.SKU).ToList(), true); } if (cart.CartItems.Count == 0) //This is now a Standalone APF { SetAPFDeliveryOption(cart); } cart.AddItemsToCart(apfSku, true); if (justEntered) { ruleResult.AddMessage( HttpContext.GetGlobalResourceObject( string.Format("{0}_ErrorMessage", HLConfigManager.Platform), "APFDueAdded") as string); ruleResult.Result = RulesResult.Success; SetApfRuleResponse(ruleResult, ApfAction.None, sku, "ApfRule", TypeOfApf.CantDSRemoveAPF, "APFDueAdded"); cart.RuleResults.Add(ruleResult); } else { foreach (ShoppingCartRuleResult r in cart.RuleResults) { if (r.RuleName == RuleName) { r.Messages.Clear(); r.AddMessage(string.Empty); } } } } } //else //{ // if (APFDueProvider.CanRemoveAPF(distributorID, locale, level)) // { // cart.AddItemsToCart(apfSku, true); // } //} } catch (Exception ex) { LoggerHelper.Error(string.Format("doAPFDue DS:{0} ERR:{1}", distributorID, ex)); } }
/// <summary> /// The IShoppingCart Rule Interface implementation /// </summary> /// <param name="cart">The current Shopping Cart</param> /// <param name="reason">The Rule invoke Reason</param> /// <param name="Result">The Rule Results collection</param> /// <returns>The cumulative rule results - including the results of this iteration</returns> protected override ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart, ShoppingCartRuleReason reason, ShoppingCartRuleResult Result) { if (reason == ShoppingCartRuleReason.CartItemsBeingAdded) { if (cart.CurrentItems == null || cart.CurrentItems.Count == 0) { Result.Result = RulesResult.Failure; return(Result); } CatalogItem_V01 currentItem = CatalogProvider.GetCatalogItem(cart.CurrentItems[0].SKU, Country); List <string> codes = new List <string>(CountryType.TH.HmsCountryCodes); decimal NewVolumePoints = 0m; decimal cartVolume = 0m; TaxIdentification tid = null; string dummyTin = "TH00000000000"; bool isCOPThai = codes.Contains(DistributorProfileModel.ProcessingCountryCode); var tins = DistributorOrderingProfileProvider.GetTinList(cart.DistributorID, true); isDummyTin = tins.Find(t => t.ID == dummyTin) != null; codes.Add(CountryType.TH.Key); tid = tins.Find(t => t.IDType.Key == "THID"); //COP = Thai Tin = No TIN, Can place only L and A items //COP Not Thai, No Tin- Can place L & A item if ((isCOPThai && tid == null) || (!isCOPThai && tid == null && !isDummyTin)) { if (currentItem.ProductType == ProductType.Product) { Result.Result = RulesResult.Failure; Result.AddMessage(HttpContext.GetGlobalResourceObject(string.Format("{0}_Rules", HLConfigManager.Platform), "CantPurchase") as string); cart.RuleResults.Add(Result); } } // marketing plan if (PurchasingLimitProvider.IsRestrictedByMarketingPlan(cart.DistributorID)) { return(base.PerformRules(cart, reason, Result)); } if (isCOPThai) //COP Thai { if (isDummyTin) //have dummyTIN { MyHLShoppingCart myCart = cart as MyHLShoppingCart; if (!string.IsNullOrEmpty(myCart.VolumeInCart.ToString())) { cartVolume = myCart.VolumeInCart; } NewVolumePoints = currentItem.VolumePoints * cart.CurrentItems[0].Quantity; if (cartVolume + NewVolumePoints > MaxVolPoints) { Result.AddMessage(string.Format(HttpContext.GetGlobalResourceObject(string.Format("{0}_Rules", HLConfigManager.Platform), "VolumePointExceeds").ToString(), cart.CurrentItems[0].SKU.ToString())); Result.Result = RulesResult.Failure; cart.RuleResults.Add(Result); } } } else { //COP Not Thai, Tin =Dummy tin Code – Can place any item (P,L, A and Volume limitation is set 1050 VP per order.) if (isDummyTin)//have dummyTIN { MyHLShoppingCart myCart = cart as MyHLShoppingCart; if (!string.IsNullOrEmpty(myCart.VolumeInCart.ToString())) { cartVolume = myCart.VolumeInCart; } NewVolumePoints = currentItem.VolumePoints * cart.CurrentItems[0].Quantity; if (cartVolume + NewVolumePoints > MaxVolPoints) { Result.AddMessage(string.Format(HttpContext.GetGlobalResourceObject(string.Format("{0}_Rules", HLConfigManager.Platform), "VolumePointExceeds").ToString(), cart.CurrentItems[0].SKU.ToString())); Result.Result = RulesResult.Failure; cart.RuleResults.Add(Result); } } } } return(Result); }