protected void DisplayTT(DateTime t1) { studentID = ""; Utility u1 = new Utility(); PersonID = u1.GetPersonIdfromRequest(Request); #if DEBUG u1.Is_student = true; u1.Is_staff = false; #endif if ((PersonID != Guid.Empty) && (u1.Is_student)) { studentID = u1.GetStudentId(PersonID).ToString(); PupilPeriodList ppl = new PupilPeriodList(); ppl.LoadList("StudentId", studentID, true, t1); TT_writer ttw = new TT_writer(); servercontent.InnerHtml += "<h2>Timetable for " + u1.GetPersonName(PersonID) + " as at " + t1.ToShortDateString() + "</h2>"; servercontent.InnerHtml += ttw.OutputTT_string("", false, TT_writer.TimetableType.Student, ref ppl, t1) + "<br/>"; } else { Response.Write(""); servercontent.InnerHtml = "<h2>No data to display</h2>"; } }
private void UpDateGroupsListBox() { GroupList gr = new GroupList(""); GroupListBox.Items.Clear(); PupilPeriodList ppl = new PupilPeriodList(); string struser = Context.User.Identity.Name; //struser = @"challoners\cc"; Utility u = new Utility(); string s = ""; //Guid personID = u.GetPersonID(struser,out s); Guid personID = u.GetPersonIdfromRequest(Request); s = u.GetsStaffCodefromRequest(Request); if (personID != Guid.Empty) { struser = s; } //struser = "******"; Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_Predicted_Grade_Type"); s = c.Value; if (!c.valid)//try revert to config file { System.Configuration.AppSettingsReader ar = new System.Configuration.AppSettingsReader(); s = ar.GetValue("Predicted Grade Type", typeof(string)).ToString(); } //if s =SL then do the lockdown mode for SL //if s = staff then do sets for staff //if s = ""... ignore... if (s == "SL") { this.Label1.Text = "Select Set. Only Subject Leaders can now change values."; //this code to list sets of a subject... if ((struser.Trim() == "CC") || (struser.Trim() == "DCO")) { struser = ""; //allow all sets } GroupList_SL grsl = new GroupList_SL(struser); foreach (Group g in grsl._groups) { if ((g._StartDate < DateTime.Now) && (g._EndDate > DateTime.Now) && (g._GroupCode.StartsWith("13"))) { ListItem Item = new ListItem(g._GroupCode, g._GroupID.ToString()); GroupListBox.Items.Add(Item); } } } if (s == "STAFF") { this.Label1.Text = "Select Set "; //this code lists sets the user is timetabled to teach.... ppl.LoadList("StaffCode", struser, false, DateTime.Now); bool add = false; foreach (Group g in gr._groups) { add = false; if ((g._StartDate < DateTime.Now) && (g._EndDate > DateTime.Now)) { foreach (ScheduledPeriod p in ppl.m_pupilTTlist) { if ((p.m_groupcode == g._GroupCode) && (g._GroupCode.StartsWith("13"))) { add = true; } } if (add) { ListItem Item = new ListItem(g._GroupCode, g._GroupID.ToString()); GroupListBox.Items.Add(Item); } } } } GroupListBox.SelectedIndex = 0; }
private void Build_GroupList(string type, string year, string group1) { GroupListBox.Items.Clear(); DateTime ListDate = new DateTime(); ListDate = System.Convert.ToDateTime(TextBox_ListDate.Text); if (type == "Group") { Group g = new Group(); g.Load(group1, ListDate); ListItem l = new ListItem(g._GroupCode, g._GroupID.ToString()); GroupListBox.Items.Add(l); l.Selected = true; Label_Groups.Text = ""; Display(); return; } if (Year == "0") { //need to do mask... soo nothing... TextBox_mask.Visible = true; GroupListBox.Visible = false; Label_Groups.Text = "Type mask and return"; Display_List.Visible = false; GroupListControl1.Groups.Clear(); return; } bool add = false; string user = ""; PupilPeriodList ppl = new PupilPeriodList(); if (type == "User") { Utility u = new Utility(); //user = u.GetStaffCodefromContext(Context); user = u.GetsStaffCodefromRequest(Request); #if DEBUG user = "******"; #endif ppl.LoadList("StaffCode", user, false, ListDate); } GroupList gl1 = new GroupList(); gl1.LoadList_NonNewDawnOnly(ListDate, GroupList.GroupListOrder.GroupName); foreach (Group g in gl1._groups) { add = false; switch (type) { case "Year": if (g._GroupCode.StartsWith(year) || (year == "All")) { add = true; } break; case "User": foreach (ScheduledPeriod p in ppl.m_pupilTTlist) { if (p.m_groupcode == g._GroupCode) { add = true; break; } } ; break; default: break; } if (add) { ListItem l = new ListItem(g._GroupCode, g._GroupID.ToString()); GroupListBox.Items.Add(l); } } switch (type) { case "Year": Label_Groups.Text = "Year" + Year; break; case "User": Label_Groups.Text = "Groups for " + user; break; } }
protected void YearDisplay() { List <Course> StudentCourse = new List <Course>(); string s = Request.QueryString["Year"]; s = "10"; SimpleStudentList stdlist1 = new SimpleStudentList(); stdlist1.LoadList_atDate(DateTime.Now.AddMonths(2)); stdlist1.Restrict_to_year(System.Convert.ToInt16(s)); string class1 = ""; StudentAccademicProfile StudentProfile = new StudentAccademicProfile(); string[,] outputA = new string[250, 30];//students,subject outputA[0, 0] = "<th> Surname</th>"; outputA[0, 1] = "<th> GivenName</th> "; outputA[0, 2] = "<th> Adno</th> "; int no_cses = 0; int no_students = 0; int KeyStage = 0; int n = 0; switch (s) { case "7": case "8": case "9": KeyStage = 3; break; case "10": case "11": KeyStage = 4; break; case "12": case "13": KeyStage = 5; break; } CourseList cl1 = new CourseList(KeyStage); CourseList cl4 = new CourseList(50);//needed to get predicted grades for KS3.... ugh ResultsList rl1 = new ResultsList(); rl1.m_parameters = 1; foreach (SimplePupil p in stdlist1._studentlist) { rl1._results.Clear(); StudentCourse.Clear(); StudentProfile.profile.Clear(); rl1.LoadList("dbo.tbl_Core_Students.StudentId", p.m_StudentId.ToString()); ReportList repl = new ReportList(p.m_StudentId.ToString(), KeyStage - 2); //going to try to add the report grades in to the results... foreach (ReportValue v in repl.m_list) { Result res1 = new Result(); rl1._results.Add(res1); res1.External = false; res1.Date = v.m_date; res1.Shortname = "Report"; res1.Code = v.m_course; if (v.m_IsCommitment) { res1.Resulttype = 998; } else { res1.Resulttype = 999; } res1.Value = Round0(v.m_value).ToString(); } //date sort with newest at front... Result r0 = new Result(); Result r2 = new Result(); for (int j = 0; j < rl1._results.Count; j++) { for (int k = 0; k < (rl1._results.Count - 1 - j); k++) { r0 = (Result)rl1._results[k]; r2 = (Result)rl1._results[k + 1]; if (r0.Date < r2.Date) { rl1._results[k] = r2; rl1._results[k + 1] = r0; } } } double d = 0; int x = 0; ValueAddedMethodList vaml1 = new ValueAddedMethodList(); ValueAddedMethod vam = new ValueAddedMethod(); foreach (ValueAddedMethod VA_method1 in vaml1._ValueAddedMethodList) { //going to use Yellis for KS4, CATs for KS3 and Alis for KS5.. if (VA_method1.m_ValueAddedShortName.ToUpper().Contains("YE") && (KeyStage == 4)) { vam = new ValueAddedMethod(VA_method1.m_ValueAddedMethodID); } if (VA_method1.m_ValueAddedShortName.ToUpper().Contains("AL") && (KeyStage == 5)) { vam = new ValueAddedMethod(VA_method1.m_ValueAddedMethodID); } if (VA_method1.m_ValueAddedShortName.ToUpper().Contains("CATS") && (KeyStage == 3)) { vam = new ValueAddedMethod(VA_method1.m_ValueAddedMethodID); } } ValueAddedConversionList vacl1 = new ValueAddedConversionList(); ValueAddedEquation va1 = new ValueAddedEquation(); //going to find his current courses.... PupilPeriodList ppl1 = new PupilPeriodList(); ppl1.LoadList("StudentId", p.m_StudentId.ToString(), true); foreach (ScheduledPeriod sc in ppl1.m_pupilTTlist) { s = sc.m_groupcode; if (KeyStage == 3) { if (s.Contains("-")) { s = sc.m_groupcode.Substring(3, 2); } else { s = sc.m_groupcode.Substring(1, 2);//maths stes } } else { s = sc.m_groupcode.Substring(2, 2); } //going to assume that code is correct... ie 11HI4 is History KS4... foreach (Course c in cl1._courses) { if (c.CourseCode == s) { if (!StudentCourse.Contains(c)) { StudentCourse.Add(c); StudentSubjectProfile sbp1 = new StudentSubjectProfile(); sbp1.course = c; sbp1.KeyStage = KeyStage; StudentProfile.profile.Add(sbp1); } } } } //so now we have a list of his courses..... //for each course we find latest grade and predicion? bool foundpg = false; bool foundcg = false; bool foundint = false; bool foundVAM = false; foreach (StudentSubjectProfile sp in StudentProfile.profile) { foundpg = false; foundcg = false; foundint = false; foundVAM = false; foreach (Result r in rl1._results)//they are in date order... { if (r.Resulttype == vam.m_ValueAddedBaseResultType) { foundVAM = true; sp.VA_Base_Score = System.Convert.ToDouble(r.Value); } if (r.Code == sp.course.CourseCode) { if ((r.Resulttype == 999) && !foundpg) { foundpg = true; sp.latestProfileGrade = r; } if ((r.Resulttype == 998) && !foundcg) { foundcg = true; sp.latestCommintmentGrade = r; } if (!foundint && (r.Resulttype == 5)) { foundint = true; sp.latestInternalExamResult = r; ResultsList rl2 = new ResultsList(); rl2.m_parameters = 3; rl2.m_db_field2 = "CourseId"; rl2.m_value2 = r.CourseID.ToString(); string date1 = "CONVERT(DATETIME, '" + r.Date.AddDays(-5).ToString("yyyy-MM-dd HH:mm:ss") + "', 102)"; string date2 = "CONVERT(DATETIME, '" + r.Date.AddDays(5).ToString("yyyy-MM-dd HH:mm:ss") + "', 102)"; rl2.m_db_extraquery = " AND (ResultDate > " + date1 + ") AND (ResultDate < " + date2 + ")"; //d = rl2.AverageResult("ResultType", "5", ref sp.NumberInternalResult); x = (int)(d * 10); //sp.AvgInternalResult = (double)x / 10; //sp.PositionInternalResult = rl2.YearPosition("ResultType", "5", r.Value); } if (foundpg && foundcg && foundint && foundVAM) { break; } } } if (sp.VA_Base_Score > 0) { string cse1id = sp.course._CourseID.ToString(); if (KeyStage == 3) { foreach (Course c in cl4._courses) { if (sp.course.CourseCode == c.CourseCode) { cse1id = c._CourseID.ToString(); } } } va1.Load1("WHERE (ValueAddedMethodID='" + vam.m_ValueAddedMethodID.ToString() + "') AND ( CourseID='" + cse1id + "' ) "); sp.PredictedGrade = Round1(va1.m_coef0 + va1.m_coef1 * sp.VA_Base_Score + va1.m_coef2 * sp.VA_Base_Score * sp.VA_Base_Score); } } //so now to add to list..... outputA[no_students + 1, 0] = "<td>" + p.m_Surname + "</td>"; outputA[no_students + 1, 1] = "<td>" + p.m_GivenName + "</td>"; outputA[no_students + 1, 2] = "<td>" + p.m_adno.ToString() + "</td>"; int cse_no = -1; foreach (StudentSubjectProfile sp in StudentProfile.profile) { cse_no = -1; for (int i = 0; i < no_cses + 1; i++) { if (outputA[0, 3 + i] == "<th>" + sp.course.CourseCode + "</th>") { cse_no = i;; } } if (cse_no < 0) { outputA[0, 3 + no_cses] = "<th>" + sp.course.CourseCode + "</th>"; cse_no = no_cses; no_cses++; } if (sp.latestProfileGrade != null) { d = System.Convert.ToDouble(sp.latestProfileGrade.Value); if (KeyStage < 5) { d = 34 + 6 * d; //convert to gcse points } if (KeyStage == 5) { d = 60 + 20 * d; } class1 = " class=\"tableHighlight3\""; if ((sp.PredictedGrade - d) > 1) { class1 = " class=\"tableHighlight4\""; } if ((sp.PredictedGrade - d) > 2) { class1 = " class=\"tableHighlight5\""; } if ((d - sp.PredictedGrade) > 1) { class1 = " class=\"tableHighlight2\""; } if ((d - sp.PredictedGrade) > 2) { class1 = " class=\"tableHighlight1\""; } if (sp.PredictedGrade == 0) { class1 = " class=\"tableHighlight3\""; } s = "<td" + class1 + " >" + d.ToString() + "</td>"; } else { s = "<td></td>"; } outputA[no_students + 1, cse_no + 3] = s; //if (sp.PredictedGrade != 0) s += "<td>" + sp.PredictedGrade.ToString() + "</td>"; else s += "<td></td>"; /* * if (sp.latestCommintmentGrade != null) * { * class1 = " class=\"tableHighlight3\""; * d = System.Convert.ToDouble(sp.latestCommintmentGrade.Value); * if (d > 3) class1 = " class=\"tableHighlight2\""; * if (d > 4) class1 = " class=\"tableHighlight1\""; * if (d < 2) class1 = " class=\"tableHighlight4\""; * if (d < 1) class1 = " class=\"tableHighlight5\""; * s += "<td" + class1 + " >" + sp.latestCommintmentGrade.Value.ToString() + "</td>"; * } * else * s += "<td></td>"; * * if (sp.latestInternalExamResult != null) * { * s += "<td>" + sp.latestInternalExamResult.Value + "</td>"; * s += "<td>" + sp.AvgInternalResult.ToString() + "</td>"; * n = (int)Round1(100 * ((double)sp.PositionInternalResult / (double)sp.NumberInternalResult)); * class1 = " class=\"tableHighlight3\""; * if (n < 30) class1 = " class=\"tableHighlight2\""; * if (n < 15) class1 = " class=\"tableHighlight1\""; * if (n > 70) class1 = " class=\"tableHighlight4\""; * if (n > 85) class1 = " class=\"tableHighlight5\""; * s += "<td" + class1 + " >" + n.ToString() + "</td>"; * } * else * { * s += "<td></td>"; * s += "<td></td>"; * s += "<td></td>"; * } * s += "</tr>"; */ } no_students++; //if (no_students > 5) break; } //so now to display... string s1 = ""; s = "<h3>Academic Profile for Year</h3><br />"; s += "<table class=\"EventsTable\" > "; for (int i = 0; i < no_students + 1; i++) { s += "<tr>"; for (int j = 0; j < no_cses + 3; j++) { if (outputA[i, j] == null) { s += "<td></td>"; } else { s += outputA[i, j]; } } s += "</tr>"; } s += "</table>"; content0.InnerHtml = s; }
void GridView1_RowCommand(Object sender, GridViewCommandEventArgs e) { //calls here for any command - including a sort if (e.CommandName == "Edit_Grade") { Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_Forecast_Grade_Edit"); string s1 = c.Value; if (!c.valid)//try revert to config file { System.Configuration.AppSettingsReader ar = new AppSettingsReader(); s1 = ar.GetValue("Exam Entries Forecast Grade Edit", s1.GetType()).ToString(); } if (s1 == "none") { visibility(4); { ListBox_PredictedGrades.Visible = false; Button_Save_Prediction.Visible = false; Label_Title_for_Edit.Text = "Predicted grades can't be edited at present"; return; } } int row = Convert.ToInt32(e.CommandArgument); GridViewRow row1 = GridView1.Rows[row]; string s = Server.HtmlDecode(row1.Cells[0].Text);//is id Exam_Entry ex1 = new Exam_Entry(); ex1.Load(s); SimplePupil p1 = new SimplePupil(); p1.Load(ex1.m_StudentID.ToString()); ExamOption exo1 = new ExamOption(); exo1.Load(ex1.m_OptionID); Utility u = new Utility(); bool valid = false; PupilPeriodList PPLlist1 = new PupilPeriodList(); PPLlist1.LoadList("StudentID", ex1.m_StudentID.ToString(), true, DateTime.Now); //now I'd like to find the cse... but we dont know these CourseList cselist1 = new CourseList(ex1.m_OptionID); GroupList_SL grplist1 = new GroupList_SL(Label_staffCode.Text.Trim()); foreach (Course c1 in cselist1._courses) { foreach (ScheduledPeriod scp in PPLlist1.m_pupilTTlist) { if (scp.m_groupcode.Substring(2, 2).ToUpper().Trim() == c1.CourseCode.ToUpper().Trim()) { if (scp.m_staffcode.Trim().ToUpper() == Label_staffCode.Text.Trim().ToUpper()) { if (s1 == "staff") { valid = true; } } foreach (Group g1 in grplist1._groups) { if (g1._GroupCode == scp.m_groupcode) { valid = true; //is SL } } } } } if (s1 == "all") { valid = true; } visibility(4); if (!valid) { ListBox_PredictedGrades.Visible = false; Button_Save_Prediction.Visible = false; Label_Title_for_Edit.Text = "Can't edit this grade as you don't teach the student"; return; } Label_Title_for_Edit.Text = "Predicted Grade for " + p1.m_GivenName + " " + p1.m_Surname + " for " + exo1.m_OptionCode + ": " + exo1.m_OptionTitle; Label_EntryID_for_edit.Text = s; ListBox_PredictedGrades.Items.Clear(); if (exo1.m_OptionQualification == "GCE") { ListBox_PredictedGrades.Items.Add("A*"); ListBox_PredictedGrades.Items.Add("A"); ListBox_PredictedGrades.Items.Add("B"); ListBox_PredictedGrades.Items.Add("C"); ListBox_PredictedGrades.Items.Add("D"); ListBox_PredictedGrades.Items.Add("E"); ListBox_PredictedGrades.Items.Add("U"); } if (exo1.m_OptionQualification == "GCSE") { ListBox_PredictedGrades.Items.Add("A*"); ListBox_PredictedGrades.Items.Add("A"); ListBox_PredictedGrades.Items.Add("B"); ListBox_PredictedGrades.Items.Add("C"); ListBox_PredictedGrades.Items.Add("D"); ListBox_PredictedGrades.Items.Add("E"); ListBox_PredictedGrades.Items.Add(""); } if (ListBox_PredictedGrades.Items.FindByText(Server.HtmlDecode(row1.Cells[7].Text)) != null) { ListBox_PredictedGrades.Items.FindByText(Server.HtmlDecode(row1.Cells[7].Text)).Selected = true; Button_Save_Prediction.Visible = true; } else { //ListBox_PredictedGrades.Visible = false; //Button_Save_Prediction.Visible = false; //Label_Title_for_Edit.Text = "Can't edit this grade"; } Button_Save_Prediction.Visible = true; } if (e.CommandName == "Edit_Button") { int row = Convert.ToInt32(e.CommandArgument); GridViewRow row1 = GridView1.Rows[row]; string s = Server.HtmlDecode(row1.Cells[0].Text);//is id Exam_Entry ex1 = new Exam_Entry(); ex1.Load(s); ExamsEntries_sql.UpdateCommand = "UPDATE dbo.tbl_Exams_Entries SET PredictedGrade = '?' WHERE ExamEntryID ='" + s + "' "; } if (e.CommandName == "Delete_Button") { int row = Convert.ToInt32(e.CommandArgument); GridViewRow row1 = GridView1.Rows[row]; string s = Server.HtmlDecode(row1.Cells[0].Text); //do delete... } }