protected void Page_Load(object sender, EventArgs e) { //validates that the user is logged in if (Session["User"] != null) { User user = (User)Session["User"]; userLbl.Text = user.FullName; if (user.RoleId == 4) { AdminBtn.Visible = true; } if (user.RoleId == 1) { CreateClientProjectList(user.CompanyId); CreateNewProjectBtn.Visible = false; } else if (user.RoleId == 2) { CreateProjectList(user.UserId); } else if (user.RoleId == 4 || user.RoleId == 3) { CreateAdminProjectList(); } //loads the selected form if there is one if (Request.QueryString["pid"] != null) { projectListing.Visible = false; int projId = int.Parse(Request.QueryString["pid"]); Project p = ProjectUtil.GetProject(projId); if (Request.QueryString["del"] != null && user.RoleId > 1) { ProjectUtil.DeleteProject(projId); ReloadSection(); } //if they are trying to edit and they are admin, show project builder else if (Request.QueryString["edit"] != null && user.RoleId > 1) { projectBuilder.Visible = true; GenerateProjectDropdowns(); CreateProjectBtn.Text = "Update Project"; ProjectName.Text = p.Name; CompanySelect.SelectedValue = p.CompanyId.ToString(); CoachSelect.SelectedValue = p.CoachId.ToString(); WorkflowSelect.SelectedValue = p.WorkflowId.ToString(); WorkflowSelect.Visible = false; ProjectNotes.Text = p.Notes; } //otherwise just show the project viewer else { projectViewer.Visible = true; if (user.RoleId > 1) { if (ProjectUtil.CheckProjectCompletion(projId)) { ProjectFileDownloader.Visible = true; } } ProjectView(p); } } //if theyre an admin and trying to make a new project else if (Request.QueryString["edit"] != null && Request.QueryString["pid"] == null && user.RoleId > 1) { projectListing.Visible = false; projectBuilder.Visible = true; GenerateProjectDropdowns(); } } else { Response.Redirect("Login.aspx"); } }