/// <summary> /// Save /// </summary> public void Save() { foreach (SupportTicketCategoriesAddTDS.CategoriesAddNewRow row in (SupportTicketCategoriesAddTDS.CategoriesAddNewDataTable)Data.Tables["CategoriesAddNew"]) { // Insert category if ((!row.Deleted) && (!row.InDatabase)) { int? parentId = null; if (!row.IsParentIDNull()) parentId = row.ParentID; SupportTicketCategory categories = new SupportTicketCategory(null); categories.InsertDirect(row.Name, parentId, row.Deleted, row.COMPANY_ID); } // Update category if ((!row.Deleted) && (row.InDatabase)) { int companyId = row.COMPANY_ID; SupportTicketCategoryGateway supportTicketcategoryGateway = new SupportTicketCategoryGateway(); supportTicketcategoryGateway.LoadByCategoryId(row.CategoryID, companyId); int categoryId = row.CategoryID; string originalName = supportTicketcategoryGateway.GetName(categoryId); int? originalParentId = null; if (supportTicketcategoryGateway.GetParentId(categoryId).HasValue) originalParentId = (int)supportTicketcategoryGateway.GetParentId(categoryId); SupportTicketCategory category = new SupportTicketCategory(null); category.UpdateDirect(categoryId, originalName, originalParentId, row.Deleted, companyId, row.CategoryID, row.Name, originalParentId, row.Deleted, companyId); } // Delete category if ((row.Deleted) && (row.InDatabase)) { int categoryId = row.CategoryID; int? newCategoryId = null; if (!row.IsNewCategoryIDNull()) newCategoryId = row.NewCategoryID; int companyId = row.COMPANY_ID; SupportTicketCategory category = new SupportTicketCategory(null); category.DeletedDirect(categoryId, companyId); } } }
// //////////////////////////////////////////////////////////////////////// // INITIAL EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_ITTST_SUPPORTTICKET_ADMIN"]))) { if (!(Convert.ToBoolean(Session["sgLFS_ITTST_SUPPORTTICKET_VIEW"]))) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } } // Validate query string if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["dashboard"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in supportTicket_add.aspx"); } // Tag Page TagPage(); // Initialize viewstate variables ViewState["StepFrom"] = "Out"; Session.Remove("supportTicketAddTDS"); arrayCategoriesSelectedForAdd = new ArrayList(); Session["arrayCategoriesSelectedForAdd"] = arrayCategoriesSelectedForAdd; // If coming from // ... supportTicket_navigator.aspx, supportTicket_navigator2.aspx, supportTicket_summary.aspx or wucSRUnassigned.ascx if ((Request.QueryString["source_page"] == "supportTicket_navigator.aspx") || (Request.QueryString["source_page"] == "supportTicket_navigator2.aspx") || (Request.QueryString["source_page"] == "supportTicket_summary.aspx") || (Request.QueryString["source_page"] == "wucSRUnassigned.ascx") || (Request.QueryString["source_page"] == "wucAlarms.ascx.cs")) { // ... Initialize tables supportTicketAddTDS = new SupportTicketAddTDS(); // ... For Categories supportTicketCategoriesTDS = new SupportTicketCategoriesTDS(); SupportTicketCategory supportTicketCategory = new SupportTicketCategory(supportTicketCategoriesTDS); supportTicketCategory.Load(int.Parse(hdfCompanyId.Value)); // ... Store tables Session["supportTicketAddTDS"] = supportTicketAddTDS; Session["supportTicketCategoriesTDS"] = supportTicketCategoriesTDS; } // StepSection1In wzSupportTicket.ActiveStepIndex = 0; StepBeginIn(); } else { // Restore tables arrayCategoriesSelectedForAdd = (ArrayList)Session["arrayCategoriesSelectedForAdd"]; supportTicketAddTDS = (SupportTicketAddTDS)Session["supportTicketAddTDS"]; supportTicketCategoriesTDS = (SupportTicketCategoriesTDS)Session["supportTicketCategoriesTDS"]; } }
// //////////////////////////////////////////////////////////////////////// // INITIAL EVENTS // protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); hdfUpdate.Value = "no"; // Initialize viewstate variables ViewState["StepFrom"] = "Out"; // Prepare initial data // ... Remove sessions Session.Remove("arrayCategoriesSelected"); Session.Remove("arrayCategoriesSelected2"); supportTicketCategoriesAddTDS = new SupportTicketCategoriesAddTDS(); Session["supportTicketCategoriesAddTDS"] = supportTicketCategoriesAddTDS; Session["categoriesAddNew"] = supportTicketCategoriesAddTDS.CategoriesAddNew; // ... for Categories supportTicketCategoriesTDS = new SupportTicketCategoriesTDS(); SupportTicketCategory supportTicketCategory = new SupportTicketCategory(supportTicketCategoriesTDS); supportTicketCategory.Load(int.Parse(hdfCompanyId.Value)); Session["supportTicketCategoriesTDSForEdit"] = supportTicketCategoriesTDS; GetNodeForCategory(tvCategoriesRoot.Nodes, 0); GetNodeForCategory(tvCategoriesRoot2.Nodes, 0); arrayCategoriesSelected = new ArrayList(); arrayCategoriesSelected2 = new ArrayList(); Session["arrayCategoriesSelected"] = arrayCategoriesSelected; Session["arrayCategoriesSelected2"] = arrayCategoriesSelected2; wzCategoriesAdd.ActiveStepIndex = 0; StepOperationIn(); } else { // Restore tables supportTicketCategoriesTDS = (SupportTicketCategoriesTDS)Session["supportTicketCategoriesTDSForEdit"]; supportTicketCategoriesAddTDS = (SupportTicketCategoriesAddTDS)Session["supportTicketCategoriesAddTDS"]; arrayCategoriesSelected = (ArrayList)Session["arrayCategoriesSelected"]; arrayCategoriesSelected2 = (ArrayList)Session["arrayCategoriesSelected2"]; } }