protected void Page_Load(object sender, System.EventArgs e) { //If no site_id was passed, then redirect back to the homepage string site_id = Request.QueryString["site_id"]; if (!string.IsNullOrEmpty(site_id)) { SiteID = Convert.ToInt32(site_id); } else { Response.Redirect(Config.SIMSURL + "SIMSWSCHome.aspx"); } //Using the passed site_id, setup the SHA data element, and reset the office and wsc to match that of the current site currSHA = db.SHAs.Where(p => p.site_id == SiteID).FirstOrDefault(); OfficeID = (int)currSHA.Site.office_id; WSCID = (int)db.Offices.Where(p => p.office_id == OfficeID).FirstOrDefault().wsc_id; //--BASIC PAGE SETUP-------------------------------------------------------------------- ph1.Title = "Site Hazard Analysis"; ph1.SubTitle = currSHA.Site.site_no + " " + db.vSITEFILEs.FirstOrDefault(s => s.site_no == currSHA.Site.site_no && s.agency_cd == currSHA.Site.agency_cd).station_nm; //Fills out the header information PopulateHeader(); //Fill the page with data PopulateReport(); }
protected void Page_Load(object sender, System.EventArgs e) { //If no site_id was passed, then redirect back to the homepage string site_id = Request.QueryString["site_id"]; if (!string.IsNullOrEmpty(site_id)) { SiteID = Convert.ToInt32(site_id); } else { Response.Redirect(Config.SIMSURL + "SIMSWSCHome.aspx"); } //Using the passed site_id, setup the site data element, and reset the office and wsc to match that of the current site currSHA = db.SHAs.Where(p => p.site_id == SiteID).FirstOrDefault(); OfficeID = (int)currSHA.Site.office_id; WSCID = (int)db.Offices.Where(p => p.office_id == OfficeID).FirstOrDefault().wsc_id; //--BASIC PAGE SETUP-------------------------------------------------------------------- Response.Cache.SetCacheability(HttpCacheability.NoCache); ph1.Title = "Manage Site Hazard Analysis"; ph1.SubTitle = currSHA.Site.site_no + " " + db.vSITEFILEs.FirstOrDefault(s => s.site_no == currSHA.Site.site_no && s.agency_cd == currSHA.Site.agency_cd).station_nm; if (!Page.IsPostBack) { //Clear session state variable Session["btnpressed"] = ""; //--PAGE ACCESS SECTION------------------------------------------------------------- if (user.IsSuperUser || user.WSCID.Contains(WSCID)) { pnlHasAccess.Visible = true; } else { Response.Redirect("SHAView.aspx?site_id=" + SiteID.ToString()); pnlHasAccess.Visible = false; } //--END PAGE ACCESS SECTION--------------------------------------------------------- hlPrintSHA.NavigateUrl = "SHAView.aspx?site_id=" + SiteID.ToString(); PopulatePagePanels(); } //-------------------------------------------------------------------------------------- //Moved out of PopulatePagePanels routine for AJAX to work SetupMeasurementSpecificPanel(); }
public void ProcessRequest(HttpContext context) { int site_id = Convert.ToInt32(context.Request.QueryString["site_id"]); Data.SHA sha = new Data.SHA() { site_id = site_id, reviewed_by = user.ID, reviewed_dt = DateTime.Now }; db.SHAs.InsertOnSubmit(sha); db.SubmitChanges(); context.Response.Redirect(String.Format("{0}SHAView.aspx?site_id={1}", Config.SafetyURL, site_id)); }