示例#1
0
        protected void lbSave_Click(object sender, EventArgs e)
        {
            var blogPost = new BlogPost
            {
                Title           = txtTitle.Text.Trim(),
                Body            = txtBody.Text.Trim(),
                BodyOverview    = txtBodyOverview.Text.Trim(),
                Tags            = txtTags.Text.Trim(),
                AllowComments   = cbAllowComments.Checked,
                MetaKeywords    = txtMetaKeywords.Text.Trim(),
                MetaDescription = txtMetaDescription.Text.Trim(),
                MetaTitle       = txtMetaTitle.Text.Trim(),
                UrlKey          = txtUrlKey.Text.Trim(),
                CreatedOnDate   = DateTime.Now
            };

            if (!string.IsNullOrEmpty(txtDateFrom.Text.Trim()))
            {
                blogPost.StartDate = DateTime.ParseExact(txtDateFrom.Text, AppConstant.DATE_FORM1, CultureInfo.InvariantCulture);
            }

            if (!string.IsNullOrEmpty(txtDateTo.Text.Trim()))
            {
                blogPost.EndDate = DateTime.ParseExact(txtDateTo.Text, AppConstant.DATE_FORM1, CultureInfo.InvariantCulture);
            }

            bool proceed = true;

            if (string.IsNullOrEmpty(blogPost.UrlKey))
            {
                blogPost.UrlKey = AdminStoreUtility.GetFriendlyUrlKey(blogPost.Title);
                txtUrlKey.Text  = blogPost.UrlKey;

                var existingBlogPost = BlogService.GetBlogPostByUrlKey(blogPost.UrlKey);
                if (existingBlogPost != null)
                {
                    proceed           = false;
                    enbNotice.Message = "Blog post was failed to create. Search engine friendly page name was not unique. Please try again with an unique name.";
                }
            }

            if (proceed)
            {
                var id = BlogService.InsertBlogPost(blogPost);
                Response.Redirect("/marketing/cms_blog_post_info.aspx?id=" + id + "&" + QueryKey.MSG_TYPE + "=" + (int)MessageType.BlogPostCreated);
            }
        }
示例#2
0
        protected void lbSaveBrand_Click(object sender, EventArgs e)
        {
            string urlKey = txtUrlKey.Text.Trim();

            txtUrlKey.BackColor = Color.Empty;

            // If urlKey is empty, regenerate with given category name
            if (urlKey == string.Empty)
            {
                urlKey         = AdminStoreUtility.GetFriendlyUrlKey(txtName.Text.Trim());
                txtUrlKey.Text = urlKey;
            }

            // Make sure urlKey is unique
            if (((GetStringState(MODE) == NEW) && (BrandService.GetBrandByUrlKey(urlKey) != null)) ||
                ((GetStringState(MODE) == EDIT) && (BrandService.GetBrandByUrlKey(urlKey) != null) && (BrandService.GetBrandByUrlKey(urlKey).Id != GetIntState(BRAND_ID))))
            {
                enbNotice.Message = "Url Key is not unique.";
            }
            else
            {
                SaveLastViewedProduct();

                Brand brand = new Brand();

                brand.Name             = Server.HtmlEncode(txtName.Text.Trim());
                brand.FlashImageHeight = -1;
                brand.FlashImageWidth  = -1;
                brand.UrlRewrite       = urlKey;

                string logoFilename = string.Empty;
                //added string empty to avoid the exception
                brand.FlashImage = string.Empty;
                if (fuLogo.HasFile)
                {
                    logoFilename = brand.UrlRewrite.Trim().ToLower() + "-logo" + Path.GetExtension(fuLogo.FileName).ToLower();
                    fuLogo.SaveAs(MediaSettings.BrandMediaLocalPath + logoFilename);
                    brand.FlashImage = logoFilename;
                }

                // Get old logo filename
                if (!fuLogo.HasFile && imgLogo.Alt != string.Empty)
                {
                    brand.FlashImage = imgLogo.Alt;
                }

                // Remove logo file
                if (cbRemoveLogo.Checked && imgLogo.Alt != string.Empty)
                {
                    File.Delete(MediaSettings.BrandMediaLocalPath + imgLogo.Alt);
                    brand.FlashImage     = string.Empty;
                    cbRemoveLogo.Checked = false;
                }

                brand.Description       = txtDesc.Text.Trim();
                brand.HasMicrosite      = cbMicrosite.Checked;
                brand.MetaDescription   = txtMetaDesc.Text.Trim();
                brand.MetaTitle         = txtMetaTitle.Text.Trim();
                brand.MetaKeywords      = txtMetaKeywords.Text.Trim();
                brand.EnforceStockCount = cbEnforceStockCount.Checked;
                brand.DeliveryId        = Convert.ToInt32(ddlDelivery.SelectedValue);
                brand.Enabled           = cbEnabled.Checked;

                if (GetStringState(MODE) == NEW)
                {
                    int brandId = BrandService.InsertBrand(brand);
                    brand.Id = brandId;
                    SetState(BRAND_ID, brand.Id);

                    enbNotice.Message = "Brand was created successfully.";
                }
                else // Edit mode
                {
                    brand.Id = GetIntState(BRAND_ID);
                    BrandService.UpdateBrand(brand);

                    if (NotChosenProducts.Count > 0)
                    {
                        BrandService.UpdateProductWithBrand(AppConstant.DEFAULT_BRAND, NotChosenProducts);
                    }

                    enbNotice.Message = "Brand was updated successfully.";
                }

                if (ChosenProducts.Count > 0)
                {
                    BrandService.UpdateProductWithBrand(brand.Id, ChosenProducts);
                }
            }

            ChosenProducts.Clear();
            NotChosenProducts.Clear();
            LoadProducts();

            hfCurrentPanel.Value = "general";
        }
        protected void lbSave_Click(object sender, EventArgs e)
        {
            string urlKey = txtUrlKey.Text.Trim();

            // If urlKey is empty, regenerate with given name
            if (urlKey == string.Empty)
            {
                urlKey         = AdminStoreUtility.GetFriendlyUrlKey(txtRuleAlias.Text.Trim());
                txtUrlKey.Text = urlKey;
            }

            // Make sure urlKey is unique
            if (((OfferService.GetOfferRuleByUrlKey(urlKey) != null) && (OfferService.GetOfferRuleByUrlKey(urlKey).Id != QueryOfferRuleId)))
            {
                enbNotice.Message = "Offer was failed to save. URL key is not unique.";
            }
            else
            {
                var rule = OfferService.GetOfferRuleById(QueryOfferRuleId);

                rule.UrlRewrite     = urlKey;
                rule.Name           = txtRuleName.Text.Trim();
                rule.ProceedForNext = Convert.ToBoolean(rblProceed.SelectedValue);
                rule.IsActive       = Convert.ToBoolean(rblStatus.SelectedValue);
                rule.Priority       = Convert.ToInt32(txtPriority.Text.Trim());
                rule.Alias          = txtRuleAlias.Text.Trim();
                rule.ShowOfferTag   = chkShowOfferTag.Checked;
                rule.ShowRRP        = chkShowRRP.Checked;
                rule.OfferUrl       = txtViewOfferURL.Text.Trim();
                rule.PointSpendable = chkPointSpendable.Checked;
                rule.ShowCountDown  = cbShowCountDownTimer.Checked;

                if (!string.IsNullOrEmpty(txtDateFrom.Text.Trim()))
                {
                    rule.StartDate = DateTime.ParseExact(txtDateFrom.Text, AppConstant.DATE_FORM1, CultureInfo.InvariantCulture);
                }
                else
                {
                    rule.StartDate = null;
                }

                if (!string.IsNullOrEmpty(txtDateTo.Text.Trim()))
                {
                    rule.EndDate = DateTime.ParseExact(txtDateTo.Text, AppConstant.DATE_FORM1, CultureInfo.InvariantCulture);
                }
                else
                {
                    rule.EndDate = null;
                }

                rule.ShortDescription = txtShortDescription.Text;

                string htmlMsg;

                if (ftbLongDesc.Visible)
                {
                    htmlMsg = AdminStoreUtility.CleanFtbOutput(ftbLongDesc.Text);
                }
                else
                {
                    htmlMsg = txtShortDescription.Text.Trim();
                }

                rule.LongDescription      = htmlMsg;
                rule.ShowInOfferPage      = chkShowOnOfferPage.Checked;
                rule.DisplayOnHeaderStrip = chkDisplayOnHeaderStrip.Checked;
                rule.OfferLabel           = txtOfferLabel.Text.Trim();
                rule.DisableOfferLabel    = cbDisableOfferLabel.Checked;
                rule.DisplayOnProductPage = cbDisplayOnProductPage.Checked;
                rule.OfferTypeId          = Convert.ToInt32(ddlOfferTypes.SelectedValue);

                if (ddlRelatedTypes.SelectedValue != string.Empty)
                {
                    switch (ddlRelatedTypes.SelectedValue)
                    {
                    case "products":
                        rule.RelatedProducts = txtRelatedItems.Text.ToString();
                        break;

                    case "brands":
                        rule.RelatedBrands = txtRelatedItems.Text.ToString();
                        break;

                    case "category":
                        rule.RelatedCategory = txtRelatedItems.Text.ToString();
                        break;
                    }
                }
                else
                {
                    rule.RelatedProducts = string.Empty;
                    rule.RelatedBrands   = string.Empty;
                    rule.RelatedCategory = string.Empty;
                }

                if (fuSmallImage.HasFile)
                {
                    string filename = rule.Id.ToString() + "_small" + Path.GetExtension(fuSmallImage.FileName).ToLower();
                    fuSmallImage.SaveAs(MediaSettings.OfferMediaLocalPath + filename);

                    rule.SmallImage = filename;
                }

                if (fuLargeImage.HasFile)
                {
                    string filename = rule.Id.ToString() + "_large" + Path.GetExtension(fuLargeImage.FileName).ToLower();
                    fuLargeImage.SaveAs(MediaSettings.OfferMediaLocalPath + filename);

                    rule.LargeImage = filename;
                }

                var newAction = new OfferAction
                {
                    Id                     = rule.Action.Id,
                    OfferRuleId            = rule.Action.OfferRuleId,
                    DiscountAmount         = Convert.ToDecimal(txtDiscountAmount.Text),
                    OfferActionAttributeId = Convert.ToInt32(ddlAction.SelectedValue),
                    Name                   = ddlAction.SelectedItem.Text,
                    IsCatalog              = true
                };

                // Retrieve size target if any
                string optionOperatorId = null;
                string optionOperator   = null;
                string optionOperand    = null;

                if (txtOption.Text.Trim() != string.Empty)
                {
                    optionOperand    = txtOption.Text.Trim();
                    optionOperatorId = ddlOptionOperator.SelectedValue;
                    optionOperator   = OfferService.GetOfferOperator(Convert.ToInt32(optionOperatorId)).Operator;
                }

                if (!string.IsNullOrEmpty(optionOperatorId))
                {
                    newAction.OptionOperatorId = Convert.ToInt32(optionOperatorId);
                }
                if (!string.IsNullOrEmpty(optionOperand))
                {
                    newAction.OptionOperand = Convert.ToString(optionOperand);
                }
                if ((!string.IsNullOrEmpty(optionOperator)) && (!string.IsNullOrEmpty(optionOperatorId)))
                {
                    newAction.OptionOperator = new OfferOperator
                    {
                        Id       = Convert.ToInt32(optionOperatorId),
                        Operator = Convert.ToString(optionOperator)
                    }
                }
                ;

                rule.Action = newAction;

                var proceed = true;

                // Assign root condition to this rule object's condition
                rule.Condition = OfferUtility.OfferRuleConditions[rule.Id];

                if (rule.Condition == null)
                {
                    enbNotice.Message = "Offer was failed to update. There is no condition setup for this offer. It could be due to session lost. Please try to create again.";
                    proceed           = false;
                }

                if (proceed)
                {
                    // Update database
                    var success = OfferService.ProcessOfferUpdation(rule);

                    if (success)
                    {
                        enbNotice.Message = "Offer was updated successfully.";
                    }
                    else
                    {
                        enbNotice.Message = "Offer was failed to update.";
                    }

                    LoadCatalogInfo();
                }
            }
        }
        protected void lbSave_Click(object sender, EventArgs e)
        {
            string urlKey = txtUrlKey.Text.Trim();

            // If urlKey is empty, regenerate with given name
            if (urlKey == string.Empty)
            {
                urlKey         = AdminStoreUtility.GetFriendlyUrlKey(txtRuleAlias.Text.Trim());
                txtUrlKey.Text = urlKey;
            }

            // Make sure urlKey is unique
            if (((OfferService.GetOfferRuleByUrlKey(urlKey) != null) && (OfferService.GetOfferRuleByUrlKey(urlKey).Id != QueryOfferRuleId)))
            {
                enbNotice.Message = "Offer was failed to save. URL key is not unique.";
            }
            else
            {
                string htmlMsg;

                if (ftbDesc.Visible)
                {
                    htmlMsg = AdminStoreUtility.CleanFtbOutput(ftbDesc.Text);
                }
                else
                {
                    htmlMsg = txtDescription.Text.Trim();
                }

                // Retrieve rule from database
                var rule = OfferService.GetOfferRuleById(QueryOfferRuleId);

                rule.Name                 = txtRuleName.Text.Trim();
                rule.ProceedForNext       = Convert.ToBoolean(rblProceed.SelectedValue);
                rule.IsActive             = Convert.ToBoolean(rblStatus.SelectedValue);
                rule.PromoCode            = txtPromoCode.Text.Trim();
                rule.UsesPerCustomer      = Convert.ToInt32(txtUsesPerCust.Text.Trim());
                rule.Priority             = Convert.ToInt32(txtPriority.Text.Trim());
                rule.HtmlMessage          = htmlMsg;
                rule.OfferedItemIncluded  = cbOfferedItemIncluded.Checked;
                rule.Alias                = txtRuleAlias.Text.Trim();
                rule.PointSpendable       = chkPointSpendable.Checked;
                rule.UrlRewrite           = urlKey;
                rule.UseInitialPrice      = cbUseInitialPrice.Checked;
                rule.NewCustomerOnly      = cbNewCustomerOnly.Checked;
                rule.ShowCountDown        = cbShowCountDownTimer.Checked;
                rule.DisplayOnProductPage = cbDisplayOnProductPage.Checked;
                rule.OfferTypeId          = Convert.ToInt32(ddlOfferTypes.SelectedValue);

                if (ddlRelatedTypes.SelectedValue != string.Empty)
                {
                    switch (ddlRelatedTypes.SelectedValue)
                    {
                    case "products":
                        rule.RelatedProducts = txtRelatedItems.Text.ToString();
                        break;

                    case "brands":
                        rule.RelatedBrands = txtRelatedItems.Text.ToString();
                        break;

                    case "category":
                        rule.RelatedCategory = txtRelatedItems.Text.ToString();
                        break;
                    }
                }
                else
                {
                    rule.RelatedProducts = string.Empty;
                    rule.RelatedBrands   = string.Empty;
                    rule.RelatedCategory = string.Empty;
                }

                if (!string.IsNullOrEmpty(txtDateFrom.Text.Trim()))
                {
                    rule.StartDate = DateTime.ParseExact(txtDateFrom.Text, AppConstant.DATE_FORM1, CultureInfo.InvariantCulture);
                }
                else
                {
                    rule.StartDate = null;
                }

                if (!string.IsNullOrEmpty(txtDateTo.Text.Trim()))
                {
                    rule.EndDate = DateTime.ParseExact(txtDateTo.Text, AppConstant.DATE_FORM1, CultureInfo.InvariantCulture);
                }
                else
                {
                    rule.EndDate = null;
                }

                rule.ShortDescription = txtShortDescription.Text;

                string longDesc;

                if (!ftbLongDesc.Visible && txtLongDesc.Visible)
                {
                    if (txtLongDesc.Text != string.Empty)
                    {
                        longDesc = txtLongDesc.Text.Trim();
                    }
                    else
                    {
                        longDesc = txtShortDescription.Text.Trim();
                    }
                }
                else if (ftbLongDesc.Visible)
                {
                    longDesc = AdminStoreUtility.CleanFtbOutput(ftbLongDesc.Text);
                }
                else
                {
                    longDesc = txtShortDescription.Text.Trim();
                }

                rule.LongDescription      = longDesc;
                rule.ShowInOfferPage      = chkShowOnOfferPage.Checked;
                rule.DisplayOnHeaderStrip = chkDisplayOnHeaderStrip.Checked;
                rule.OfferLabel           = txtOfferLabel.Text.Trim();
                rule.DisableOfferLabel    = cbDisableOfferLabel.Checked;
                rule.OfferUrl             = txtViewOfferURL.Text.Trim();

                if (fuSmallImage.HasFile)
                {
                    string filename = rule.Id.ToString() + "_small" + Path.GetExtension(fuSmallImage.FileName).ToLower();
                    fuSmallImage.SaveAs(MediaSettings.OfferMediaLocalPath + filename);

                    rule.SmallImage = filename;
                }

                if (fuLargeImage.HasFile)
                {
                    string filename = rule.Id.ToString() + "_large" + Path.GetExtension(fuLargeImage.FileName).ToLower();
                    fuLargeImage.SaveAs(MediaSettings.OfferMediaLocalPath + filename);

                    rule.LargeImage = filename;
                }

                object freeProductItself  = DBNull.Value;
                object freeProductId      = DBNull.Value;
                object freeProductPriceId = DBNull.Value;
                object freeProductQty     = DBNull.Value;

                // Determine if there is any free item settings
                if (rbFreeItself.Checked || rbFreeItem.Checked)
                {
                    freeProductItself = rbFreeItself.Checked;

                    if (rbFreeItem.Checked)
                    {
                        freeProductId      = txtFreeProductId.Text.Trim();
                        freeProductPriceId = txtFreeProductPriceId.Text.Trim();
                        freeProductQty     = txtFreeQuantity.Text.Trim();
                    }
                }

                object discountQtyStep = DBNull.Value;
                object minimumAmount   = DBNull.Value;
                object discountAmount  = DBNull.Value;
                int    rewardPoint     = 0;

                if (txtDiscountQtyStep.Text.Trim() != string.Empty)
                {
                    discountQtyStep = txtDiscountQtyStep.Text.Trim();
                }

                if (txtMinimumAmount.Text.Trim() != string.Empty)
                {
                    minimumAmount = txtMinimumAmount.Text.Trim();
                }

                if (txtDiscountAmount.Text.Trim() != string.Empty)
                {
                    discountAmount = txtDiscountAmount.Text.Trim();
                }

                if (txtRewardPoint.Text.Trim() != string.Empty)
                {
                    rewardPoint = Convert.ToInt32(txtRewardPoint.Text.Trim());
                }

                // Retrieve size target if any
                object optionOperatorId = DBNull.Value;
                object optionOperator   = DBNull.Value;
                object optionOperand    = DBNull.Value;

                if (txtOption.Text.Trim() != string.Empty)
                {
                    optionOperand    = txtOption.Text.Trim();
                    optionOperatorId = ddlOptionOperator.SelectedValue;
                    optionOperator   = OfferService.GetOfferOperator(Convert.ToInt32(optionOperatorId)).Operator;
                }

                int offerActionId = OfferService.GetOfferRuleById(QueryOfferRuleId).Action.Id;

                // Assign action to this rule object's action
                var newAction = new OfferAction
                {
                    Id          = offerActionId,
                    OfferRuleId = QueryOfferRuleId
                };

                if (discountAmount != DBNull.Value)
                {
                    newAction.DiscountAmount = Convert.ToDecimal(discountAmount);
                }
                if (freeProductItself != DBNull.Value)
                {
                    newAction.FreeProductItself = Convert.ToBoolean(freeProductItself);
                }
                if (freeProductId != DBNull.Value)
                {
                    newAction.FreeProductId = Convert.ToInt32(freeProductId);
                }
                if (freeProductPriceId != DBNull.Value)
                {
                    newAction.FreeProductPriceId = Convert.ToInt32(freeProductPriceId);
                }
                if (freeProductQty != DBNull.Value)
                {
                    newAction.FreeProductQty = Convert.ToInt32(freeProductQty);
                }
                newAction.OfferActionAttributeId = Convert.ToInt32(ddlAction.SelectedValue);
                newAction.Name   = ddlAction.SelectedItem.Text;
                newAction.IsCart = true;
                if (discountQtyStep != DBNull.Value)
                {
                    newAction.DiscountQtyStep = Convert.ToInt32(discountQtyStep);
                }
                if (minimumAmount != DBNull.Value)
                {
                    newAction.MinimumAmount = Convert.ToDecimal(minimumAmount);
                }
                newAction.RewardPoint = rewardPoint;
                if (optionOperatorId != DBNull.Value)
                {
                    newAction.OptionOperatorId = Convert.ToInt32(optionOperatorId);
                }
                if (optionOperand != DBNull.Value)
                {
                    newAction.OptionOperand = Convert.ToString(optionOperand);
                }

                if ((optionOperator != DBNull.Value) && (optionOperatorId != DBNull.Value))
                {
                    newAction.OptionOperator = new OfferOperator {
                        Id       = Convert.ToInt32(optionOperatorId),
                        Operator = Convert.ToString(optionOperator)
                    }
                }
                ;

                newAction.XValue = Convert.ToInt32(txtXValue.Text.Trim());
                newAction.YValue = Convert.ToDecimal(txtYValue.Text.Trim());

                rule.Action = newAction;

                var proceed = true;

                // Assign root condition to this rule object's condition
                rule.Condition = OfferUtility.OfferRuleConditions[rule.Id];

                if (rule.Condition == null)
                {
                    enbNotice.Message = "Offer was failed to update. There is no condition setup for this offer. It could be due to session lost. Please try to create again.";
                    proceed           = false;
                }

                // Assign root condition to this action object's condition
                rule.Action.Condition = OfferUtility.OfferActionConditions[rule.Id];

                if (rule.Action.Condition == null)
                {
                    enbNotice.Message = "Offer was failed to update. There is no <u>action</u> condition setup for this offer. It could be due to session lost. Please try to create again.";
                    proceed           = false;
                }

                if (proceed)
                {
                    // Update database
                    var success = OfferService.ProcessOfferUpdation(rule);

                    if (success)
                    {
                        enbNotice.Message = "Offer was updated successfully.";
                    }
                    else
                    {
                        enbNotice.Message = "Offer was failed to update.";
                    }
                }

                LoadCartOfferInfo();
            }
        }
        protected void lbSaveBrandCategory_Click(object sender, EventArgs e)
        {
            string urlKey = txtUrlKey.Text.Trim();

            txtUrlKey.BackColor = Color.Empty;

            // If url key is empty, regenerate with given category name
            if (urlKey == string.Empty)
            {
                urlKey         = AdminStoreUtility.GetFriendlyUrlKey(txtName.Text.Trim());
                txtUrlKey.Text = urlKey;
            }

            // Make sure url key is unique
            if (((GetStringState(MODE) == NEW) && (BrandService.GetBrandCategoryByUrlKey(urlKey) != null)) ||
                ((GetStringState(MODE) == EDIT) && (BrandService.GetBrandCategoryByUrlKey(urlKey) != null) && (BrandService.GetBrandCategoryByUrlKey(urlKey).Id != GetIntState(BRAND_CATEGORY_ID))))
            {
                enbNotice.Message = "Url key is not unique.";
            }
            else
            {
                string thumbnailFilename = string.Empty;

                if (fuThumbnail.HasFile)
                {
                    thumbnailFilename = txtUrlKey.Text.Trim() + Path.GetExtension(fuThumbnail.FileName).ToLower();
                    fuThumbnail.SaveAs(MediaSettings.BrandMediaLocalPath + thumbnailFilename);
                }
                else
                {
                    if (!cbRemoveThumb.Checked)
                    {
                        BrandCategory category = BrandService.GetBrandCategoryByUrlKey(urlKey);

                        if (category != null)
                        {
                            thumbnailFilename = category.ImageUrl;
                        }
                    }
                }

                BrandCategory brandCategory = new BrandCategory();
                brandCategory.Name        = Server.HtmlEncode(txtName.Text.Trim());
                brandCategory.BrandId     = QueryBrandId;
                brandCategory.Description = Server.HtmlEncode(txtDesc.Text.Trim());
                brandCategory.ImageUrl    = thumbnailFilename;
                brandCategory.UrlRewrite  = txtUrlKey.Text.Trim();
                brandCategory.Visible     = cbVisible.Checked;

                if (!string.IsNullOrEmpty(hfParent.Value))
                {
                    brandCategory.ParentId = Convert.ToInt32(hfParent.Value);
                }

                if (GetStringState(MODE) == NEW)
                {
                    if (string.IsNullOrEmpty(hfParent.Value))
                    {
                        brandCategory.ParentId = AppConstant.DEFAULT_BRAND_CATEGORY;
                    }

                    brandCategory.Id = BrandService.InsertBrandCategory(brandCategory);
                }
                else // Edit mode
                {
                    brandCategory.Id = GetIntState(LAST_CHOSEN_BRAND_CATEGORY);
                    BrandService.UpdateBrandCategory(brandCategory);
                }

                ectBrandCategory.Repopulate();

                var treeList = BrandService.GetBrandCategoryTreeList(brandCategory.Id);
                ectBrandCategory.FindSelectedNode(AppConstant.DEFAULT_BRAND_CATEGORY, treeList);

                PopulateBrandCategoryInfo(brandCategory.Id);

                enbNotice.Message = "Brand category was saved successfully.";
            }

            cbRemoveThumb.Checked = false;

            ChosenProducts.Clear();
            NotChosenProducts.Clear();
            LoadProducts();
        }