private void Save() { // save to database DB.Open(); DB.BeginTransaction(); try { SupportTicketCategoryAddNew supportTicketCategoryAddNew = new SupportTicketCategoryAddNew(supportTicketCategoriesAddTDS); supportTicketCategoryAddNew.Save(); // Store datasets supportTicketCategoriesAddTDS.AcceptChanges(); Session["supportTicketCategoriesAddTDS"] = supportTicketCategoriesAddTDS; DB.CommitTransaction(); } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private bool StepSummaryFinish() { if (Page.IsValid) { int companyId = Convert.ToInt32(Session["companyID"]); int? categoryId = null; foreach (int categoryIdInArray in arrayCategoriesSelected) { categoryId = categoryIdInArray; } if (rbtnAddCategory.Checked) { SupportTicketCategoryAddNew supportTicketCategoryAddNew = new SupportTicketCategoryAddNew(supportTicketCategoriesAddTDS); supportTicketCategoryAddNew.Insert(null, null, tbxName.Text.Trim(), categoryId, false, companyId, false); } if (rbtnEditCategory.Checked) { SupportTicketCategoryAddNew supportTicketCategoryAddNew = new SupportTicketCategoryAddNew(supportTicketCategoriesAddTDS); supportTicketCategoryAddNew.Insert(categoryId, null, tbxName.Text.Trim(), null, false, companyId, true); } if (rbtnDeleteCategory.Checked) { int? newCategoryId = null; if (arrayCategoriesSelected2.Count > 0) { foreach (int categoryId2 in arrayCategoriesSelected2) { newCategoryId = categoryId2; } } SupportTicketCategoryAddNew supportTicketCategoryAddNew = new SupportTicketCategoryAddNew(supportTicketCategoriesAddTDS); supportTicketCategoryAddNew.Insert(categoryId, newCategoryId, tbxName.Text.Trim(), null, true, companyId, true); } // Store database Session["supportTicketCategoriesAddTDS"] = supportTicketCategoriesAddTDS; Save(); hdfUpdate.Value = "yes"; return true; } else { return false; } }
protected void Wizard_NextButtonClick(object sender, WizardNavigationEventArgs e) { switch (wzCategoriesAdd.ActiveStep.Name) { case "Operation": e.Cancel = !StepOperationNext(); if (!e.Cancel) { ViewState["StepFrom"] = "Operation"; } break; case "Categories": e.Cancel = !StepCategoriesNext(); if (!e.Cancel) { ViewState["StepFrom"] = "Categories"; if (rbtnDeleteCategory.Checked) { foreach (int categoryId in arrayCategoriesSelected) { SupportTicketCategoryAddNew supportTicketCategoryAddNew = new SupportTicketCategoryAddNew(null); } wzCategoriesAdd.ActiveStepIndex = wzCategoriesAdd.WizardSteps.IndexOf(StepWarning); } else { wzCategoriesAdd.ActiveStepIndex = wzCategoriesAdd.WizardSteps.IndexOf(StepSummary); } } break; case "Warning": e.Cancel = !StepWarningNext(); if (!e.Cancel) { ViewState["StepFrom"] = "Warning"; } break; case "Category to replace": e.Cancel = !StepCategories2Next(); if (!e.Cancel) { ViewState["StepFrom"] = "Categories2"; } break; default: throw new Exception("Not exists the option for " + wzCategoriesAdd.ActiveStep.Name + " step in categories_edit.Wizard_NextButtonClick function"); } }