protected void Page_Load(object sender, EventArgs e) { checkPermissions(); //get requested action - default to adding string actionIndicator = Request.QueryString["action"]; if (actionIndicator == null || actionIndicator.Equals("")) { action = Utility.Action.Add; } else { action = (Utility.Action)Convert.ToInt32(actionIndicator); } //clear session variables if (!Page.IsPostBack) { Session[studentSearch] = null; Session[studentVar] = null; loadYearDropdown(); initializePage(); } //if an audition object has been instantiated, reload if (Page.IsPostBack && Session[studentVar] != null) { student = (Student)Session[studentVar]; } }
/* * Pre: * Post: The action being performed is initialized. Defaulted to Add */ private void initializeAction() { string actionIndicator = Request.QueryString["action"]; if (actionIndicator == null || actionIndicator.Equals("")) { action = Utility.Action.Add; } else { action = (Utility.Action)Convert.ToInt32(actionIndicator); } }
/* * Pre: * Post: Initialize the page for adding, editing, or deleting based on user selection */ protected void initializePage() { // Get the action based on whether we should add or edit // If before June and an audition exists for the current year, edit // If before June and no audition exists for the current year, add // If June or later and an audition exists for the next year, edit // If before June and no audition exists for the next year, add //int year = DateTime.Today.Year; //if (DateTime.Today.Month >= 6) year = year + 1; //// Look at current year no matter what if on the test site //if (Utility.reportSuffix.Equals("Test")) //delete this // year = DateTime.Today.Year; //get requested action - default to adding string actionIndicator = Request.QueryString["action"]; if (actionIndicator == null || actionIndicator.Equals("")) { action = Utility.Action.Add; } else { action = (Utility.Action)Convert.ToInt32(actionIndicator); } //initialize page based on action if (action == Utility.Action.Add) { upAuditionSearch.Visible = false; pnlButtons.Visible = true; pnlMain.Visible = true; } else if (action == Utility.Action.Edit) { upAuditionSearch.Visible = true; legend.InnerText = "Edit District Event"; } //else if (action == Utility.Action.Delete) //{ // upAuditionSearch.Visible = true; // legend.InnerText = "Delete District Event"; // disableControls(); // btnSubmit.Attributes.Add("onclick", "return confirm('Are you sure that you wish to permanently delete this event and all associated data?');"); //} }
/* * Pre: * Post Initialize the page based on the user's selected action */ protected void initializePage() { //get requested action - default to adding string actionIndicator = Request.QueryString["action"]; User user = (User)Session[Utility.userRole]; if (actionIndicator == null || actionIndicator.Equals("")) { action = Utility.Action.Add; } else { action = (Utility.Action)Convert.ToInt32(actionIndicator); } //initialize page based on action if (action == Utility.Action.Add) { legend.InnerText = "Add Composition"; pnlTitleEdit.Visible = false; pnlTitleNew.Visible = true; lblSearchNote.Visible = true; pnlCompositionId.Visible = false; } else if (action == Utility.Action.Edit && (user.permissionLevel.Contains("A") || user.permissionLevel.Contains("C"))) { legend.InnerText = "Edit Composition"; pnlTitleEdit.Visible = true; pnlTitleNew.Visible = false; lblSearchNote.Visible = false; } else if (action == Utility.Action.Delete && (user.permissionLevel.Contains("A") || user.permissionLevel.Contains("C"))) { legend.InnerText = "Delete Composition - not implemented"; pnlTitleEdit.Visible = true; pnlTitleNew.Visible = false; lblSearchNote.Visible = false; disableControls(); } else { Response.Redirect("/Default.aspx"); } }