protected void Page_Load(object sender, EventArgs e) { if (Session["securityID"] == null) // Redirects to login if not logged in { Response.Redirect("~/Admin/Login.aspx"); } else if ((int)Session["securityID"] != 2) // Return HTTP Code 403 { Context.Response.StatusCode = 403; } // Catches the initial site ID when the page loads from the SideDropDownList and displays Active units Listview for that site. if (!IsPostBack) { seeArchive = false; SiteDropDownList.DataBind(); SelectedSiteID.Text = SiteDropDownList.SelectedValue; if (SelectedSiteID == null) { throw new Exception("Select an existsing Site"); } else { UnitsListView.Visible = true; UnitsListView.DataBind(); } } }
/// <summary> /// Resets all parameters. Used on first time page load or when user wants to clear everything /// </summary> private void resetParameters() { //Clear all Text Fields clearTextFields(); //Local Time format txtParamDTEnd.Text = DateTime.Now.AddMinutes(-1).ToString("yyyy-MM-dd HH:mm:ss"); //Rebuild the dictionaries clearDictionaries(); buildDictionaries(); //Clear the ListView and rebuild it. ListView_Alarms.DataSource = ""; ListView_Alarms.DataBind(); List <String> siteList = new List <string>(); foreach (SiteStructure site in SiteFactory.getSiteList()) { if (!siteList.Contains(site.siteName)) { siteList.Add(site.siteName); } } //Add the filters foreach (KeyValuePair <string, string> filter in SiteFactory.getFilters()) { siteList.Add(filter.Key); } siteList.Sort(); //Rebind the siteList to the dropdown list SiteDropDownList.DataSource = siteList; //Set the txtParamLogList textfield to the first item in the siteList txtParamLogList.Text = siteList[0]; SiteDropDownList.DataBind(); }