// //////////////////////////////////////////////////////////////////////// // METHODS // public FullLengthLiningTDS.WetOutCommentsDetailsDataTable GetCommentsNew() { fullLengthLiningWetOutCommentDetails = (FullLengthLiningTDS.WetOutCommentsDetailsDataTable)Session["fullLengthLiningWetOutCommentDetailsDummy"]; if (fullLengthLiningWetOutCommentDetails == null) { fullLengthLiningWetOutCommentDetails = ((FullLengthLiningTDS.WetOutCommentsDetailsDataTable)Session["fullLengthLiningWetOutCommentDetails"]); } return fullLengthLiningWetOutCommentDetails; }
protected void AddCommentsNewEmptyFix(GridView grdComments) { if (grdComments.Rows.Count == 0) { int companyId = Int32.Parse(hdfCompanyId.Value); FullLengthLiningTDS.WetOutCommentsDetailsDataTable dt = new FullLengthLiningTDS.WetOutCommentsDetailsDataTable(); dt.AddWetOutCommentsDetailsRow(-1, -1, "", "", -1, DateTime.Now, "", -1, false, companyId, false, "", ""); Session["fullLengthLiningWetOutCommentDetailsDummy"] = dt; grdComments.DataBind(); } // Normally executes at all postbacks if (grdComments.Rows.Count == 1) { FullLengthLiningTDS.WetOutCommentsDetailsDataTable dt = (FullLengthLiningTDS.WetOutCommentsDetailsDataTable)Session["fullLengthLiningWetOutCommentDetailsDummy"]; 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_FULLLENGTHLINING_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_EDIT"]) && Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_ADD"]))) { 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["work_id"] == null) || ((string)Request.QueryString["asset_id"] == null) && ((string)Request.QueryString["run_details"] == null) && ((string)Request.QueryString["project_id"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in fl_comments_cipp.aspx"); } // Tag Page hdfCompanyId.Value = Session["companyID"].ToString(); hdfLoginId.Value = Convert.ToInt32(Session["loginID"]).ToString(); hdfAdminPermission.Value = Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_ADMIN"]).ToString(); hdfWorkType.Value = "Full Length Lining Wet Out"; hdfWorkId.Value = Request.QueryString["work_id"].ToString(); hdfAssetId.Value = Request.QueryString["asset_id"].ToString(); hdfRunDetail.Value = Request.QueryString["run_details"].ToString(); hdfProjectId.Value = Request.QueryString["project_id"].ToString(); hdfUpdate.Value = "yes"; // ... Names for UserList string workType = hdfWorkType.Value.Trim(); int companyId = Int32.Parse(hdfCompanyId.Value); LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(Convert.ToInt32(hdfLoginId.Value), companyId); hdfCreatedBy.Value = loginGateway.GetLastName(Convert.ToInt32(hdfLoginId.Value), companyId) + " " + loginGateway.GetFirstName(Convert.ToInt32(hdfLoginId.Value), companyId); // Prepare initial data Session.Remove("fullLengthLiningWetOutCommentDetailsDummy"); Session.Remove("fullLengthLiningWetOutCommentDetails"); // If coming from // ... fl_summary.aspx and fl_edit.aspx but not notesCipp if (Request.QueryString["source_page"] == "fl_summary.aspx" || Request.QueryString["source_page"] == "fl_edit.aspx") { StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"]; int flWorkId = Int32.Parse(hdfWorkId.Value.Trim()); // ... If the project has fl works if (flWorkId != 0) { // ... update fl cip comments FullLengthLiningWetOutCommentsDetailsGateway fullLengthLiningWetOutCommentsDetailsGateway = new FullLengthLiningWetOutCommentsDetailsGateway(fullLengthLiningTDS); fullLengthLiningWetOutCommentsDetailsGateway.LoadAllByWorkIdWorkType(flWorkId, companyId, "Full Length Lining Wet Out"); FullLengthLiningWetOutCommentsDetails fullLengthLiningWetOutCommentsDetails = new FullLengthLiningWetOutCommentsDetails(fullLengthLiningWetOutCommentsDetailsGateway.Data); fullLengthLiningWetOutCommentsDetails.UpdateForProcess(); } // ... Store datasets Session["fullLengthLiningTDS"] = fullLengthLiningTDS; Session["fullLengthLiningWetOutCommentDetails"] = fullLengthLiningTDS.WetOutCommentsDetails; } } else { // Restore datasets fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"]; fullLengthLiningWetOutCommentDetails = fullLengthLiningTDS.WetOutCommentsDetails; // Store Session["fullLengthLiningWetOutCommentDetails"] = fullLengthLiningTDS.WetOutCommentsDetails; } }