protected void Page_Load(object sender, EventArgs e) { EditedObject = Product; if (ProductID > 0) { DataSet ds = TaxClassInfoProvider.GetSKUTaxClasses(ProductID); if (!DataHelper.DataSourceIsEmpty(ds)) { currentValues = TextHelper.Join(";", DataHelper.GetStringValues(ds.Tables[0], "TaxClassID")); } uniSelector.WhereCondition = GetWhereCondition(); if (!RequestHelper.IsPostBack()) { uniSelector.Value = currentValues; } headTitle.Text = GetString("product_edit_tax.taxtitle"); } // Get category of product OptionCategoryInfo category = OptionCategoryInfoProvider.GetOptionCategoryInfo(Product.SKUOptionCategoryID); // Ensure correct info label for Attribute and Text product option if (category != null) { if (category.CategoryType != OptionCategoryTypeEnum.Products) { headTitle.Text = GetString("product_edit_tax.taxtitleforoption"); } } }
/// <summary> /// On BtnAdd click event. /// </summary> protected void BtnAdd_Click(object sender, EventArgs e) { // Check 'EcommerceModify' permission if (!ECommerceContext.IsUserAuthorizedForPermission("ModifyOrders")) { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifyOrders"); } string allUnits = null; string allSkuId = null; foreach (KeyValuePair <int, TextBox> item in quantityControls) { // Get params int skuId = item.Key; TextBox txtUnits = item.Value; // Get unit count int units = ValidationHelper.GetInteger(txtUnits.Text, 0); if (units > 0) { // Get product and localized name SKUInfo product = SKUInfoProvider.GetSKUInfo(skuId); if (product != null) { string skuName = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(product.SKUName)); // Abort inserting products to the shopping cart ifIf product has some product options if (!DataHelper.DataSourceIsEmpty(OptionCategoryInfoProvider.GetProductOptionCategories(skuId, true))) { // Show error message ShowError(string.Format(GetString("Order_Edit_AddItems.ProductOptionsRequired"), skuName)); return; } // If selected product is a donation if (product.SKUProductType == SKUProductTypeEnum.Donation) { // If donation is customizable if (product.SKUPrivateDonation || !((product.SKUMinPrice == product.SKUPrice) && (product.SKUMaxPrice == product.SKUPrice))) { // Show error message ShowError(string.Format(GetString("order_edit_additems.donationpropertiesrequired"), skuName)); return; } } // Create strings with SKU IDs and units separated by ';' allSkuId += skuId + ";"; allUnits += units + ";"; } } } // Close this modal window and refresh parent values in window CloseWindow(allSkuId, allUnits); }
/// <summary> /// Reload default option selector. /// </summary> protected void ReloadDefaultOptionSelector() { OptionCategoryInfo categObj = OptionCategoryInfoProvider.GetOptionCategoryInfo(categoryId); if (categObj != null) { // Clone option category data OptionCategoryInfo tempCategObj = new OptionCategoryInfo(categObj, false); // Set new selection type from selection control tempCategObj.CategorySelectionType = GetOptionCategoryEnum(drpCategorySelectionType.SelectedValue); // Set previously selected options tempCategObj.CategoryDefaultOptions = productOptionSelector.GetSelectedSKUOptions(); // Set display price option tempCategObj.CategoryDisplayPrice = chkCategoryDisplayPrice.Checked; // Remember selection type in viewstate SelectionType = drpCategorySelectionType.SelectedValue; tempCategObj.CategoryFormControlName = null; // Reload selector productOptionSelector.OptionCategory = tempCategObj; productOptionSelector.ReloadSelector(); } }
/// <summary> /// Creates breadcrumbs. /// </summary> private void CreateBreadcrumbs() { if (IsProductOption) { OptionCategoryInfo categoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(OptionCategoryID); if (categoryInfo != null) { string productListText = GetString("Prodect_Edit_Header.ProductOptionsLink"); string productListUrl = "~/CMSModules/Ecommerce/Pages/Tools/ProductOptions/OptionCategory_Edit_Options.aspx"; productListUrl = URLHelper.AddParameterToUrl(productListUrl, "categoryId", OptionCategoryID.ToString()); productListUrl = URLHelper.AddParameterToUrl(productListUrl, "siteId", SiteID.ToString()); productListUrl = URLHelper.AddParameterToUrl(productListUrl, "productId", ParentProductID.ToString()); productListUrl = URLHelper.AddParameterToUrl(productListUrl, "dialog", QueryHelper.GetString("dialog", "0")); // Set breadcrumb PageBreadcrumbs.AddBreadcrumb(new BreadcrumbItem { Text = productListText, Target = (categoryInfo.CategoryType == OptionCategoryTypeEnum.Products) ? "_parent" : null, RedirectUrl = ResolveUrl(productListUrl) }); PageBreadcrumbs.AddBreadcrumb(new BreadcrumbItem { Text = FormatBreadcrumbObjectName(SKU.SKUName, SiteID) }); } } else { // Ensure correct suffix UIHelper.SetBreadcrumbsSuffix(GetString("objecttype.com_sku")); } }
/// <summary> /// Reload data for UniSelector. /// </summary> /// <param name="forceReload">Force Reload Option</param> private void ReloadUniSelectorData(bool forceReload) { if (ProductID > 0) { currentValues = string.Empty; // Get categories assigned to product DataSet ds = OptionCategoryInfoProvider.GetProductOptionCategories(ProductID, false); if (!DataHelper.DataSourceIsEmpty(ds)) { currentValues = TextHelper.Join(";", DataHelper.GetStringValues(ds.Tables[0], "CategoryID")); } uniSelector.WhereCondition = GetWhereCondition(); if (forceReload || !RequestHelper.IsPostBack()) { uniSelector.Value = currentValues; } if (forceReload) { uniSelector.Reload(true); } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); // Get option category ID from url optionCategoryId = QueryHelper.GetInteger("categoryid", 0); newObjSiteId = ConfiguredSiteID; // Creating new product option if (optionCategoryId > 0) { GlobalObjectsKeyName = ECommerceSettings.ALLOW_GLOBAL_PRODUCT_OPTIONS; OptionCategoryInfo oci = OptionCategoryInfoProvider.GetOptionCategoryInfo(optionCategoryId); // Check edited object EditedObject = oci; // New product option wil be bound to same site as option category if (oci != null) { // Check edited site id CheckEditedObjectSiteID(oci.CategorySiteID); newObjSiteId = oci.CategorySiteID; } } // Creating new product else { GlobalObjectsKeyName = ECommerceSettings.ALLOW_GLOBAL_PRODUCTS; } }
/// <summary> /// Handle display price selection made. /// </summary> protected void chkCategoryDisplayPrice_CheckedChanged(object sender, EventArgs e) { OptionCategoryInfo categObj = OptionCategoryInfoProvider.GetOptionCategoryInfo(categoryID); if (categObj != null) { // Clone option category data OptionCategoryInfo tempCategObj = new OptionCategoryInfo(categObj, false); // Set new selection type from selection control tempCategObj.CategorySelectionType = GetOptionCategoryEnum(drpCategorySelectionType.SelectedValue); // Set previously selected options tempCategObj.CategoryDefaultOptions = productOptionSelector.GetSelectedSKUOptions(); // Set display price option tempCategObj.CategoryDisplayPrice = this.chkCategoryDisplayPrice.Checked; // Remember selection type in viewstate this.SelectionType = drpCategorySelectionType.SelectedValue; // Reload selector productOptionSelector.OptionCategory = tempCategObj; productOptionSelector.ReloadSelector(); } }
protected void Page_Load(object sender, EventArgs e) { // Setup help object options = new { helpName = "lnkProductEditHelp", helpUrl = UIContextHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK) }; ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options); //No need to check changes DocumentManager.RegisterSaveChangesScript = false; // Check UI personalization for product / product option separately if (OptionCategoryID > 0) { // Check elements in product options categories subtree CheckUIElementAccessHierarchical("CMS.Ecommerce", "ProductOptions.Options.TaxClasses"); } else { CheckUIElementAccessHierarchical("CMS.Ecommerce", "Products.TaxClasses"); } if (ProductID > 0) { sku = SKUInfoProvider.GetSKUInfo(ProductID); EditedObject = sku; if (sku != null) { // Check products site id CheckEditedObjectSiteID(sku.SKUSiteID); taxForm.ProductID = ProductID; taxForm.UniSelector.OnSelectionChanged += UniSelector_OnSelectionChanged; if (sku.IsProductOption) { var categoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(sku.SKUOptionCategoryID); if (categoryInfo != null) { CreateBreadcrumbs(sku); if (categoryInfo.CategoryType != OptionCategoryTypeEnum.Products) { ShowError(GetString("com.taxesNotSupportedForOptionType")); taxForm.Visible = false; } } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Ecommerce", "ProductOptions.Options")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Ecommerce", "ProductOptions.Options"); } // Get category ID and department ID from url categoryId = QueryHelper.GetInteger("categoryid", 0); categoryObj = OptionCategoryInfoProvider.GetOptionCategoryInfo(categoryId); EditedObject = categoryObj; if (categoryObj != null) { editedSiteId = categoryObj.CategorySiteID; // Check edited objects site id CheckEditedObjectSiteID(editedSiteId); // Allow actions only for non-text categories allowActions = (categoryObj.CategorySelectionType != OptionCategorySelectionTypeEnum.TextBox) && (categoryObj.CategorySelectionType != OptionCategorySelectionTypeEnum.TextArea); if (allowActions) { string[,] actions = new string[2, 7]; // New item link actions[0, 0] = HeaderActions.TYPE_HYPERLINK; actions[0, 1] = GetString("ProductOptions.NewItemCaption"); actions[0, 2] = null; actions[0, 3] = ResolveUrl("~/CMSModules/Ecommerce/Pages/Tools/Products/Product_New.aspx?categoryid=" + categoryId + "&siteId=" + SiteID); actions[0, 4] = null; actions[0, 5] = GetImageUrl("Objects/Ecommerce_SKU/add.png"); // Sort link & img actions[1, 0] = HeaderActions.TYPE_LINKBUTTON; actions[1, 1] = GetString("ProductOptions.SortAlphabetically"); actions[1, 2] = null; actions[1, 3] = null; actions[1, 4] = null; actions[1, 5] = GetImageUrl("CMSModules/CMS_Ecommerce/optionssort.png"); actions[1, 6] = "lnkSort_Click"; this.CurrentMaster.HeaderActions.Actions = actions; this.CurrentMaster.HeaderActions.ActionPerformed += new CommandEventHandler(HeaderActions_ActionPerformed); } // Unigrid grid.OnAction += new OnActionEventHandler(grid_OnAction); grid.OnExternalDataBound += new OnExternalDataBoundEventHandler(grid_OnExternalDataBound); grid.WhereCondition = "SKUOptionCategoryID = " + categoryId; } }
/// <summary> /// Checks if user is able to generate variants. Returns warning message if validation failed, empty string if it passed. /// </summary> private string VariantsCanBeGenerated() { // Inform user about need to change product type to be able to generate variants, it is allowed only for a standard product if (Product.SKUProductType != SKUProductTypeEnum.Product) { return(String.Format(GetString("com.variant.notstandardproduct"), GetString("com.producttype.product"))); } // Data set with option categories assigned to the product DataSet optionCategories = OptionCategoryInfoProvider.GetProductOptionCategories(ProductID, true, OptionCategoryTypeEnum.Attribute); // List of assigned Category IDs IList <int> categoryIDs = DataHelper.GetIntegerValues(optionCategories.Tables[0], "CategoryID"); // Inform that attribute option category does not exist for this product if (DataHelper.DataSourceIsEmpty(optionCategories)) { return(GetString("com.variant.nooptioncategorycreated")); } bool variantsCannotBeGenerated = true; foreach (int categoryId in categoryIDs) { var enabledAllowedOptions = SKUInfoProvider.GetSKUOptionsForProduct(Product.SKUID, categoryId, true).TopN(1); if (!DataHelper.DataSourceIsEmpty(enabledAllowedOptions)) { variantsCannotBeGenerated = false; break; } } // Inform that any option is selected,created or enabled in assigned option category if (variantsCannotBeGenerated) { return(GetString("com.variant.nooptionselectedforproduct")); } var bundles = SKUInfoProvider.GetSKUs() .Column("SKUName") .WhereIn("SKUID", BundleInfoProvider.GetBundles() .Column("BundleID") .WhereEquals("SKUID", Product.SKUID) ) .GetListResult <string>(); if (bundles.Count > 0) { return(String.Format(GetString("com.variant.productusedinbundle"), HTMLHelper.HTMLEncode(ResHelper.LocalizeString(string.Join(", ", bundles))))); } return(""); }
protected void btnAddOneUnit_Click(object sender, EventArgs e) { // Get SKU ID int skuId = ValidationHelper.GetInteger(((LinkButton)sender).CommandArgument, 0); // Get product SKUInfo skui = SKUInfoProvider.GetSKUInfo(skuId); bool hasProductOptions = !DataHelper.DataSourceIsEmpty(OptionCategoryInfoProvider.GetSKUOptionCategories(skuId, true)); bool isCustomizableDonation = ((skui != null) && (skui.SKUProductType == SKUProductTypeEnum.Donation)) && (skui.SKUPrivateDonation || !((skui.SKUMinPrice == skui.SKUPrice) && (skui.SKUMaxPrice == skui.SKUPrice))); // If product has product options or product is a customizable donation // -> abort inserting products to the shopping cart if (hasProductOptions || isCustomizableDonation) { // Hide products this.plcProducts.Visible = false; // Set title message per specific case if (hasProductOptions && isCustomizableDonation) { this.lblTitle.ResourceString = "order_edit_additems.donationpropertiesproductoptions"; } else if (hasProductOptions) { this.lblTitle.ResourceString = "order_edit_additems.productoptions"; } else if (isCustomizableDonation) { this.lblTitle.ResourceString = "order_edit_additems.donationproperties"; } // Save SKU ID to the viewstate this.SKUID = skuId; // Initialize shopping cart item selector this.cartItemSelector.SKUID = this.SKUID; this.cartItemSelector.ShowProductOptions = hasProductOptions; this.cartItemSelector.ShowDonationProperties = isCustomizableDonation; this.cartItemSelector.ReloadData(); // Show shopping cart item selector this.plcSelector.Visible = true; } else { // Add product to shopping cart and close dialog window ScriptHelper.RegisterClientScriptBlock(this.Page, typeof(string), "addproduct", ScriptHelper.GetScript("AddProducts(" + skuId + ", 1);")); } }
protected void Page_Load(object sender, EventArgs e) { // Get category ID and department ID from URL categoryId = QueryHelper.GetInteger("categoryid", 0); categoryObj = OptionCategoryInfoProvider.GetOptionCategoryInfo(categoryId); EditedObject = categoryObj; if (categoryObj != null) { editedSiteId = categoryObj.CategorySiteID; // Check edited objects site id CheckEditedObjectSiteID(editedSiteId); // Allow actions only for non-text categories allowActions = (categoryObj.CategorySelectionType != OptionCategorySelectionTypeEnum.TextBox) && (categoryObj.CategorySelectionType != OptionCategorySelectionTypeEnum.TextArea); grid.ShowObjectMenu = allowActions; if (allowActions) { HeaderActions hdrActions = CurrentMaster.HeaderActions; // New option action hdrActions.ActionsList.Add(new HeaderAction() { ControlType = HeaderActionTypeEnum.Hyperlink, Text = GetString("ProductOptions.NewItemCaption"), RedirectUrl = ResolveUrl("~/CMSModules/Ecommerce/Pages/Tools/Products/Product_New.aspx?categoryid=" + categoryId + "&siteId=" + SiteID), ImageUrl = GetImageUrl("Objects/Ecommerce_SKU/add.png") }); // Sort action hdrActions.ActionsList.Add(new HeaderAction() { ControlType = HeaderActionTypeEnum.LinkButton, Text = GetString("ProductOptions.SortAlphabetically"), ImageUrl = GetImageUrl("CMSModules/CMS_Ecommerce/optionssort.png"), CommandName = "lnkSort_Click" }); hdrActions.ActionPerformed += HeaderActions_ActionPerformed; } // Unigrid grid.OnAction += grid_OnAction; grid.OnExternalDataBound += grid_OnExternalDataBound; grid.WhereCondition = "SKUOptionCategoryID = " + categoryId; } }
protected void Page_Load(object sender, EventArgs e) { // Get parent product from url int parentProductId = QueryHelper.GetInteger("productId", 0); // Check UI permissions if (parentProductId <= 0) { // UIElement from option category list CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "ProductOptions.Products"); } else { // UIElement from product edit CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, "Products.ProductOptions.Products"); } categoryId = QueryHelper.GetInteger("categoryId", 0); categoryObj = OptionCategoryInfoProvider.GetOptionCategoryInfo(categoryId); EditedObject = categoryObj; if (categoryObj != null) { editedSiteId = categoryObj.CategorySiteID; // Check edited objects site id CheckEditedObjectSiteID(editedSiteId); // Offer global products when allowed if (editedSiteId != 0) { offerGlobalProducts = ECommerceSettings.AllowGlobalProducts(editedSiteId); } // Configuring global products else { offerGlobalProducts = ECommerceSettings.AllowGlobalProducts(CurrentSiteName); } PreloadUniSelector(false); uniSelector.WhereCondition = GetWhereCondition(); // If option category is disabled, hide ADD button if (categoryObj.CategoryEnabled == false) { uniSelector.ButtonAddItems.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { bool hideBreadcrumbs = QueryHelper.GetBoolean("hidebreadcrumbs", false); // Get option category ID from querystring categoryId = QueryHelper.GetInteger("categoryID", 0); CMSMasterPage master = (CMSMasterPage)this.CurrentMaster; // Get localized option category name string categName = ""; OptionCategoryInfo categObj = OptionCategoryInfoProvider.GetOptionCategoryInfo(categoryId); if (categObj != null) { categName = ResHelper.LocalizeString(categObj.CategoryDisplayName); editedSiteId = categObj.CategorySiteID; // Check if edited object belongs to configured site CheckEditedObjectSiteID(editedSiteId); } if (!hideBreadcrumbs) { // Initializes page title control string[,] breadcrumbs = new string[2, 3]; breadcrumbs[0, 0] = GetString("optioncategory_edit.itemlistlink"); breadcrumbs[0, 1] = "~/CMSModules/Ecommerce/Pages/Tools/ProductOptions/OptionCategory_List.aspx?siteId=" + SiteID; breadcrumbs[0, 2] = "ecommerceContent"; breadcrumbs[1, 0] = FormatBreadcrumbObjectName(categName, editedSiteId); breadcrumbs[1, 1] = ""; breadcrumbs[1, 2] = ""; this.CurrentMaster.Title.Breadcrumbs = breadcrumbs; } master.Title.HelpTopicName = "edit_option_category___general"; master.Title.HelpName = "helpTopic"; master.Tabs.ModuleName = "CMS.Ecommerce"; master.Tabs.ElementName = "ProductOptions"; master.Tabs.UrlTarget = "OptionCategoryEdit"; master.Tabs.OnTabCreated += new UITabs.TabCreatedEventHandler(Tabs_OnTabCreated); master.Tabs.OpenTabContentAfterLoad = false; // Set master title master.Title.TitleText = GetString("com.optioncategory.edit"); master.Title.TitleImage = GetImageUrl("Objects/Ecommerce_OptionCategory/object.png"); }
/// <summary> /// Gets the categories with names from external data source or database. /// </summary> /// <param name="skuIdOfProductWithCategories">Id of product with categories.</param> private Dictionary <int, string> GetCategoriesWithNames(int skuIdOfProductWithCategories) { Dictionary <int, string> categoriesWithName = new Dictionary <int, string>(); if ((ExternalDataSource != null) && (ExternalDataSource.Count > 0)) { // External data foreach (OptionCategoryInfo info in ExternalDataSource.Keys) { // Use category live site display name in case it is available, otherwise category display name categoriesWithName.Add(info.CategoryID, info.CategoryTitle); } return(categoriesWithName); } // Load data from DB DataSet dsOptionCategories; // If ShowOnlyUsedCategories is true, dataset will contain only already used categories in variants if (ShowOnlyUsedCategories) { dsOptionCategories = VariantHelper.GetProductVariantsCategories(skuIdOfProductWithCategories); } else { dsOptionCategories = OptionCategoryInfoProvider.GetProductOptionCategories(skuIdOfProductWithCategories, true, OptionCategoryTypeEnum.Attribute); } if (DataHelper.DataSourceIsEmpty(dsOptionCategories)) { return(categoriesWithName); } foreach (DataRow catDr in dsOptionCategories.Tables[0].Rows) { int categoryId = ValidationHelper.GetInteger(catDr["CategoryID"], 0); string categoryName = ValidationHelper.GetString(catDr["CategoryLiveSiteDisplayName"], String.Empty); if (string.IsNullOrEmpty(categoryName)) { categoryName = ValidationHelper.GetString(catDr["CategoryDisplayName"], String.Empty); } categoriesWithName.Add(categoryId, categoryName); } return(categoriesWithName); }
private void btnAddOneUnit_Click(object sender, EventArgs e) { // Get SKU ID int skuId = ValidationHelper.GetInteger(((LinkButton)sender).CommandArgument, 0); // Get product SKUInfo product = SKUInfoProvider.GetSKUInfo(skuId); bool hasProductOptions = !DataHelper.DataSourceIsEmpty(OptionCategoryInfoProvider.GetProductOptionCategories(skuId, true)); bool isCustomizableDonation = ((product != null) && (product.SKUProductType == SKUProductTypeEnum.Donation)) && (product.SKUPrivateDonation || !((product.SKUMinPrice == product.SKUPrice) && (product.SKUMaxPrice == product.SKUPrice)) || (product.SKUPrice == 0.0)); // If product has product options or product is a customizable donation // -> abort inserting products to the shopping cart if (hasProductOptions || isCustomizableDonation) { // Set title message per specific case if (hasProductOptions && isCustomizableDonation) { lblTitle.ResourceString = "order_edit_additems.donationpropertiesproductoptions"; } else if (hasProductOptions) { lblTitle.ResourceString = "order_edit_additems.productoptions"; } else { lblTitle.ResourceString = "order_edit_additems.donationproperties"; } // Save SKU ID to the viewstate SKUID = skuId; // Initialize shopping cart item selector cartItemSelector.SKUID = SKUID; cartItemSelector.ShowProductOptions = hasProductOptions; cartItemSelector.ShowDonationProperties = isCustomizableDonation; cartItemSelector.ReloadData(); SwitchToOptions(); } else { // Add product to shopping cart and close dialog window ScriptHelper.RegisterStartupScript(Page, typeof(string), "addproduct", ScriptHelper.GetScript("AddProducts(" + skuId + ", 1);")); } }
/// <summary> /// Handles <see cref="CMSModalPage.Save"/> event. /// </summary> private void OnSave(object sender, EventArgs e) { // Check 'EcommerceModify' permission if (!ECommerceContext.IsUserAuthorizedForPermission(EcommercePermissions.ORDERS_MODIFY)) { RedirectToAccessDenied(ModuleName.ECOMMERCE, "EcommerceModify OR ModifyOrders"); } string allUnits = null; string allSkuId = null; foreach (KeyValuePair <int, TextBox> item in quantityControls) { // Get params int skuId = item.Key; TextBox txtUnits = item.Value; // Get unit count int units = ValidationHelper.GetInteger(txtUnits.Text, 0); if (units > 0) { // Get product and localized name SKUInfo product = SKUInfo.Provider.Get(skuId); if (product != null) { string skuName = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(product.SKUName)); // Abort inserting products to the shopping cart ifIf product has some product options if (!DataHelper.DataSourceIsEmpty(OptionCategoryInfoProvider.GetProductOptionCategories(skuId, true))) { // Show error message ShowError(string.Format(GetString("Order_Edit_AddItems.ProductOptionsRequired"), skuName)); return; } // Create strings with SKU IDs and units separated by ';' allSkuId += skuId + ";"; allUnits += units + ";"; } } } // Close this modal window and refresh parent values in window CloseWindow(allSkuId, allUnits); }
protected object productsUniGridElem_OnExternalDataBound(object sender, string sourceName, object parameter) { var row = (DataRowView)parameter; switch (sourceName.ToLowerInvariant()) { case "skuprice": // Get information needed to format SKU price var value = ValidationHelper.GetDecimal(row["SKUPrice"], 0); int siteId = ValidationHelper.GetInteger(row["SKUSiteID"], 0); // Return formatted SKU price return(CurrencyInfoProvider.GetFormattedPrice(value, siteId)); case "skuvalidity": // Get information needed to format SKU validity ValidityEnum validity = DateTimeHelper.GetValidityEnum(ValidationHelper.GetString(row["SKUValidity"], null)); int validFor = ValidationHelper.GetInteger(row["SKUValidFor"], 0); DateTime validUntil = ValidationHelper.GetDateTime(row["SKUValidUntil"], DateTimeHelper.ZERO_TIME); // Return formatted SKU validity return(DateTimeHelper.GetFormattedValidity(validity, validFor, validUntil)); case "skuisproductoption": var skuInfo = SKUInfoProvider.GetSKUInfo(ValidationHelper.GetInteger(row["SKUID"], 0)); if (skuInfo != null && skuInfo.IsProductOption) { return(ResHelper.GetString("general.yes")); } return(ResHelper.GetString("general.no")); case "skuproductoptioncategoryname": var resultCategoryName = ""; var optionCategoryID = ValidationHelper.GetInteger(row["SKUOptionCategoryID"], 0); var optionCategory = OptionCategoryInfoProvider.GetOptionCategoryInfo(optionCategoryID); if (optionCategory != null) { resultCategoryName = optionCategory.CategoryDisplayName; } return(resultCategoryName); } return(null); }
/// <summary> /// Redirects to the edit page of the saved product. /// </summary> private void RedirectToSavedProduct(BaseInfo product) { string url = ProductUIHelper.GetProductEditUrl(); // Creating product options of type other than products is redirected directly to form if (OptionCategoryID > 0) { var categoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(OptionCategoryID); if (categoryInfo != null) { url = "Product_Edit_General.aspx"; if (categoryInfo.CategoryType == OptionCategoryTypeEnum.Products) { url = UIContextHelper.GetElementUrl("cms.ecommerce", "ProductOptions.Options.Edit", false); } } } url = URLHelper.AddParameterToUrl(url, "siteId", SiteID.ToString()); url = URLHelper.AddParameterToUrl(url, "categoryId", OptionCategoryID.ToString()); url = URLHelper.AddParameterToUrl(url, "objectid", OptionCategoryID.ToString()); if (product is TreeNode) { int nodeId = product.GetIntegerValue("NodeID", 0); url = URLHelper.AddParameterToUrl(url, "nodeId", nodeId.ToString()); } else if (product is SKUInfo) { int skuId = product.GetIntegerValue("SKUID", 0); url = URLHelper.AddParameterToUrl(url, "productId", skuId.ToString()); // Select general tab if stan-alone SKU is saved if (OptionCategoryID == 0) { url = URLHelper.AddParameterToUrl(url, "tabName", "Products.General"); } } url = URLHelper.AddParameterToUrl(url, "saved", "1"); URLHelper.Redirect(url); }
protected void Page_Load(object sender, EventArgs e) { // SKU option category info to select options from optionSKUCategoryInfo = SKUOptionCategoryInfoProvider.GetSKUOptionCategoryInfo(CategoryID, ProductID); // Redirect user if edited option category for this product does not exist if (optionSKUCategoryInfo == null) { EditedObject = null; } else { // Set title and help var optionCategoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(optionSKUCategoryInfo.CategoryID); var categoryFullName = optionCategoryInfo.CategoryFullName; string titleText = string.Format(GetString("com.optioncategory.select"), HTMLHelper.HTMLEncode(categoryFullName)); SetTitle(titleText); } // Register event handlers rbAllowAllOption.SelectedIndexChanged += rbAllowAllOption_SelectedIndexChanged; ugOptions.OnExternalDataBound += ugOptions_OnExternalDataBound; ugOptions.OnBeforeDataReload += ugOptions_OnBeforeDataReload; Save += btnOk_Click; // Initialize value of controls if (!RequestHelper.IsPostBack()) { rbAllowAllOption.SelectedValue = optionSKUCategoryInfo.AllowAllOptions ? ALLOW_ALL : SELECTED_ONLY; ugOptions.SelectedItems = SelectedOptionsIds; } // Hide selection if all options are allowed ugOptions.GridOptions.ShowSelection = rbAllowAllOption.SelectedValue != ALLOW_ALL; // Display only options for particular category ugOptions.WhereCondition = "SKUOptionCategoryID=" + CategoryID; // Navigate user if there is nothing to select from ugOptions.ZeroRowsText = GetString("com.selectableoptions.nodata"); }
/// <summary> /// Redirects to the edit page of the saved product. /// </summary> private void RedirectToSavedProduct(BaseInfo product) { string url = ProductUIHelper.GetProductEditUrl(); if (OptionCategoryID > 0) { var categoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(OptionCategoryID); if (categoryInfo != null) { url = UIContextHelper.GetElementUrl(ModuleName.ECOMMERCE, "ProductOptions.Options.General", false); } } var categoryID = OptionCategoryID.ToString(); url = URLHelper.AddParameterToUrl(url, "siteId", SiteID.ToString()); url = URLHelper.AddParameterToUrl(url, "categoryId", categoryID); url = URLHelper.AddParameterToUrl(url, "parentobjectid", categoryID); if (product is TreeNode) { int nodeId = product.GetIntegerValue("NodeID", 0); url = URLHelper.AddParameterToUrl(url, "nodeId", nodeId.ToString()); } else if (product is SKUInfo) { var skuId = product.GetIntegerValue("SKUID", 0).ToString(); url = URLHelper.AddParameterToUrl(url, "productId", skuId); url = URLHelper.AddParameterToUrl(url, "objectid", skuId); // Select general tab if stan-alone SKU is saved if (OptionCategoryID == 0) { url = URLHelper.AddParameterToUrl(url, "tabName", "Products.General"); } } url = URLHelper.AddParameterToUrl(url, "saved", "1"); URLHelper.Redirect(UrlResolver.ResolveUrl(url)); }
protected void Page_Load(object sender, EventArgs e) { lblAvailable.Text = GetString("com.sku.categoriesavailable"); if (ProductID > 0) { // Get the active users DataSet ds = OptionCategoryInfoProvider.GetSKUOptionCategories(ProductID, false); if (!DataHelper.DataSourceIsEmpty(ds)) { currentValues = TextHelper.Join(";", SqlHelperClass.GetStringValues(ds.Tables[0], "CategoryID")); } this.uniSelector.WhereCondition = GetWhereCondition(currentValues); if (!RequestHelper.IsPostBack()) { this.uniSelector.Value = currentValues; } } this.uniSelector.IconPath = GetObjectIconUrl("ecommerce.optioncategory", "object.png"); }
/// <summary> /// Handles the OptionCategoryGrid's OnAction event. /// </summary> /// <param name="actionName">Name of item (button) that throws event</param> /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param> protected void OptionCategoryGrid_OnAction(string actionName, object actionArgument) { int categoryId = ValidationHelper.GetInteger(actionArgument, 0); // Set actions if (actionName == "edit") { URLHelper.Redirect("OptionCategory_Edit.aspx?CategoryID=" + categoryId + "&siteId=" + SelectSite.SiteID); } else if (actionName == "delete") { OptionCategoryInfo categoryObj = OptionCategoryInfoProvider.GetOptionCategoryInfo(categoryId); if (!ECommerceContext.IsUserAuthorizedToModifyOptionCategory(categoryObj)) { // Check module permissions if (categoryObj.CategoryIsGlobal) { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceGlobalModify"); } else { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifyProducts"); } } // Check dependencies if (OptionCategoryInfoProvider.CheckDependencies(categoryId)) { // Show error message ShowError(GetString("Ecommerce.DeleteDisabled")); return; } // Delete option category from database OptionCategoryInfoProvider.DeleteOptionCategoryInfo(categoryObj); } }
protected void Page_Load(object sender, EventArgs e) { bool hideBreadcrumbs = QueryHelper.GetBoolean("hidebreadcrumbs", false); // Get option category ID from querystring categoryId = QueryHelper.GetInteger("categoryID", 0); CMSMasterPage master = (CMSMasterPage)CurrentMaster; // Get localized option category name string categName = ""; OptionCategoryInfo categObj = OptionCategoryInfoProvider.GetOptionCategoryInfo(categoryId); if (categObj != null) { categName = ResHelper.LocalizeString(categObj.CategoryDisplayName); editedSiteId = categObj.CategorySiteID; // Check if edited object belongs to configured site CheckEditedObjectSiteID(editedSiteId); } if (!hideBreadcrumbs) { // Initializes page title control string[,] breadcrumbs = new string[2, 3]; breadcrumbs[0, 0] = GetString("optioncategory_edit.itemlistlink"); breadcrumbs[0, 1] = "~/CMSModules/Ecommerce/Pages/Tools/ProductOptions/OptionCategory_List.aspx?siteId=" + SiteID; breadcrumbs[0, 2] = "ecommerceContent"; breadcrumbs[1, 0] = FormatBreadcrumbObjectName(categName, editedSiteId); breadcrumbs[1, 1] = ""; breadcrumbs[1, 2] = ""; CurrentMaster.Title.Breadcrumbs = breadcrumbs; } master.Tabs.OnTabCreated += Tabs_OnTabCreated; master.Tabs.OpenTabContentAfterLoad = false; }
/// <summary> /// Ensures the options text to display. /// </summary> protected virtual void EnsureOptionString() { if (ShoppingCartItemInfoObject != null) { List <string> optionNames = new List <string>(); foreach (ShoppingCartItemInfo optionItem in ShoppingCartItemInfoObject.ProductOptions) { // Ignore bundle items if (optionItem.IsBundleItem) { continue; } string itemText = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(optionItem.CartItemText)); if (!string.IsNullOrEmpty(itemText)) { itemText = string.Format(" '{0}'", itemText); } else { OptionCategoryInfo category = OptionCategoryInfoProvider.GetOptionCategoryInfo(optionItem.SKU.SKUOptionCategoryID); // Exclude Text options without specified text if ((category != null) && (category.CategoryType == OptionCategoryTypeEnum.Text)) { continue; } } optionNames.Add(HTMLHelper.HTMLEncode(ResHelper.LocalizeString(optionItem.SKU.SKUName)) + itemText); } lblOptions.Text = TextHelper.Join(TextSeparator, optionNames) ?? string.Empty; } }
private object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter) { DataRowView row = parameter as DataRowView; switch (sourceName.ToLowerCSafe()) { case "optioncategory": int optionCategoryId = ValidationHelper.GetInteger(row["SKUOptionCategoryID"], 0); OptionCategoryInfo optionCategory = OptionCategoryInfoProvider.GetOptionCategoryInfo(optionCategoryId); // Return option category display name for product option or '-' for product if (optionCategory != null) { return(HTMLHelper.HTMLEncode(optionCategory.CategoryDisplayName ?? "")); } return("-"); case "skunumber": string skuNumber = ValidationHelper.GetString(row["SKUNumber"], null); return(HTMLHelper.HTMLEncode(skuNumber ?? "")); case "skuprice": double value = ValidationHelper.GetDouble(row["SKUPrice"], 0); int siteId = ValidationHelper.GetInteger(row["SKUSiteID"], 0); // Format price return(CurrencyInfoProvider.GetFormattedPrice(value, siteId)); case "skudepartmentid": // Tranform to display name and localize int departmentId = ValidationHelper.GetInteger(row["SKUDepartmentID"], 0); DepartmentInfo department = DepartmentInfoProvider.GetDepartmentInfo(departmentId); return((department != null) ? HTMLHelper.HTMLEncode(ResHelper.LocalizeString(department.DepartmentDisplayName)) : ""); case "skumanufacturerid": // Tranform to display name and localize int manufacturerId = ValidationHelper.GetInteger(row["SKUManufacturerID"], 0); ManufacturerInfo manufacturer = ManufacturerInfoProvider.GetManufacturerInfo(manufacturerId); return((manufacturer != null) ? HTMLHelper.HTMLEncode(ResHelper.LocalizeString(manufacturer.ManufacturerDisplayName)) : ""); case "skusupplierid": // Tranform to display name and localize int supplierId = ValidationHelper.GetInteger(row["SKUSupplierID"], 0); SupplierInfo supplier = SupplierInfoProvider.GetSupplierInfo(supplierId); return((supplier != null) ? HTMLHelper.HTMLEncode(ResHelper.LocalizeString(supplier.SupplierDisplayName)) : ""); case "skuavailableitems": int?count = row["SKUAvailableItems"] as int?; int?reorderAt = row["SKUReorderAt"] as int?; // Emphasise the number when product needs to be reordered if (count.HasValue && ((reorderAt.HasValue && (count <= reorderAt)) || (!reorderAt.HasValue && (count <= 0)))) { // Format message informing about insufficient stock level string reorderMsg = string.Format(GetString("com.sku.reorderatTooltip"), reorderAt); return(string.Format("<span class=\"OperationFailed\">{0}</span>", count)); } return(count); case "itemstobereordered": int skuReorderAt = ValidationHelper.GetInteger(row["SKUReorderAt"], 0); int skuAvailableItems = ValidationHelper.GetInteger(row["SKUAvailableItems"], 0); int difference = skuReorderAt - skuAvailableItems; // Return difference, or '-' return((difference > 0) ? difference.ToString() : "-"); case "skusiteid": return(UniGridFunctions.ColoredSpanYesNo(row["SKUSiteID"] == DBNull.Value)); } return(parameter); }
protected void Page_Load(object sender, EventArgs e) { // Get parent product from url parentProductId = QueryHelper.GetInteger("productId", 0); // Check UI permissions var elementName = parentProductId <= 0 ? "ProductOptions.Options" : "Products.ProductOptions.Options"; CheckUIElementAccessHierarchical(ModuleName.ECOMMERCE, elementName); // Hide/rename columns before loading data ugOptions.OnBeforeDataReload += grid_OnBeforeDataReload; // Get category ID and department ID from URL categoryId = QueryHelper.GetInteger("categoryid", 0); categoryObj = OptionCategoryInfoProvider.GetOptionCategoryInfo(categoryId); EditedObject = categoryObj; if (categoryObj != null) { editedSiteId = categoryObj.CategorySiteID; // Check edited objects site id CheckEditedObjectSiteID(editedSiteId); // Allow actions only for non-text categories allowActions = (categoryObj.CategorySelectionType != OptionCategorySelectionTypeEnum.TextBox) && (categoryObj.CategorySelectionType != OptionCategorySelectionTypeEnum.TextArea); ugOptions.ShowObjectMenu = allowActions; if (allowActions) { var hdrActions = CurrentMaster.HeaderActions; var stringName = categoryObj.CategoryType == OptionCategoryTypeEnum.Products ? "com.sku.newproduct" : "com.productoptions.newoption"; var newButtonText = GetString(stringName); // New option action hdrActions.ActionsList.Add(new HeaderAction { Text = newButtonText, RedirectUrl = ResolveUrl("~/CMSModules/Ecommerce/Pages/Tools/Products/Product_New.aspx?categoryid=" + categoryId + "&siteId=" + SiteID + (parentProductId > 0 ? "&parentProductId=" + parentProductId : "")) }); // Sort action hdrActions.ActionsList.Add(new HeaderAction { Text = GetString("ProductOptions.SortAlphabetically"), OnClientClick = "return confirm(" + ScriptHelper.GetLocalizedString("com.productoptions.sortalphaasc") + ");", CommandName = "lnkSort_Click", ButtonStyle = ButtonStyle.Default }); hdrActions.ActionPerformed += HeaderActions_ActionPerformed; } // Unigrid ugOptions.OnAction += grid_OnAction; ugOptions.OnExternalDataBound += grid_OnExternalDataBound; ugOptions.WhereCondition = "SKUOptionCategoryID = " + categoryId; ugOptions.GridView.AllowSorting = false; } }
/// <summary> /// Loads control. /// </summary> private void LoadControl() { // Get all product categories with options which are already in variants if (VariantCategoriesOptions.Count == 0) { DataSet variantCategoriesDS = VariantHelper.GetProductVariantsCategories(ProductID); FillCategoriesOptionsDictionary(VariantCategoriesOptions, variantCategoriesDS); } // Get all product attribute categories with options if (AllCategoriesOptions.Count == 0) { DataSet allCategoriesDS = OptionCategoryInfoProvider.GetProductOptionCategories(ProductID, true, OptionCategoryTypeEnum.Attribute); FillCategoriesOptionsDictionary(AllCategoriesOptions, allCategoriesDS); } foreach (KeyValuePair <OptionCategoryInfo, List <SKUInfo> > keyValuePair in AllCategoriesOptions) { if (keyValuePair.Value.Count > 0) { OptionCategoryInfo optionCategory = keyValuePair.Key; // Create new instance of CheckBoxWithDropDown control and prefill all necessary values CheckBoxWithDropDown checkBoxWithDropDown = new CheckBoxWithDropDown(); checkBoxWithDropDown.ID = ValidationHelper.GetString(optionCategory.CategoryID, string.Empty); checkBoxWithDropDown.Value = optionCategory.CategoryID; // Use live site display name instead of category display name in case it is available checkBoxWithDropDown.CheckboxText = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(optionCategory.CategoryTitle)); // Attach listeners checkBoxWithDropDown.OnCheckBoxSelectionChanged += checkBoxWithDropDown_OnCheckBoxSelectionChanged; checkBoxWithDropDown.OnDropDownSelectionChanged += checkBoxWithDropDown_OnDropDownSelectionChanged; // Option category is in variants too if (VariantCategoriesOptions.Keys.Any(c => ValidationHelper.GetInteger(c["categoryId"], 0) == optionCategory.CategoryID)) { // Check and disable checkbox checkBoxWithDropDown.CheckboxChecked = true; checkBoxWithDropDown.Enabled = false; // Already existing variants add to selected categories too if (!SelectedCategories.ContainsKey(optionCategory.CategoryID)) { SelectedCategories.Add(optionCategory.CategoryID, VariantOptionInfo.ExistingSelectedOption); } } // Option category is not in variant, but some categories in variants already exists else if (VariantCategoriesOptions.Count > 0) { // Set prompt message and visibility checkBoxWithDropDown.DropDownPrompt = GetString("general.pleaseselect"); checkBoxWithDropDown.DropDownLabel = GetString("com.variants.dropdownlabel"); checkBoxWithDropDown.DropDownVisible = true; // Get all product options and bind them to dropdownlist var options = SKUInfoProvider.GetSKUOptionsForProduct(ProductID, optionCategory.CategoryID, true).OrderBy("SKUOrder"); var dropDownItems = new ListItemCollection(); foreach (var option in options) { dropDownItems.Add(new ListItem(option.SKUName, option.SKUID.ToString())); } checkBoxWithDropDown.DropDownItems = dropDownItems; } // Finally bind this control to parent chboxPanel.Controls.Add(checkBoxWithDropDown); } } }
/// <summary> /// Handles the OptionCategoryGrid's OnAction event. /// </summary> /// <param name="actionName">Name of item (button) that throws event</param> /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param> protected void OptionCategoryGrid_OnAction(string actionName, object actionArgument) { int categoryId = ValidationHelper.GetInteger(actionArgument, 0); switch (actionName.ToLowerCSafe()) { case "edit": URLHelper.Redirect(UIContextHelper.GetElementUrl(ModuleName.ECOMMERCE, "EditOptionCategory", false, categoryId)); break; case "delete": OptionCategoryInfo categoryObj = OptionCategoryInfoProvider.GetOptionCategoryInfo(categoryId); if (categoryObj == null) { break; } // Check permissions if (!ECommerceContext.IsUserAuthorizedToModifyOptionCategory(categoryObj)) { // Check module permissions if (categoryObj.CategoryIsGlobal) { RedirectToAccessDenied(ModuleName.ECOMMERCE, EcommercePermissions.ECOMMERCE_MODIFYGLOBAL); } else { RedirectToAccessDenied(ModuleName.ECOMMERCE, "EcommerceModify OR ModifyProducts"); } } // Check category dependencies if (categoryObj.Generalized.CheckDependencies()) { // Show error message ShowError(EcommerceUIHelper.GetDependencyMessage(categoryObj)); return; } DataSet options = SKUInfoProvider.GetSKUOptions(categoryId, false); // Check option category options dependencies if (!DataHelper.DataSourceIsEmpty(options)) { // Check if some attribute option is not used in variant if (categoryObj.CategoryType == OptionCategoryTypeEnum.Attribute) { var optionIds = DataHelper.GetIntegerValues(options.Tables[0], "SKUID"); // Check if some variant is defined by this option DataSet variants = VariantOptionInfoProvider.GetVariantOptions() .TopN(1) .Column("VariantSKUID") .WhereIn("OptionSKUID", optionIds); if (!DataHelper.DataSourceIsEmpty(variants)) { // Option is used in some variant ShowError(GetString("com.option.categoryoptiosusedinvariant")); return; } } // Check other dependencies (shopping cart, order) foreach (DataRow option in options.Tables[0].Rows) { var skuid = ValidationHelper.GetInteger(option["SKUID"], 0); var sku = SKUInfoProvider.GetSKUInfo(skuid); if (SKUInfoProvider.CheckDependencies(skuid)) { // Show error message ShowError(EcommerceUIHelper.GetDependencyMessage(sku)); return; } } } // Delete option category from database OptionCategoryInfoProvider.DeleteOptionCategoryInfo(categoryObj); break; } }
/// <summary> /// Sets data to database. /// </summary> protected void btnOK_Click(object sender, EventArgs e) { // Check module permissions bool global = (editedSiteId <= 0); if (!ECommerceContext.IsUserAuthorizedToModifyOptionCategory(global)) { // Check module permissions if (global) { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceGlobalModify"); } else { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifyProducts"); } } // Check input value from textboxs string errorMessage = new Validator().NotEmpty(txtDisplayName.Text, GetString("general.requiresdisplayname")) .NotEmpty(txtCategoryName.Text, GetString("general.requirescodename")) .IsIdentificator(txtCategoryName.Text, GetString("optioncategory_new.errorNotIdentificator")).Result; if (errorMessage == "") { // Category code name must be unique OptionCategoryInfo optionCategoryObj = null; string siteWhere = (ConfiguredSiteID > 0) ? " AND (CategorySiteID = " + ConfiguredSiteID + " OR CategorySiteID IS NULL)" : ""; DataSet ds = OptionCategoryInfoProvider.GetOptionCategories("CategoryName = '" + txtCategoryName.Text.Trim().Replace("'", "''") + "'" + siteWhere, null, 1, null); if (!DataHelper.DataSourceIsEmpty(ds)) { optionCategoryObj = new OptionCategoryInfo(ds.Tables[0].Rows[0]); } // If category code name value is unique if (optionCategoryObj == null) { // Create, fill and set OptionCategoryInfo object optionCategoryObj = new OptionCategoryInfo(); optionCategoryObj.CategoryDisplayName = txtDisplayName.Text.Trim(); optionCategoryObj.CategoryName = txtCategoryName.Text.Trim(); optionCategoryObj.CategorySelectionType = radSelection.Checked ? OptionCategorySelectionTypeEnum.Dropdownlist : OptionCategorySelectionTypeEnum.TextBox; optionCategoryObj.CategoryEnabled = true; optionCategoryObj.CategoryDefaultRecord = ""; optionCategoryObj.CategoryDefaultOptions = ""; optionCategoryObj.CategorySiteID = ConfiguredSiteID; // Create category and option under transaction using (CMSTransactionScope tr = new CMSTransactionScope()) { OptionCategoryInfoProvider.SetOptionCategoryInfo(optionCategoryObj); if (radText.Checked) { // Create text product option SKUInfo option = new SKUInfo() { SKUOptionCategoryID = optionCategoryObj.CategoryID, SKUProductType = SKUProductTypeEnum.Text, SKUSiteID = ConfiguredSiteID, SKUName = optionCategoryObj.CategoryDisplayName, SKUDepartmentID = 0, SKUPrice = 0, SKUNeedsShipping = false, SKUWeight = 0, SKUEnabled = true }; SKUInfoProvider.SetSKUInfo(option); } // Commit a transaction tr.Commit(); } URLHelper.Redirect("OptionCategory_Edit.aspx?categoryId=" + Convert.ToString(optionCategoryObj.CategoryID) + "&saved=1&siteId=" + SiteID); } else { lblError.Visible = true; lblError.Text = GetString("optioncategory_new.errorExistingCodeName"); } } else { lblError.Visible = true; lblError.Text = errorMessage; } }