protected void Page_Load(object sender, EventArgs e) { //Check User Authentication Session["AfterLoginRedirectUrl"] = Request.Url.ToString(); ASP.global_asax.Session_Authentication(); Session["AfterLoginRedirectUrl"] = null; BCCAEntities ctx = new BCCAEntities(); var qryLabRecords = ctx.LabInspections.Select(LI => LI).Count(); lblLabRecords.Text = qryLabRecords.ToString(); var qryOfficeRecords = ctx.OfficeInspections.Select(OI => OI).Count(); lblOfficeRecords.Text = qryOfficeRecords.ToString(); var qryCoursesRecords = ctx.TrainingCourses.Select(TC => TC).Count(); lblTrainingCourses.Text = qryCoursesRecords.ToString(); var qryIncidentRecords = ctx.Incidents.Select(I => I).Count(); lblIncidents.Text = qryIncidentRecords.ToString(); var qryDepartments = ctx.Departments.Select(D => D).Count(); lblDepartments.Text = qryDepartments.ToString(); var qryEmployeeRecords = ctx.Employees.Select(E => E).Count(); lblEmployeeRecords.Text = qryEmployeeRecords.ToString(); var qryFollowUpIncident = ctx.Incidents.Where(inc => ((inc.followUpStatus == "0") || (inc.followUpStatus == "1"))).Select(inc => inc).Count(); var qryFollowUpLab = ctx.LabInspections.Where(l => ((l.followUpStatus == "0") || (l.followUpStatus == "1"))).Select(l => l).Count(); var qryFollowUpOffice = ctx.OfficeInspections.Where(o => ((o.followUpStatus == "0") || (o.followUpStatus == "1"))).Select(o => o).Count(); int Incident = Convert.ToInt32(qryFollowUpIncident); int Lab = Convert.ToInt32(qryFollowUpLab); int Office = Convert.ToInt32(qryFollowUpOffice); lblFollowUpNeeded.Text = Convert.ToString(Incident + Lab + Office); }
/// <summary> /// Populates drop down list for Lab Managers /// </summary> /// <param name="sender">not used in our code</param> /// <param name="e">not used in our code</param> protected void Page_Load(object sender, EventArgs e) { //Check User Authentication Session["AfterLoginRedirectUrl"] = Request.Url.ToString(); ASP.global_asax.Session_Authentication(); Session["AfterLoginRedirectUrl"] = null; //Session["RoleNo"].ToString(); //Session["DeptNo"].ToString(); THESE GET Stuff BCCAEntities ctx = new BCCAEntities(); int? userRoleNo = (int?)Session["RoleNo"]; switch (ctx.Roles.Where(r => r.roleNo == userRoleNo).Select(r => r.role1).First()) { case "Administrator": userRole = 0; break; case "Safety Officer": userRole = 0; break; case "Lab Manager": departmentRowLab.Visible = false; departmentRowOffice.Visible = false; divStats.Visible = false; divCourseLookUp.Visible = false; userRole = 1; break; default: throw new System.SystemException("Default case of switch should never be reached"); } grvLabInspections.Visible = false; grvLabInspectionResults.Visible = false; grvOfficeInspections.Visible = false; grvOfficeInspectionResults.Visible = false; followupRow.Visible = false; officefollowUpRow.Visible = false; tblLabInspectionComment.Visible = false; tbOfficeInspectionComment.Visible = false; tblOfficeInspectionComment.Visible = false; tbLabInspectionComment.Visible = false; if (!IsPostBack) { addCharFilterToAllTextBoxes(); ddlLabLabManager.DataSource = ctx.LabInspections.Select(l => new { text = l.labMgr, value = l.labMgr }).OrderBy(l => l).Distinct(); ddlLabLabManager.DataValueField = "value"; ddlLabLabManager.DataTextField = "text"; ddlLabLabManager.DataBind(); ddlLabDepartment.DataSource = ctx.Departments.Select(D => new { text = D.deptName, value = D.deptName }).OrderBy(D => D); ddlLabDepartment.DataValueField = "value"; ddlLabDepartment.DataTextField = "text"; ddlLabDepartment.DataBind(); ddlOfficeDepartment.DataSource = ctx.Departments.Select(D => new { text = D.deptName, value = D.deptName }).OrderBy(D => D); ddlOfficeDepartment.DataValueField = "value"; ddlOfficeDepartment.DataTextField = "text"; ddlOfficeDepartment.DataBind(); PopulateEmployersDdl(); PopulatePositionsDdl(); PopulateDepartmentsDdl(); populateTrackerGridView(); // pnlPop.Style.Value = "display:none;"; lblResults.Visible = true; tsmScriptManager.SetFocus(tbxLastName.ClientID); } }