private void btnDelete_Click(object sender, EventArgs e) { // BPProducts bpProducts = new BPProducts(); // DSProducts = bpProducts.SelectLockedProductsByProductCategoryID(ProductCategoryID); // if (DSProducts.tbl_Products.Count > 0) // { // pnlLockedError.Visible = true; // } // else // { BPProductCategories bp = new BPProductCategories(); BEProductCategories.tbl_ProductCategoriesRow ProductCategory; DSProductCategories = bp.SelectProductCategoryByID(ProductCategoryID); ProductCategory = DSProductCategories.tbl_ProductCategories.FindByProductCategoryID(ProductCategoryID); ProductCategory.Delete(); bp.Update(DSProductCategories); bp.UpdateByProductCategoryID(ProductCategoryID); Response.Redirect("BrowseProductCategories.aspx"); // } }
private void btnSubmit_ServerClick(object sender, EventArgs e) { BPProductCategories bp = new BPProductCategories(); BEProductCategories.tbl_ProductCategoriesRow category; DSProductCategories = new BEProductCategories(); //if they are making this category inactive make all items below this category unassigned and inactive if (ProductCategoryID > 0) { bool wasActive = GetProductCategoryActiveStatus(ProductCategoryID); if ((wasActive) && (! chkProductCategoryActive.Checked)) { bp.UpdateByProductCategoryID(ProductCategoryID); } } if (ProductCategoryID == 0) { // Add a Product Category category = DSProductCategories.tbl_ProductCategories.Newtbl_ProductCategoriesRow(); } else { // Edit a Product Category DSProductCategories = bp.SelectProductCategoryByID(ProductCategoryID); category = DSProductCategories.tbl_ProductCategories.FindByProductCategoryID(ProductCategoryID); } //all content to be updated/inserted between here Editor ApplicationContent = edtProductCategoryDescription; string strCategoryDescription = Request.Form[ApplicationContent.Editor_HiddenField].ToString(); category.ProductCategoryName = txtProductCategoryName.Text; category.ProductCategoryDescription = strCategoryDescription; category.ProductCategoryActive = chkProductCategoryActive.Checked; category.DateModified = DateTime.Now; category.ModifiedByAdminID = Convert.ToInt32(CarrielUser.CarrielIdentity.MemberID); //all content to be updated/inserted between here if (ProductCategoryID == 0) { //Add new Product Category category.ProductCategoryOrder = bp.GetProductCategoryMaxOrder(); category.DateCreated = DateTime.Now; DSProductCategories.tbl_ProductCategories.Addtbl_ProductCategoriesRow(category); } bp.Update(DSProductCategories); Response.Redirect("BrowseProductCategories.aspx"); }