public PointRepairsTDS.CommentDetailsDataTable GetCommentsNew() { pointRepairsCommentsTemp = (PointRepairsTDS.CommentDetailsDataTable)Session["pointRepairsCommentsTempDummy"]; if (pointRepairsCommentsTemp == null) { pointRepairsCommentsTemp = ((PointRepairsTDS)Session["pointRepairsTDS"]).CommentDetails; } return pointRepairsCommentsTemp; }
protected void AddCommentsNewEmptyFix(GridView grdView) { if (grdComments.Rows.Count == 0) { int companyId = Int32.Parse(hdfCompanyId.Value); PointRepairsTDS.CommentDetailsDataTable dt = new PointRepairsTDS.CommentDetailsDataTable(); dt.AddCommentDetailsRow(-1, -1, "", "", -1, DateTime.Now, "", -1, false, companyId, false, ""); Session["pointRepairsCommentsTempDummy"] = dt; grdComments.DataBind(); } // normally executes at all postbacks if (grdComments.Rows.Count == 1) { PointRepairsTDS.CommentDetailsDataTable dt = (PointRepairsTDS.CommentDetailsDataTable)Session["pointRepairsCommentsTempDummy"]; if (dt != null) { grdComments.Rows[0].Visible = false; grdComments.Rows[0].Controls.Clear(); } } }
// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_CWP_POINTREPAIRS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_POINTREPAIRS_EDIT"]))) { 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["client_id"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["asset_id"] == null) || ((string)Request.QueryString["active_tab"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in pr_summary.aspx"); } // Tag Page TagPage(); // If coming from int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString()); int assetId = Int32.Parse(hdfAssetId.Value.Trim()); int workId = Int32.Parse(hdfWorkId.Value); Session.Remove("pointRepairsRepairsTempDummy"); Session.Remove("pointRepairsCommentsTempDummy"); // ... pr_navigator2.aspx if (Request.QueryString["source_page"] == "pr_navigator2.aspx") { StoreNavigatorState(); ViewState["update"] = "no"; // ... Set initial tab if ((string)Session["dialogOpenedPr"] != "1") { hdfActiveTab.Value = Request.QueryString["active_tab"]; pointRepairsTDS = new PointRepairsTDS(); pointRepairsRepairsTemp = new PointRepairsTDS.RepairDetailsDataTable(); pointRepairsCommentsTemp = new PointRepairsTDS.CommentDetailsDataTable(); PointRepairsSectionDetails pointRepairsSectionDetails = new PointRepairsSectionDetails(pointRepairsTDS); pointRepairsSectionDetails.LoadByWorkId(workId, companyId); PointRepairsWorkDetails pointRepairsWorkDetails = new PointRepairsWorkDetails(pointRepairsTDS); pointRepairsWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId); PointRepairsRepairDetails pointRepairsRepairDetails = new PointRepairsRepairDetails(pointRepairsTDS); pointRepairsRepairDetails.LoadAllByWorkId(workId, companyId); PointRepairsCommentDetails pointRepairsCommentDetails = new PointRepairsCommentDetails(pointRepairsTDS); pointRepairsCommentDetails.LoadAllByWorkIdWorkType(workId, companyId, "Point Repairs"); } else { hdfActiveTab.Value = (string)Session["activeTabPr"]; // Restore datasets pointRepairsTDS = (PointRepairsTDS)Session["pointRepairsTDS"]; pointRepairsRepairsTemp = (PointRepairsTDS.RepairDetailsDataTable)Session["pointRepairsRepairsTemp"]; pointRepairsCommentsTemp = (PointRepairsTDS.CommentDetailsDataTable)Session["pointRepairsCommentsTemp"]; } tcPrDetails.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value); Session["filterExpression"] = "Deleted = 0"; // Store dataset Session["pointRepairsTDS"] = pointRepairsTDS; Session["pointRepairsRepairsTemp"] = pointRepairsRepairsTemp; Session["pointRepairsCommentsTemp"] = pointRepairsCommentsTemp; } // ... pr_delete.aspx or pr_edit.aspx if ((Request.QueryString["source_page"] == "pr_delete.aspx") || (Request.QueryString["source_page"] == "pr_edit.aspx")) { StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; // Restore dataset pointRepairsTDS = (PointRepairsTDS)Session["pointRepairsTDS"]; pointRepairsRepairsTemp = (PointRepairsTDS.RepairDetailsDataTable)Session["pointRepairsRepairsTemp"]; pointRepairsCommentsTemp = (PointRepairsTDS.CommentDetailsDataTable)Session["pointRepairsCommentsTemp"]; // ... Set initial tab if ((string)Session["dialogOpenedPr"] != "1") { hdfActiveTab.Value = Request.QueryString["active_tab"]; } else { hdfActiveTab.Value = (string)Session["activeTabPr"]; } tcPrDetails.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value); ApplyFilter(); switch ((string)Session["filterExpression"]) { case "Deleted = 0": ddlFilter.SelectedIndex = 0; break; case "Type='Robotic Reaming' AND Deleted = 0": ddlFilter.SelectedIndex = 1; break; case "Type='Point Lining' AND Deleted = 0": ddlFilter.SelectedIndex = 2; break; case "Type='Grouting' AND Deleted = 0": ddlFilter.SelectedIndex = 3; break; default: ddlFilter.SelectedIndex = 0; break; } } // Prepare initial data // ... for client int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString()); CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadByCompaniesId(currentClientId, companyId); lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId); // ... for project ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(currentProjectId); string name = projectGateway.GetName(currentProjectId); if (name.Length > 23) name = name.Substring(0, 20) + "..."; lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Selected Section"; // ... Data for current point repairs work LoadPointRepairsData(currentProjectId, assetId, companyId); } else { // Restore datasets pointRepairsTDS = (PointRepairsTDS)Session["pointRepairsTDS"]; pointRepairsRepairsTemp = (PointRepairsTDS.RepairDetailsDataTable)Session["pointRepairsRepairsTemp"]; pointRepairsCommentsTemp = (PointRepairsTDS.CommentDetailsDataTable)Session["pointRepairsCommentsTemp"]; // Set initial tab int activeTab = Int32.Parse(hdfActiveTab.Value); tcPrDetails.ActiveTabIndex = activeTab; ApplyFilter(); } }