示例#1
0
        protected void btnAddSubcategory_Click(object sender, EventArgs e)
        {
            string parentCategory = ddlCategory.SelectedValue;
            int    parentCategoryId;

            if (int.TryParse(parentCategory, out parentCategoryId))
            {
                bool subcategoryAdded = ProductHelper.AddSubcategory(parentCategoryId, Membership.GetUser().UserName, txtSubcategory.Text, txtSubCategorySeoTitle.Text, txtSubCategorySeoDescription.Text, txtSubCategorySeoMetaKeywords.Text);
                if (subcategoryAdded)
                {
                    lblSubCategoryStatus.Text      = "Subcategory Added Successfully";
                    lblSubCategoryStatus.ForeColor = System.Drawing.Color.Green;
                }
                else
                {
                    lblSubCategoryStatus.Text      = "Subcategory Addition Failed";
                    lblSubCategoryStatus.ForeColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                lblSubCategoryStatus.Text      = "Parent Category Id couldn't be parsed";
                lblSubCategoryStatus.ForeColor = System.Drawing.Color.Red;
            }
        }