protected void Page_Load(object sender, 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 if (SiteID == 0) { Response.Redirect(Config.SIMSURL + "SIMSWSCHome.aspx"); } //Set the element_id if it was passed from the browser if (!string.IsNullOrEmpty(Request.QueryString["element_id"])) { element_id = Convert.ToInt32(Request.QueryString["element_id"]); } //Using the passed site_id, setup the site data element, and reset the office and wsc to match that of the current site currSite = db.Sites.Where(p => p.site_id == SiteID).FirstOrDefault(); OfficeID = (int)currSite.office_id; WSCID = (int)db.Offices.Where(p => p.office_id == OfficeID).FirstOrDefault().wsc_id; if (element_id == 0) { ph1.Title = "Retrieve Archived Elements"; } else { ph1.Title = "Archives for " + db.ElementDetails.FirstOrDefault(p => p.element_id == element_id).element_nm; } ph1.SubTitle = currSite.site_no + " " + db.vSITEFILEs.FirstOrDefault(s => s.site_id == currSite.nwisweb_site_id).station_nm; ph1.ShowOfficeInfoPanel = true; if (!Page.IsPostBack) { //If the user belongs to this site's WSC (or has an exception to work in the WSC), or is a SuperUser, then allow them to edit the page if (user.WSCID.Contains(WSCID) || user.IsSuperUser) { HasEditAccess = true; } if (element_id == 0) { gvElementList.DataSource = db.SP_Element_Info_Archives(SiteID).ToList(); gvElementList.DataBind(); pnlStep1.Visible = true; pnlStep2.Visible = false; pnlStep3.Visible = false; } else { ShowArchivedInfo(); pnlStep1.Visible = false; pnlStep2.Visible = false; pnlStep3.Visible = true; lbBack2.Visible = false; lbBack3.Visible = false; } } }