/// //////////////////////////////////////////////////////////////////////// /// PUBLIC METHODS /// public AddRecordTDS.PointRepairsDataTable GetPointRepairsNew() { pointRepairs = (AddRecordTDS.PointRepairsDataTable)Session["pointRepairDummy"]; if (pointRepairs == null) { pointRepairs = (AddRecordTDS.PointRepairsDataTable)Session["pointRepairs"]; } return pointRepairs; }
protected void AddPointRepairsNewEmptyFix(GridView grdView) { if (grdView.Rows.Count == 0) { AddRecordTDS.PointRepairsDataTable dt = new AddRecordTDS.PointRepairsDataTable(); dt.AddPointRepairsRow(Guid.NewGuid(), -1, -1, "", "", new DateTime(), "", -1, -1, "", "", "", "", "", "", false, false, false, false, false, false, false); Session["pointRepairDummy"] = dt; grdView.DataBind(); } // normally executes at all postbacks if (grdView.Rows.Count == 1) { AddRecordTDS.PointRepairsDataTable dt = (AddRecordTDS.PointRepairsDataTable)Session["pointRepairDummy"]; if (dt != null) { grdView.Rows[0].Visible = false; grdView.Rows[0].Controls.Clear(); } } }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { // Security check if (!Convert.ToBoolean(Session["sgLFS_APP_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["record_deleted"] == null)) { Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in view_fulllength.aspx"); } //... Prepare initial Session.Remove("pointRepairDummy"); addRecordTDS = new AddRecordTDS(); // If coming from navigator2.aspx or view_pointliner.aspx if (((string)Request.QueryString["source_page"] == "navigator2.aspx") || ((string)Request.QueryString["source_page"] == "view_pointliner.aspx")) { int companyId = Convert.ToInt32(Session["companyID"]); Guid id = (Guid)Session["lfsMasterAreaId"]; // Get lfs master area record LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId(id, companyId); AddRecordPointRepairsGateway addRecordPointRepairsGateway = new AddRecordPointRepairsGateway(addRecordTDS); addRecordPointRepairsGateway.LoadById(id, companyId); //... Store datasets Session["tdsLfsRecord"] = tdsLfsRecord; Session["addRecordTDS"] = addRecordTDS; pointRepairs = addRecordTDS.PointRepairs; Session["pointRepairs"] = pointRepairs; } // If coming from delete_record.aspx if ((string)Request.QueryString["record_deleted"] == "false") { //... Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; addRecordTDS = (AddRecordTDS)Session["addRecordTDS"]; } // Prepare initial data for client CompaniesGateway companiesGateway = new CompaniesGateway(); tbxCOMPANIES_ID.Text = companiesGateway.GetName((int)tdsLfsRecord.LFS_MASTER_AREA.Rows[0]["COMPANIES_ID"], Convert.ToInt32(Session["companyID"])); // Databind Page.DataBind(); } else { // Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; addRecordTDS = (AddRecordTDS)Session["addRecordTDS"]; } }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// protected void Page_Load(object sender, System.EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!Convert.ToBoolean(Session["sgLFS_APP_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["record_deleted"] == null)) { Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in view_fulllength.aspx"); } // Prepare initial values Session.Remove("pointRepairDummy"); addRecordTDS = new AddRecordTDS(); // If coming from navigator2.aspx or view_scopesheet.aspx if (((string)Request.QueryString["source_page"] == "navigator2.aspx") || ((string)Request.QueryString["source_page"] == "view_scopesheet.aspx")) { int companyId = Convert.ToInt32(Session["companyID"]); Guid id = (Guid)Session["lfsMasterAreaId"]; //... Get lfs master area record LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId(id, companyId); AddRecordPointRepairsGateway addRecordPointRepairsGateway = new AddRecordPointRepairsGateway(addRecordTDS); addRecordPointRepairsGateway.LoadById(id, companyId); //... Store datasets Session["tdsLfsRecord"] = tdsLfsRecord; Session["addRecordTDS"] = addRecordTDS; pointRepairs = addRecordTDS.PointRepairs; Session["pointRepairs"] = pointRepairs; } // If coming from delete_record.aspx if ((string)Request.QueryString["record_deleted"] == "false") { //... Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; addRecordTDS = (AddRecordTDS)Session["addRecordTDS"]; } // Prepare initial data // ... for client CompaniesGateway companiesGateway = new CompaniesGateway(); tbxCOMPANIES_ID.Text = companiesGateway.GetName((int)tdsLfsRecord.LFS_MASTER_AREA.Rows[0]["COMPANIES_ID"], Convert.ToInt32(Session["companyID"])); // ... for traffic control LFSTrafficControlGateway lfsTrafficControlGateway = new LFSTrafficControlGateway(); DataSet dsLfsTrafficControl = lfsTrafficControlGateway.GetLFSTrafficControlForDropDownList(""); ddlDegreeOfTrafficControl.DataSource = dsLfsTrafficControl; ddlDegreeOfTrafficControl.DataTextField = "TrafficControl"; // Databind Page.DataBind(); TDSLFSRecord.LFS_MASTER_AREARow lfsMasterAreaRow = tdsLfsRecord.LFS_MASTER_AREA.FindByIDCOMPANY_ID(new Guid(tbxID.Text), Convert.ToInt32(Session["companyID"])); ddlDegreeOfTrafficControl.SelectedValue = (lfsMasterAreaRow.IsDegreeOfTrafficControlNull()) ? "" : lfsMasterAreaRow.DegreeOfTrafficControl; } else { // Restore datasets tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; addRecordTDS = (AddRecordTDS)Session["addRecordTDS"]; } }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { //--- Security check if (!(Convert.ToBoolean(Session["sgLFS_APP_VIEW"]) && Convert.ToBoolean(Session["sgLFS_APP_ADD"]))) { Response.Redirect("./../error_page.aspx?error=" + "You are not authorized to add new records. Contact your system administrator."); } //... Add lfs master area record TDSLFSRecord.LFS_MASTER_AREARow lfsMasterAreaRow = tdsLfsRecord.LFS_MASTER_AREA.NewLFS_MASTER_AREARow(); lfsMasterAreaRow.ID = newId; lfsMasterAreaRow.COMPANY_ID = Convert.ToInt32(Session["companyID"]); lfsMasterAreaRow.RecordID = ""; tdsLfsRecord.LFS_MASTER_AREA.AddLFS_MASTER_AREARow(lfsMasterAreaRow); //... Prepare initial Session.Remove("pointRepairDummy"); addRecordTDS = new AddRecordTDS(); lblMaxNumber.Visible = false; //... Store datasets Session["tdsLfsRecord"] = tdsLfsRecord; Session["addRecordTDS"] = addRecordTDS; pointRepairs = addRecordTDS.PointRepairs; Session["pointRepairs"] = pointRepairs; // ... For clients CompaniesGateway companiesGateway = new CompaniesGateway(); DataSet dsCompanies = companiesGateway.GetCompaniesForDropDownList("-1", "", Convert.ToInt32(Session["companyID"])); ddlCOMPANIES_ID.DataSource = dsCompanies; ddlCOMPANIES_ID.DataValueField = "COMPANIES_ID"; ddlCOMPANIES_ID.DataTextField = "NAME"; ddlCOMPANIES_ID.SelectedValue = "-1"; //... Databind ddlCOMPANIES_ID.DataBind(); } else { //... Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; addRecordTDS = (AddRecordTDS)Session["addRecordTDS"]; } }