private static void AddAllToBasket(HttpContext context) { try { var ajaxInfoList = NBrightBuyUtils.GetAjaxInfoList(context); foreach (var ajaxInfo in ajaxInfoList) { var settings = ajaxInfo.ToDictionary(); if (settings.ContainsKey("productid")) { if (!settings.ContainsKey("portalid")) { settings.Add("portalid", PortalSettings.Current.PortalId.ToString("")); // aways make sure we have portalid in settings } var currentcart = new CartData(Convert.ToInt16(settings["portalid"])); currentcart.AddAjaxItem(ajaxInfo, StoreSettings.Current.SettingsInfo, StoreSettings.Current.DebugMode); currentcart.Save(StoreSettings.Current.DebugMode); } } } catch (Exception ex) { Logging.LogException(ex); } }
private static void RecalculateCart(HttpContext context) { var ajaxInfoList = NBrightBuyUtils.GetAjaxInfoList(context); var currentcart = new CartData(PortalSettings.Current.PortalId); foreach (var ajaxInfo in ajaxInfoList) { currentcart.MergeCartInputData(currentcart.GetItemIndex(ajaxInfo.GetXmlProperty("genxml/hidden/itemcode")), ajaxInfo); } currentcart.Save(StoreSettings.Current.DebugMode, true); }
public String CategoryAdminSaveList(HttpContext context) { var ajaxInfoList = NBrightBuyUtils.GetAjaxInfoList(context); var strOut = ""; var regex = new Regex(@"^[a-z0-9]+$"); var isPropertyList = (context.Request.QueryString.Get("cmd") == "property_admin_savelist"); foreach (var nbi in ajaxInfoList) { // validate property refs if (isPropertyList) { var propertyRef = nbi.GetXmlProperty("genxml/textbox/propertyref"); if (propertyRef != "" && !regex.IsMatch(propertyRef)) { strOut = "Error: Invalid Ref. Only use lower case alpha numeric values. No spaces. " + propertyRef; break; } ; } if (nbi.GetXmlPropertyBool("genxml/hidden/isdirty")) { var categoryData = CategoryUtils.GetCategoryData(nbi.GetXmlPropertyInt("genxml/hidden/itemid"), nbi.GetXmlProperty("genxml/hidden/categorylang")); if (categoryData.Exists) { categoryData.Name = nbi.GetXmlProperty("genxml/textbox/txtcategoryname"); if (categoryData.DataRecord.GetXmlProperty("genxml/textbox/propertyref") == "") { categoryData.DataRecord.SetXmlProperty("genxml/textbox/propertyref", nbi.GetXmlProperty("genxml/textbox/propertyref")); } categoryData.Save(); } } } DataCache.ClearCache(); NBrightBuyUtils.RemoveModCachePortalWide(PortalSettings.Current.PortalId); return(strOut); }
public String CategoryAdminSaveList(HttpContext context) { var ajaxInfoList = NBrightBuyUtils.GetAjaxInfoList(context); foreach (var nbi in ajaxInfoList) { if (nbi.GetXmlPropertyBool("genxml/hidden/isdirty")) { var categoryData = CategoryUtils.GetCategoryData(nbi.GetXmlPropertyInt("genxml/hidden/itemid"), nbi.GetXmlProperty("genxml/hidden/categorylang")); if (categoryData.Exists) { categoryData.Name = nbi.GetXmlProperty("genxml/textbox/txtcategoryname"); if (categoryData.DataRecord.GetXmlProperty("genxml/textbox/propertyref") == "") { categoryData.DataRecord.SetXmlProperty("genxml/textbox/propertyref", nbi.GetXmlProperty("genxml/textbox/propertyref")); } categoryData.Save(); } } } NBrightBuyUtils.RemoveModCachePortalWide(PortalSettings.Current.PortalId); return(""); }