/// //////////////////////////////////////////////////////////////////////// /// 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 /// // // Page_Load // 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"); } //--- If coming from navigator2.aspx or view_fulllength.aspx if (((string)Request.QueryString["source_page"] == "navigator2.aspx") || ((string)Request.QueryString["source_page"] == "view_fulllength.aspx")) { //--- Get lfs master area record LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId((Guid)Session["lfsMasterAreaId"], Convert.ToInt32(Session["companyID"])); hdfId.Value = ((Guid)Session["lfsMasterAreaId"]).ToString(); //--- Store datasets Session["tdsLfsRecord"] = tdsLfsRecord; } //--- If coming from view_fulllength_m1.aspx, view_fulllength_m2.aspx, or delete_record.aspx if (((string)Request.QueryString["source_page"] == "view_fulllength_m1.aspx") || ((string)Request.QueryString["source_page"] == "view_fulllength_m2.aspx") || ((string)Request.QueryString["record_deleted"] == "false")) { //--- Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; } //--- 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"]; } }
/// //////////////////////////////////////////////////////////////////////// /// 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 /// // // Page_Load // 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_DELETE"]))) { Response.Redirect("./../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } //--- Validate query string if ((Request.QueryString["source_page"] == null)) { Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in delete_record.aspx"); } //--- If coming from navigator2.aspx if ((string)Request.QueryString["source_page"] == "navigator2.aspx") { //--- Get lfs master area record LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId((Guid)Session["lfsMasterAreaId"], Convert.ToInt32(Session["companyID"])); } else { //--- Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; } //--- Store datasets Session["tdsLfsRecord"] = tdsLfsRecord; //--- Databind Page.DataBind(); } else { //--- Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; } }
// // AutofillLinerOrdered // private void AutofillLinerOrdered() { //--- Initialize TDSLFSRecord currentTdsLfsRecord = new TDSLFSRecord(); // holds the current record being autofilled TDSLFSRecord allTdsLfsRecord = new TDSLFSRecord(); // holds all the records autofilled so far string currentId; // holds the current id being autofilled string lastId = ""; // holds the last id autofilled so far LFSRecordForReportsGateway lfsRecordForReportsGateway = new LFSRecordForReportsGateway(); LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); //--- Autofill LinerOrdered //--- ... Get the jliners to be autofilled TDSJLinersToBuild tdsJLinersToBuild = lfsRecordForReportsGateway.GetJLinersToBuildByCompanyId(Convert.ToInt32(Session["companyID"])); foreach (TDSJLinersToBuild.JLinersToBuildRow jLinersToBuildRow in tdsJLinersToBuild.JLinersToBuild) { currentId = jLinersToBuildRow.ID; if (currentId != lastId) { //--- ... Get the lfs record corresponding to the jliner to be autofilled currentTdsLfsRecord.Clear(); currentTdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId(new Guid(currentId), Convert.ToInt32(Session["companyID"])); //--- ... Autofill the jliners DataView dataView = new DataView(tdsJLinersToBuild.JLinersToBuild, "ID='" + currentId + "'", "", DataViewRowState.CurrentRows); foreach (DataRowView row in dataView) { TDSLFSRecord.LFS_JUNCTION_LINERRow currentLfsJunctionLinerRow = currentTdsLfsRecord.LFS_JUNCTION_LINER.FindByIDRefIDCOMPANY_ID(new Guid((string)row["ID"]), (int)row["RefID"], (int)row["COMPANY_ID"]); currentLfsJunctionLinerRow.LinerOrdered = true; } allTdsLfsRecord.Merge(currentTdsLfsRecord); lastId = currentId; } } //--- Update database try { lfsRecordGateway.UpdateRecord(allTdsLfsRecord); } catch(Exception ex) { Response.Redirect("./../error_page.aspx?error=" + ex.Message); } }
/// //////////////////////////////////////////////////////////////////////// /// 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_jlinersheet.aspx"); } // Prepare initial data Session.Remove("jlinerDummy"); lblMaxNumber.Visible = false; // If coming from navigator2.aspx or view_jlinersheet.aspx if (((string)Request.QueryString["source_page"] == "navigator2.aspx") || ((string)Request.QueryString["source_page"] == "view_jlinersheet.aspx")) { //... Get lfs master area record LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); viewJLinersheetTDS = new ViewJLinersheetTDS(); ViewJLinersheetJunctionLinerGateway viewJLinersheetJunctionLinerGateway = new ViewJLinersheetJunctionLinerGateway(viewJLinersheetTDS); viewJLinersheetJunctionLinerGateway.LoadById((Guid)Session["lfsMasterAreaId"], Convert.ToInt32(Session["companyID"])); tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId((Guid)Session["lfsMasterAreaId"], Convert.ToInt32(Session["companyID"])); //... Store datasets Session["tdsLfsRecord"] = tdsLfsRecord; Session["viewJLinersheetTDS"] = viewJLinersheetTDS; jliner = viewJLinersheetTDS.JunctionLiner; Session["jliner"] = jliner; } // If coming from delete_record.aspx if ((string)Request.QueryString["record_deleted"] == "false") { //... Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; viewJLinersheetTDS = (ViewJLinersheetTDS)Session["viewJLinersheetTDS"]; } // ... 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(); ddlMainLined.SelectedIndex = (tdsLfsRecord.LFS_MASTER_AREA[0].IsMainLinedNull()) ? 2 : ((tdsLfsRecord.LFS_MASTER_AREA[0].MainLined == "Yes") ? 0 : 1); ddlBenchingIssue.SelectedIndex = (tdsLfsRecord.LFS_MASTER_AREA[0].IsBenchingIssueNull()) ? 2 : ((tdsLfsRecord.LFS_MASTER_AREA[0].BenchingIssue == "Yes") ? 0 : 1); } else { //--- Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; viewJLinersheetTDS = (ViewJLinersheetTDS)Session["viewJLinersheetTDS"]; } }
private void ArchiveRecord(Guid id, int companyId, bool archive) { LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); TDSLFSRecord tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId(id, companyId); //--- Archive record //--- ... Master area TDSLFSRecord.LFS_MASTER_AREARow lfsMasterAreaRow = tdsLfsRecord.LFS_MASTER_AREA.FindByIDCOMPANY_ID(id, companyId); lfsMasterAreaRow.Archived = archive; //--- ... Point repairs foreach (TDSLFSRecord.LFS_POINT_REPAIRSRow lfsPointRepairsRow in tdsLfsRecord.LFS_POINT_REPAIRS) { lfsPointRepairsRow.Archived = archive; } //--- ... M2 tables foreach (TDSLFSRecord.LFS_M2_TABLESRow lfsM2TablesRow in tdsLfsRecord.LFS_M2_TABLES) { lfsM2TablesRow.Archived = archive; } //--- ... Point repairs foreach (TDSLFSRecord.LFS_JUNCTION_LINERRow lfsJunctionLinerRow in tdsLfsRecord.LFS_JUNCTION_LINER) { lfsJunctionLinerRow.Archived = archive; } //--- Update database try { lfsRecordGateway.UpdateRecord(tdsLfsRecord); } catch(Exception ex) { Response.Redirect("./../error_page.aspx?error=" + ex.Message); } }