Example #1
0
        public static int AddCustomOption(CustomOption copt)
        {
            var id = SQLDataHelper.GetInt(SQLDataAccess.ExecuteScalar(
                                              "[Catalog].[sp_AddCustomOption]",
                                              CommandType.StoredProcedure,
                                              new[]
            {
                new SqlParameter("@Title", copt.Title),
                new SqlParameter("@IsRequired", copt.IsRequired),
                new SqlParameter("@InputType", copt.InputType),
                new SqlParameter("@SortOrder", copt.SortOrder),
                new SqlParameter("@ProductID", copt.ProductId)
            }
                                              ));

            if (id != 0)
            {
                foreach (var optionItem in copt.Options)
                {
                    if (optionItem.Title != null)
                    {
                        AddOption(optionItem, id);
                    }
                }
            }
            return(id);
        }
 public static int AddCustomOption(CustomOption copt)
 {
     var id = SQLDataHelper.GetInt(SQLDataAccess.ExecuteScalar(
                                                 "[Catalog].[sp_AddCustomOption]",
                                                 CommandType.StoredProcedure,
                                                 new[]
                                                      {
                                                          new SqlParameter("@Title", copt.Title),
                                                          new SqlParameter("@IsRequired", copt.IsRequired),
                                                          new SqlParameter("@InputType", copt.InputType),
                                                          new SqlParameter("@SortOrder", copt.SortOrder),
                                                          new SqlParameter("@ProductID", copt.ProductId)
                                                      }
                                                   ));
     if (id != 0)
     {
         foreach (var optionItem in copt.Options)
         {
             if (optionItem.Title != null)
             {
                 AddOption(optionItem, id);
             }
         }
     }
     return id;
 }
        protected void btnAddCustomOption_Click(object sender, EventArgs e)
        {
            LoadCustomOptions();
            var copt = new CustomOption(true) { CustomOptionsId = -1, ProductId = ProductId };

            var opt = new OptionItem { OptionId = -1, PriceBc = 0, SortOrder = 10 };

            copt.Options = new List<OptionItem> { opt };

            _customOptions.Add(copt);
            UpdateCustomOptions();
        }
Example #4
0
 public static void UpdateCustomOption(CustomOption copt)
 {
     SQLDataAccess.ExecuteNonQuery("[Catalog].[sp_UpdateCustomOption]", CommandType.StoredProcedure,
                                   new SqlParameter("@CustomOptionsId", copt.CustomOptionsId),
                                   new SqlParameter("@Title", copt.Title),
                                   new SqlParameter("@IsRequired", copt.IsRequired),
                                   new SqlParameter("@InputType", copt.InputType),
                                   new SqlParameter("@SortOrder", copt.SortOrder),
                                   new SqlParameter("@ProductID", copt.ProductId));
     SQLDataAccess.ExecuteNonQuery("DELETE FROM [Catalog].[Options] WHERE [CustomOptionsId] = @CustomOptionsId",
                                   CommandType.Text, new SqlParameter("@CustomOptionsId", copt.CustomOptionsId));
     foreach (var optionItem in copt.Options)
     {
         AddOption(optionItem, copt.CustomOptionsId);
     }
 }
Example #5
0
        //****** Private controls set
        private void GetTextBoxSingleLine(HtmlGenericControl row, CustomOption customOption, IList<EvaluatedCustomOptions> evlist)
        {
            var title = new HtmlGenericControl("div");
            title.Attributes.Add("class", "param-name");
            var l = new Label { Text = customOption.Title + ":" };
            title.Controls.Add(l);

            var value = new HtmlGenericControl("div");
            value.Attributes.Add("class", "param-value");

            var subDiv = new HtmlGenericControl("div");
            subDiv.Attributes.Add("style", "width:200px;float:left");

            var ctrl = new TextBox { ID = (customOption.ID + customOption.Title).GetHashCode().ToString() };
            ctrl.Attributes.Add("style", "width:170px;");
            if (ShowValidation)
            {
                ctrl.Attributes.Add("class", "valid-required group-cOptions");
            }

            if (evlist != null)
            {
                EvaluatedCustomOptions ev = evlist.WithCustomOptionId(customOption.CustomOptionsId);
                if (ev != null)
                {
                    ctrl.Text = ev.OptionTitle;
                }
            }
            subDiv.Controls.Add(ctrl);
            value.Controls.Add(subDiv);
            _controls.Add(ctrl);

            var lbApply = new LinkButton() { ID = (customOption.ID + customOption.Title + "lb").GetHashCode().ToString(), Text = Resource.Client_Details_Apply };
            lbApply.Attributes.Add("style", "float:right");
            lbApply.Attributes.Add("class", "group-cOptions");
            lbApply.OnClientClick = "if(!$('form').valid('cOptions')){return false;}";
            value.Controls.Add(lbApply);
            _controls.Add(lbApply);

            row.Controls.Add(title);
            row.Controls.Add(value);
        }
Example #6
0
        private void GetTextBoxMultiLine(HtmlGenericControl row, CustomOption customOption, IList<EvaluatedCustomOptions> evlist)
        {
            var title = new HtmlGenericControl("div");
            title.Attributes.Add("class", "param-name");
            var l = new Label { Text = customOption.Title + ":" };
            title.Controls.Add(l);

            var value = new HtmlGenericControl("div");
            value.Attributes.Add("class", "param-value");

            var ctrl = new TextBox { TextMode = TextBoxMode.MultiLine, ID = customOption.Title };
            if (evlist != null)
            {
                EvaluatedCustomOptions ev = evlist.WithCustomOptionId(customOption.CustomOptionsId);
                if (ev != null)
                {
                    ctrl.Text = ev.OptionTitle;
                }
            }
            value.Controls.Add(ctrl);
            _controls.Add(ctrl);

            row.Controls.Add(title);
            row.Controls.Add(value);
        }
Example #7
0
        private void GetRadioButton(HtmlGenericControl row, CustomOption customOption, IList<EvaluatedCustomOptions> evlist)
        {
            var title = new HtmlGenericControl("div");
            title.Attributes.Add("class", "param-name");
            var l = new Label { Text = customOption.Title + ":" };
            title.Controls.Add(l);

            var value = new HtmlGenericControl("div");
            value.Attributes.Add("class", "param-value");

            var ctrl = new RadioButtonList { ID = (customOption.ID + customOption.Title).GetHashCode().ToString(), AutoPostBack = true, CssClass = "table-customOptions" };
            if (!customOption.IsRequired)
            {
                var item = new ListItem { Value = @"-1", Text = Resource.Client_UserControls_CustomOptions_None };
                ctrl.Items.Add(item);
            }
            foreach (var opt in customOption.Options)
            {
                var price = opt.PriceBc;
                var item = new ListItem { Value = opt.OptionId.ToString() };

                if (price != 0)
                {
                    var prefix = price > 0 ? " +" : " ";

                    switch (opt.PriceType)
                    {
                        case OptionPriceType.Fixed:
                            item.Text = opt.Title + prefix + CatalogService.GetStringPrice(price);
                            break;

                        case OptionPriceType.Percent:
                            item.Text = opt.Title + prefix + price.ToString("#,0.##") + @"%";
                            break;
                    }
                }
                else
                {
                    item.Text = opt.Title;
                }

                ctrl.Items.Add(item);
            }
            if (evlist != null)
            {
                EvaluatedCustomOptions ev = evlist.WithCustomOptionId(customOption.CustomOptionsId);
                if (ev != null)
                {
                    ctrl.SelectedValue = ev.OptionId.ToString();
                }
                else
                {
                    ctrl.SelectedIndex = 0;
                }
            }
            else
            {
                ctrl.SelectedIndex = 0;
            }
            value.Controls.Add(ctrl);
            _controls.Add(ctrl);

            row.Controls.Add(title);
            row.Controls.Add(value);
        }
Example #8
0
        private void GetDropDownList(HtmlGenericControl row, CustomOption customOption, IList<EvaluatedCustomOptions> evlist)
        {
            var title = new HtmlGenericControl("div");
            title.Attributes.Add("class", "param-name");
            var l = new Label { Text = customOption.Title + ":" };
            title.Controls.Add(l);

            var value = new HtmlGenericControl("div");
            //value.InnerHtml = "<div class='ui-select'>" +
            //                        "<div class='ui-btn ui-shadow ui-btn-corner-all ui-btn-icon-right ui-btn-up-f'>" +
            //                            "<span class='ui-btn-inner ui-btn-corner-all'>"+
            //                                "<span class='ui-btn-text'>" +
            //                                    "<span>Перейти в ...</span>" +
            //                                "</span>" +
            //                                "<span class='ui-icon ui-icon-arrow-d ui-icon-shadow'>&nbsp;</span>"+
            //                            "</span>" +
            //                        "</div>" +
            //                  "</div>";

            value.Attributes.Add("class", "param-value");

            var ctrl = new DropDownList
                {
                    Width = 210,
                    ID = (customOption.ID + customOption.Title).GetHashCode().ToString(),
                    AutoPostBack = true,

                };

            if (!customOption.IsRequired)
            {
                var item = new ListItem { Value = @"-1", Text = Resource.Client_UserControls_CustomOptions_None };
                ctrl.Items.Add(item);
            }
            foreach (var opt in customOption.Options)
            {
                var price = opt.PriceBc;
                var item = new ListItem { Value = opt.OptionId.ToString() };

                if (price != 0)
                {
                    var prefix = price > 0 ? " +" : " ";

                    switch (opt.PriceType)
                    {
                        case OptionPriceType.Fixed:
                            price = GetPrice(price);
                            item.Text = opt.Title + prefix + CatalogService.GetStringPrice(price);
                            break;

                        case OptionPriceType.Percent:
                            item.Text = opt.Title + prefix + price.ToString("#,0.##") + @"%";
                            break;
                    }
                }
                else
                {
                    item.Text = opt.Title;
                }
                ctrl.Items.Add(item);
            }

            if (evlist != null)
            {
                EvaluatedCustomOptions ev = evlist.WithCustomOptionId(customOption.CustomOptionsId);
                if (ev != null)
                {
                    ctrl.SelectedValue = ev.OptionId.ToString();
                }
            }
            value.Controls.Add(ctrl);
            _controls.Add(ctrl);

            row.Controls.Add(title);
            row.Controls.Add(value);
        }
Example #9
0
        private void GetCheckBox(HtmlGenericControl row, CustomOption customOption, IList<EvaluatedCustomOptions> evlist)
        {
            var title = new HtmlGenericControl("div");
            title.Attributes.Add("class", "param-name");
            var l = new Label { Text = customOption.Title + ":" };
            title.Controls.Add(l);

            var value = new HtmlGenericControl("div");
            value.Attributes.Add("class", "param-value");

            var price = customOption.Options[0].PriceBc;
            var ctrl = new CheckBox { ID = (customOption.ID + customOption.Title).GetHashCode().ToString(), AutoPostBack = true };

            if (price != 0)
            {
                var prefix = (price > 0) ? " +" : " ";

                switch (customOption.Options[0].PriceType)
                {
                    case OptionPriceType.Fixed:
                        price = GetPrice(price);
                        ctrl.Text = prefix + CatalogService.GetStringPrice(price);
                        break;

                    case OptionPriceType.Percent:
                        ctrl.Text = prefix + price.ToString("#,0.##") + @"%";
                        break;
                }
            }
            else
            {
                ctrl.Text = string.Empty;
            }

            if (evlist != null)
            {
                EvaluatedCustomOptions ev = evlist.WithCustomOptionId(customOption.CustomOptionsId);
                if (ev != null)
                {
                    ctrl.Checked = ev.OptionId > 0;
                }
            }

            value.Controls.Add(ctrl);
            _controls.Add(ctrl);

            row.Controls.Add(title);
            row.Controls.Add(value);
        }
 public static void UpdateCustomOption(CustomOption copt)
 {
     SQLDataAccess.ExecuteNonQuery("[Catalog].[sp_UpdateCustomOption]", CommandType.StoredProcedure,
                                     new SqlParameter("@CustomOptionsId", copt.CustomOptionsId),
                                     new SqlParameter("@Title", copt.Title),
                                     new SqlParameter("@IsRequired", copt.IsRequired),
                                     new SqlParameter("@InputType", copt.InputType),
                                     new SqlParameter("@SortOrder", copt.SortOrder),
                                     new SqlParameter("@ProductID", copt.ProductId));
     SQLDataAccess.ExecuteNonQuery("DELETE FROM [Catalog].[Options] WHERE [CustomOptionsId] = @CustomOptionsId",
                                     CommandType.Text, new SqlParameter("@CustomOptionsId", copt.CustomOptionsId));
     foreach (var optionItem in copt.Options)
     {
         AddOption(optionItem, copt.CustomOptionsId);
     }
 }
Example #11
0
        private void ProcessExcel()
        {
            try
            {

                // How much ? ------------------

                int intRootCategories = 7;
                int intSubCategoriesLevel1 = 7;
                int intSubCategoriesLevel2 = 7;

                int intProductCountForCategory = 500;

                // Internal Variables ------------------

                int intCurrentProductIndex = SQLDataHelper.GetInt(SQLDataAccess.ExecuteScalar("Select MAX(ProductId) + 1 FROM Catalog.Product", CommandType.Text, null));
                // 50000

                int intProductAltId1 = 0;
                int intProductAltId2 = 0;
                int intProductAltId3 = 0;

                int intProductAltId4 = 0;
                int intProductAltId5 = 0;
                int intProductAltId6 = 0;

                string strCategoryName1 = "";
                string strCategoryName2 = "";
                string strCategoryName3 = "";

                string strPropName1 = "";
                string strPropName2 = "";
                string strPropName3 = "";
                string strPropName4 = "";
                string strPropName5 = "";
                string strPropName6 = "";
                string strPropName7 = "";

                int intTempProductId = 0;

                //int i, j, k;

                var rnd = new Random();

                // ---------------

                CommonStatistic.TotalRow = (intRootCategories * intSubCategoriesLevel1 * intSubCategoriesLevel2 * intProductCountForCategory);

                // Step by rows

                for (int i = 0; i <= intRootCategories - 1; i++) // 15
                {
                    strCategoryName1 = Strings.GetRandomString(rnd, 25, 6);

                    if (!chbSimpleMode.Checked) // Simple Mode
                    {
                        strPropName1 = Strings.GetRandomString(rnd, 4);
                        strPropName2 = Strings.GetRandomString(rnd, 7);
                        strPropName3 = Strings.GetRandomString(rnd, 7);
                        strPropName4 = Strings.GetRandomString(rnd, 8);
                        strPropName5 = Strings.GetRandomString(rnd, 8);
                        strPropName6 = Strings.GetRandomString(rnd, 9);
                        strPropName7 = Strings.GetRandomString(rnd, 9);
                    }

                    for (int j = 0; j <= intSubCategoriesLevel1 - 1; j++) // 15 x 10
                    {

                        strCategoryName2 = Strings.GetRandomString(rnd, 25, 5);

                        for (int k = 0; k <= intSubCategoriesLevel2 - 1; k++) // 15 x 10 x 10
                        {

                            strCategoryName3 = Strings.GetRandomString(rnd, 25, 4);

                            for (int p = 0; p <= intProductCountForCategory - 1; p++) // 15 x 10 x 10 x 10
                            {

                                intCurrentProductIndex++;

                                intTempProductId = ProcessProduct(rnd, intCurrentProductIndex);

                                // Category ----------------------------------------------------------------------------------------------

                                string parentCategory = string.Format("[{0} >> {1} >> {2}]", strCategoryName1.Trim(), strCategoryName2.Trim(), strCategoryName3.Trim());
                                CategoryService.SubParseAndCreateCategory(parentCategory, intTempProductId);

                                if (!chbSimpleMode.Checked) // Simple Mode
                                {

                                    // Property -----------------------------------------------------------------------------------------------

                                    BuildProperties(rnd, intTempProductId, strPropName1, strPropName2, strPropName3, strPropName4, strPropName5, strPropName6, strPropName7);

                                    // Images -------------------------------------------------------------------------------------------------

                                    var tempId = PhotoService.AddPhoto(new Photo(0, intTempProductId, PhotoType.Product)
                                        {
                                            Description = Strings.GetRandomString(rnd, 25, 4),
                                            ColorID = Colors[DevTool.GetRandomInt(rnd, 0, Colors.Count - 1)].ColorId,

                                        });
                                    if (!string.IsNullOrWhiteSpace(tempId))
                                    {
                                        CopyProductPic(rnd, tempId);
                                    }

                                    tempId = PhotoService.AddPhoto(new Photo(0, intTempProductId, PhotoType.Product)
                                        {
                                            Description = Strings.GetRandomString(rnd, 25, 4),
                                            ColorID = Colors[DevTool.GetRandomInt(rnd, 0, Colors.Count - 1)].ColorId,

                                        });

                                    if (!string.IsNullOrWhiteSpace(tempId))
                                    {
                                        CopyProductPic(rnd, tempId);
                                    }

                                    tempId = PhotoService.AddPhoto(new Photo(0, intTempProductId, PhotoType.Product) { Description = Strings.GetRandomString(rnd, 25, 4) });
                                    if (!string.IsNullOrWhiteSpace(tempId))
                                    {
                                        CopyProductPic(rnd, tempId);
                                    }

                                    // Alt Products --------------------------------------------------------------------------------------------

                                    if (intProductAltId1 != 0)
                                    {
                                        ProductService.AddRelatedProduct(intTempProductId, intProductAltId1, RelatedType.Alternative);
                                    }

                                    if (intProductAltId2 != 0)
                                    {
                                        ProductService.AddRelatedProduct(intTempProductId, intProductAltId2, RelatedType.Alternative);
                                    }

                                    if (intProductAltId3 != 0)
                                    {
                                        ProductService.AddRelatedProduct(intTempProductId, intProductAltId3, RelatedType.Alternative);
                                    }

                                    if (intProductAltId4 != 0)
                                    {
                                        ProductService.AddRelatedProduct(intTempProductId, intProductAltId4, RelatedType.Alternative);
                                    }

                                    if (intProductAltId5 != 0)
                                    {
                                        ProductService.AddRelatedProduct(intTempProductId, intProductAltId5, RelatedType.Alternative);
                                    }

                                    if (intProductAltId6 != 0)
                                    {
                                        ProductService.AddRelatedProduct(intTempProductId, intProductAltId6, RelatedType.Alternative);
                                    }

                                    // And RelatedProduct ---------------------------------------------

                                    if (intProductAltId1 != 0)
                                    {
                                        ProductService.AddRelatedProduct(intTempProductId, intProductAltId1, RelatedType.Related);
                                    }

                                    if (intProductAltId2 != 0)
                                    {
                                        ProductService.AddRelatedProduct(intTempProductId, intProductAltId2, RelatedType.Related);
                                    }

                                    if (intProductAltId3 != 0)
                                    {
                                        ProductService.AddRelatedProduct(intTempProductId, intProductAltId3, RelatedType.Related);
                                    }

                                    // And RelatedProduct

                                    if (intProductAltId4 != 0)
                                    {
                                        ProductService.AddRelatedProduct(intTempProductId, intProductAltId4, RelatedType.Related);
                                    }

                                    if (intProductAltId5 != 0)
                                    {
                                        ProductService.AddRelatedProduct(intTempProductId, intProductAltId5, RelatedType.Related);
                                    }

                                    if (intProductAltId6 != 0)
                                    {
                                        ProductService.AddRelatedProduct(intTempProductId, intProductAltId6, RelatedType.Related);
                                    }

                                    //intProductAltId1 = intProductAltId2;
                                    //intProductAltId2 = intProductAltId3;
                                    //intProductAltId3 = intTempProductId;

                                    intProductAltId1 = intProductAltId2;
                                    intProductAltId2 = intProductAltId3;
                                    intProductAltId3 = intProductAltId4;

                                    intProductAltId4 = intProductAltId5;
                                    intProductAltId5 = intProductAltId6;
                                    intProductAltId6 = intTempProductId;

                                    // Custom Options --------------------------------------------------------------------------------------------

                                    var copt = new CustomOption(true) { CustomOptionsId = -1, ProductId = intTempProductId };

                                    // copt.InputType = CustomOptionInputType.RadioButton;
                                    copt.Title = Demo.GetRandomCity();

                                    var opt = new OptionItem { OptionId = -1, PriceBc = 0, SortOrder = 10 };
                                    opt.Title = Demo.GetRandomName();

                                    var opt2 = new OptionItem { OptionId = -1, PriceBc = DevTool.GetRandomInt(rnd, 0, 100), SortOrder = 20 };
                                    opt2.Title = Demo.GetRandomLastName();

                                    var opt3 = new OptionItem { OptionId = -1, PriceBc = DevTool.GetRandomInt(rnd, 0, 10), SortOrder = 30 };
                                    opt3.Title = Demo.GetRandomName();

                                    copt.Options = new List<OptionItem> { opt, opt2, opt3 };

                                    CustomOptionsService.AddCustomOption(copt);

                                }

                            }

                        }

                    }

                }

                CategoryService.RecalculateProductsCountManual();

                //TODO find where is this function!
                //ProductService.SumImportLog(Resource.Admin_ImportXLS_UpdoadingSuccessfullyCompleted,Resource.Admin_ImportXLS_UpdoadingCompletedWithErrors);

            }
            catch (Exception ex)
            {
                MsgErr(ex.Message + " at xls");
                Debug.LogError(ex);
            }

            CommonStatistic.IsRun = false;
            CommonStatistic.ThreadImport.Abort();
        }
        private void LoadCustomOptions()
        {
            var customOptions = new List<CustomOption>();

            foreach (RepeaterItem item in rCustomOptions.Items)
            {
                var customOption = new CustomOption
                    {
                        CustomOptionsId = ((HiddenField)(item.FindControl("hfId"))).Value.TryParseInt(),
                        ProductId = ((HiddenField)(item.FindControl("hfProductId"))).Value.TryParseInt()
                    };

                if (string.IsNullOrEmpty(((TextBox)(item.FindControl("txtTitle"))).Text))
                {
                    _valid = false;
                }

                int i;
                if (!int.TryParse(((TextBox)(item.FindControl("txtSortOrder"))).Text, out i))
                {
                    _valid = false;
                }

                customOption.Title = ((TextBox)(item.FindControl("txtTitle"))).Text;
                customOption.InputType = (CustomOptionInputType)((((DropDownList)(item.FindControl("ddlInputType"))).SelectedValue.TryParseInt()));
                customOption.IsRequired = ((CheckBox)(item.FindControl("cbIsRequired"))).Checked;
                try
                {
                    customOption.SortOrder = SQLDataHelper.GetInt(((TextBox)(item.FindControl("txtSortOrder"))).Text);
                }
                catch (Exception)
                {
                    customOption.SetFieldToNull(CustomOptionField.SortOrder);
                }

                customOption.Options = new List<OptionItem>();

                if (customOption.InputType == CustomOptionInputType.CheckBox)
                {
                    var opt = new OptionItem { Title = " " };
                    try
                    {
                        opt.PriceBc = SQLDataHelper.GetFloat(((TextBox)(item.FindControl("txtPrice"))).Text);
                    }
                    catch (Exception)
                    {
                        opt.SetFieldToNull(OptionField.PriceBc);
                        _valid = false;
                    }

                    opt.PriceType = OptionPriceType.Fixed;
                    if (Enum.IsDefined(typeof(OptionPriceType), ((DropDownList)(item.FindControl("ddlPriceType"))).SelectedValue))
                        opt.PriceType = (OptionPriceType)Enum.Parse(typeof(OptionPriceType), ((DropDownList)(item.FindControl("ddlPriceType"))).SelectedValue, true);

                    customOption.Options.Add(opt);
                }
                else
                {
                    foreach (GridViewRow row in ((GridView)(item.FindControl("grid"))).Rows)
                    {
                        var opt = new OptionItem
                            {
                                OptionId = ((Label)(row.Cells[0].FindControl("lId"))).Text.TryParseInt()
                            };
                        if (string.IsNullOrEmpty(((TextBox)(row.Cells[1].FindControl("txtTitle"))).Text) &&
                            !(customOption.InputType == CustomOptionInputType.CheckBox ||
                              customOption.InputType == CustomOptionInputType.TextBoxMultiLine ||
                              customOption.InputType == CustomOptionInputType.TextBoxSingleLine))
                        {
                            _valid = false;
                        }
                        opt.Title = ((TextBox)(row.Cells[1].FindControl("txtTitle"))).Text;
                        try
                        {
                            opt.PriceBc = SQLDataHelper.GetFloat(((TextBox)(row.Cells[2].FindControl("txtPriceBC"))).Text);
                        }
                        catch (Exception)
                        {
                            opt.SetFieldToNull(OptionField.PriceBc);
                            _valid = false;
                        }

                        opt.PriceType = OptionPriceType.Fixed;
                        if (Enum.IsDefined(typeof(OptionPriceType), ((DropDownList)(row.Cells[3].FindControl("ddlPriceType"))).SelectedValue))
                            opt.PriceType = (OptionPriceType)Enum.Parse(typeof(OptionPriceType), ((DropDownList)(row.Cells[3].FindControl("ddlPriceType"))).SelectedValue, true);
                        try
                        {
                            opt.SortOrder = int.Parse(((TextBox)(row.Cells[4].FindControl("txtSortOrder"))).Text);
                        }
                        catch (Exception)
                        {
                            opt.SetFieldToNull(OptionField.SortOrder);
                            _valid = false;
                        }
                        customOption.Options.Add(opt);
                    }
                }
                customOptions.Add(customOption);
            }

            _customOptions = customOptions;
        }