private void btnDelete_Click(object sender, EventArgs e) { BPDocumentCategories bp = new BPDocumentCategories(); BEDocumentCategories.tbl_DocumentCategoriesRow DocumentCategory; DSDocumentCategories = bp.SelectDocumentCategoryByID(DocumentCategoryID); DocumentCategory = DSDocumentCategories.tbl_DocumentCategories.FindByDocumentCategoryID(DocumentCategoryID); DocumentCategory.Delete(); bp.Update(DSDocumentCategories); bp.UpdateByDocumentCategoryID(DocumentCategoryID); Response.Redirect("BrowseDocumentCategories.aspx"); }
private void btnSubmit_ServerClick(object sender, EventArgs e) { BPDocumentCategories bp = new BPDocumentCategories(); BEDocumentCategories.tbl_DocumentCategoriesRow category; DSDocumentCategories = new BEDocumentCategories(); //if they are making this category inactive make all items below this category unassigned and inactive if (DocumentCategoryID > 0) { bool wasActive = GetDocumentCategoryActiveStatus(DocumentCategoryID); if ((wasActive) && (! chkDocumentCategoryActive.Checked)) { bp.UpdateByDocumentCategoryID(DocumentCategoryID); } } if (DocumentCategoryID == 0) { // Add a Document Category category = DSDocumentCategories.tbl_DocumentCategories.Newtbl_DocumentCategoriesRow(); } else { // Edit a Document Category DSDocumentCategories = bp.SelectDocumentCategoryByID(DocumentCategoryID); category = DSDocumentCategories.tbl_DocumentCategories.FindByDocumentCategoryID(DocumentCategoryID); } //all content to be updated/inserted between here category.DocumentCategoryName = txtDocumentCategoryName.Text; category.DocumentCategoryDescription = txtDocumentCategoryDescription.Text; category.DocumentCategoryActive = chkDocumentCategoryActive.Checked; category.DateModified = DateTime.Now; category.ModifiedByAdminID = Convert.ToInt32(OryxUser.OryxIdentity.MemberID); //all content to be updated/inserted between here if (DocumentCategoryID == 0) { //Add new Document Category category.DocumentCategoryOrder = bp.GetDocumentCategoryMaxOrder(); category.DateCreated = DateTime.Now; DSDocumentCategories.tbl_DocumentCategories.Addtbl_DocumentCategoriesRow(category); } bp.Update(DSDocumentCategories); Response.Redirect("BrowseDocumentCategories.aspx"); }