protected void Page_Load(object sender, EventArgs e) { PostBackStr_MakeGroup = Page.ClientScript.GetPostBackEventReference(this, "MakeGroup"); string s = Request.Params.Get("GroupID"); if (s != null) { GroupIDS = s; //we are coming in from CreateGroup.... so Update the ID box GroupId.Value = s; } s = Request.Params.Get("Ajaxcall"); if (s == "2") { GroupIDS = Request.Params.Get("GroupID"); //need to find group members for this... PupilGroupList pgl1 = new PupilGroupList(); pgl1.AddToList(new Guid(GroupId.Value), DateTime.Now); foreach (SimplePupil p in pgl1.m_pupilllist) { Response.Write("<option value=\"" + p.m_StudentId + "\">" + p.m_GivenName + " " + p.m_Surname + "</option>"); } Response.End(); return; } if (IsPostBack) { s = Request.Params.Get("__EVENTARGUMENT"); if (s == "MakeGroup") { ProcessMakeGroup(Request.Params.Get("__EVENTDATA")); } } }
public void SetUpGroupNames(string gp) { PupilGroupList pgl1 = new PupilGroupList(); pgl1.AddToList(new Guid(gp), DateTime.Now); ListBox_SelectedNames.Items.Clear(); foreach (SimplePupil p in pgl1.m_pupilllist) { System.Web.UI.WebControls.ListItem l = new ListItem(p.m_GivenName + " " + p.m_Surname, p.m_StudentId.ToString()); ListBox_SelectedNames.Items.Add(l); } }
private void ListSet(string set) { string s = ""; PupilGroupList pgl = new PupilGroupList(); ResultsList rl1 = new ResultsList(); pgl.AddToList(set, DateTime.Now); Response.Write("<TABLE BORDER>"); string grade = ""; //need to find course type.... CourseList cl1 = new CourseList(5); foreach (Course c in cl1._courses) { if (c.CourseCode == set.Substring(2, 2).ToUpper()) { TextBox3.Text = c._CourseID.ToString(); } } foreach (SimplePupil sp in pgl.m_pupilllist) { grade = ""; rl1.m_parameters = 2; rl1.m_db_field2 = "ResultType"; rl1.m_value2 = "6"; rl1.LoadList("dbo.tbl_Core_Students.StudentId", sp.m_StudentId.ToString()); foreach (Result r in rl1._results) { if (r.Code == set.Substring(2, 2).ToUpper()) { grade = r.Value; } } s = "PredictedGrades.aspx"; s += "?ID=" + sp.m_StudentId.ToString() + "&Name=" + sp.m_GivenName + " " + sp.m_Surname; s += "& set=" + TextBox1.Text; s += "& course=" + TextBox3.Text; Response.Write("<TR><TD><A HREF=\"" + s + "\">" + sp.m_GivenName + " " + sp.m_Surname + "</A></TD><TD>"); Response.Write(grade + "</td></TR>"); } Response.Write("</TABLE>"); Button_A.Visible = false; Button_B.Visible = false; Button_C.Visible = false; Button_D.Visible = false; Button_E.Visible = false; Button_U.Visible = false; Label1.Visible = false; GroupListBox.Visible = false; Label_Student.Visible = false; Button1.Visible = false; }
protected void Button_Add_Click(object sender, EventArgs e) { string s = Label_MessageType.Text; switch (s) { case "Group": foreach (ListItem i in ListBox_staff.Items) { if (i.Selected) { //need to check to see if staff groups... Group gp1 = new Group(); gp1.Load(new Guid(i.Value)); if (gp1._CourseID == Cerval_Globals.newdawnCse) { //oh pain we are going to have to add names... PupilGroupList pgl1 = new PupilGroupList(); pgl1.AddToList(gp1._GroupID, DateTime.Now); foreach (SimplePupil p in pgl1.m_pupilllist) { TextBox_textTo.Text += p.m_GivenName + " " + p.m_Surname + "\n"; TextBox_StudentList.Text += p.m_StudentId.ToString() + ":"; } } else { TextBox_textTo.Text += i.Text.ToString() + "\n"; TextBox_GroupList.Text += i.Value.ToString() + ":"; } } } break; case "Student": foreach (ListItem i in ListBox_staff.Items) { if (i.Selected) { TextBox_textTo.Text += i.Text.ToString() + "\n"; TextBox_StudentList.Text += i.Value.ToString() + ":"; } } break; } }
protected void AddControls(bool init) { if (DropDownList_Sets.SelectedIndex < 0) { return; } TextBox1.Text = DropDownList_Sets.SelectedItem.Text; string set = TextBox1.Text; Table tb1 = (Table)content0.FindControl("table1"); PupilGroupList pgl = new PupilGroupList(); ResultsList rl1 = new ResultsList(); string grade = ""; string cse = ""; int Key_stage = 0; string year = ""; //need to find course type.... if (set.StartsWith("1")) { //10,11,12,13 if (set.StartsWith("10") || set.StartsWith("11")) { Key_stage = 4; } else { Key_stage = 5; } cse = set.Substring(2, 2).ToUpper(); year = set.Substring(0, 2); } else { Key_stage = 3; cse = set.Substring(3, 2).ToUpper(); year = set.Substring(0, 1); } if (init) { CourseList cl1 = new CourseList(Key_stage); foreach (Course c in cl1._courses) { if (c.CourseCode == cse) { TextBox3.Text = c._CourseID.ToString(); } } } //now this is for collecting internal results..... string s2 = ""; DateTime SetListDate = new DateTime(); DateTime ResultDate = new DateTime(); Utility u = new Utility(); ResultDate = u.GetResultDate(year, ref s2, ref SetListDate); TextBox2.Text = ResultDate.ToShortDateString(); TextBox4.Text = s2; pgl.AddToList(set, SetListDate); Label1.Text = "Results for " + set + " for " + s2 + ". Use tab to go to next record."; Label1.Visible = true; foreach (SimplePupil sp in pgl.m_pupilllist) { TableRow r1 = new TableRow(); tb1.Controls.Add(r1); r1.BorderStyle = BorderStyle.Solid; r1.BorderColor = tb1.BorderColor; r1.BorderWidth = tb1.BorderWidth; TableCell c1 = new TableCell(); r1.Controls.Add(c1); TableCell c2 = new TableCell(); r1.Controls.Add(c2); TextBox txb1 = new TextBox(); c2.Controls.Add(txb1); c1.BorderStyle = tb1.BorderStyle; c1.BorderWidth = tb1.BorderWidth; c1.BorderColor = tb1.BorderColor; c2.BorderStyle = tb1.BorderStyle; c2.BorderWidth = tb1.BorderWidth; c2.BorderColor = tb1.BorderColor; c2.Width = 40; txb1.TextChanged += new EventHandler(txt); txb1.Width = 30; txb1.ID = sp.m_StudentId.ToString(); c1.Text = sp.m_GivenName + " " + sp.m_Surname; if (set.StartsWith("1")) { cse = set.Substring(2, 2).ToUpper(); } else { cse = set.Substring(3, 2).ToUpper(); } if (init) { grade = ""; rl1.m_parameters = 3; rl1.m_db_field2 = "ResultType"; rl1.m_value2 = "5"; rl1.m_db_extraquery = " AND (dbo.tbl_Core_Results.ResultDate >= CONVERT(DATETIME, '" + ResultDate.ToString("yyyy-MM-dd HH:mm:ss") + "', 102) )"; rl1.LoadList("dbo.tbl_Core_Students.StudentId", sp.m_StudentId.ToString()); foreach (Result r in rl1._results) { if (r.Code == cse) { grade = r.Value; } } txb1.Text = grade; } } }
protected string GenerateVA(string GroupID, string GroupName) { string s = ""; string s1 = ""; List <VAresult> list1 = new List <VAresult>(); PupilGroupList pgl = new PupilGroupList(); pgl.AddToList(new Guid(GroupID), DateTime.Now); //going to get the data double xgrade = 0; double x1 = 0; double x2 = 0; foreach (SimplePupil p in pgl.m_pupilllist) { StudentAccademicProfile StudentProfile = new StudentAccademicProfile(p.m_StudentId); int KeyStage = 0; DateTime date1 = new DateTime(); date1 = DateTime.Now; //this is when we load tt etc... so if in summer gap... alter if (date1.Month == 8) { date1 = date1.AddMonths(2); } SimplePupil p1 = new SimplePupil(); p1 = p; StudentProfile.Load_Profile(date1, ref p1, ref KeyStage, false); string Profile_approx = ""; string Target_approx = ""; foreach (StudentSubjectProfile sp in StudentProfile.profile) { try { if (sp.latestProfileGrade != null) { x2 = sp.Convert_to_scale(ref xgrade, ref x1, ref Target_approx, ref Profile_approx); VAresult v1 = new VAresult(); v1.adno = p1.m_adno.ToString(); v1.course = sp.course.CourseCode; //v1.profile = x1.ToString(); v1.profile = Profile_approx; //v1.predict = x2.ToString(); v1.predict = Target_approx; v1.surname = p.m_Surname; v1.givename = p.m_GivenName; v1.x1 = x1; v1.x2 = x2; v1.xgrade = xgrade; list1.Add(v1); } } catch { } } } //find all the courses in the list... List <string> courselist = new List <string>(); bool found = false; foreach (VAresult v in list1) { found = false; foreach (string s4 in courselist) { if (s4 == v.course) { found = true; break; } } //not found if (!found) { courselist.Add(v.course); } } courselist.Sort(); //find all the students List <string> adnolist = new List <string>(); foreach (VAresult v in list1) { found = false; foreach (string s4 in adnolist) { if (s4 == v.adno) { found = true; break; } } //not found if (!found) { adnolist.Add(v.adno); } } string [,] list2 = new string[adnolist.Count + 3, 2 * courselist.Count + 6]; double [,] list3 = new double[adnolist.Count + 3, 2 * courselist.Count + 6]; double [,] listx = new double[adnolist.Count + 3, 2 * courselist.Count + 6]; int i = 3; foreach (string s5 in courselist) { list2[0, i] = s5; i++; list2[0, i] = s5; i++; } int j = 1; foreach (VAresult v in list1) { if (list2[j, 0] != v.adno) { j++; list2[j, 0] = v.adno; list2[j, 1] = v.givename; list2[j, 2] = v.surname; } //now find the course i = 3; foreach (string s5 in courselist) { if (s5 == v.course) { list2[j, i] = v.predict; list2[j, i + 1] = v.profile; list3[j, i] = v.xgrade; list3[j, i + 1] = v.xgrade; listx[j, i] = v.x2; listx[j, i + 1] = v.x1; break; } i++; i++; } } s = "<h2><p align=\"center\"> Latest Profile Score v Predicted Grade </p></h2>"; s += "<div><p align=\"center\"><table class=\"EventsTable\"> "; s += "<TR><TD >Cells have: </TD><td>course</br>Profile Grade</br>Predicted Grade</td>"; s += "<td>Predictions are from Alis (KS5) / "; s += " Yellis (KS4)</br>Points are UCAS at KS5 (A=120) and GCSE at KS4 (A=52 or new 1-9 scale)</td>"; s += "</tr></table></p>"; s += "Colour indicates how far they exceed / failed to reach target"; s += "<table class=\"EventsTable\"> "; s += "<TR><TD class= \"tableHighlight1\">Exceed by 1 grade</TD>"; s += "<TD class= \"tableHighlight2\">Exceed by 0.5 grade</TD>"; s += "<TD class= \"tableHighlight4\">Below by 0.5 grade</TD>"; s += "<TD class= \"tableHighlight5\">Below by 1 grade</TD>"; s += "</tr></table></div>"; s += "<p align=\"center\"><table class=\"EventsTable\"> "; s += "<TR><td>Adno</td><TD>Given Name</TD><TD>Surname</TD>"; s += "<TD>Subjects</TD><TD>...............</TD></TR>"; for (int i1 = 1; i1 < adnolist.Count + 2; i1++) { s += "<tr>"; for (int j1 = 0; j1 < 3; j1++) { s += "<td>" + list2[i1, j1] + "</td>"; } for (int j1 = 4; j1 < 2 * courselist.Count + 4; j1 = j1 + 2) { s1 = "<td>" + list2[0, j1] + "</br>"; try { x1 = listx[i1, j1]; x2 = listx[i1, j1 - 1]; xgrade = list3[i1, j1]; double xd = x2 - x1; if (x1 > 0) { if (x2 > 0) { if (xd > xgrade / 2) { s1 = "<td class= \"tableHighlight4\" >" + list2[0, j1] + "</br>"; if (xd > xgrade) { s1 = "<td class= \"tableHighlight5\" >" + list2[0, j1] + "</br>"; } } else if (xd < -xgrade / 2) { s1 = "<td class= \"tableHighlight2\" >" + list2[0, j1] + "</br>"; if (xd < -xgrade) { s1 = "<td class= \"tableHighlight1\" >" + list2[0, j1] + "</br>"; } } //s1 += x1.ToString() + "</br>"; //s1 += x2.ToString(); s1 += list2[i1, j1] + "</br>"; s1 += list2[i1, j1 + 1]; } else { s1 = "<td>" + list2[0, j1] + "</br>"; s1 += x1.ToString() + "</br>"; } } else { s1 = "<td></br>"; } } catch { }; s += s1 + "</TD>"; } s += "</tr>"; } s += "</table></div></p>"; //going to add to pure data table.... s += "</br><h2><p align=\"center\"> Data as flat table for copying to sheets etc. </p></h2></br>"; s += "</p><div><p align=\"center\"><table class=\"EventsTable\"> "; s += "<TR><td>Adno</td><TD>Given Name</TD><TD>Surname</TD>"; s += "<TD>Subjects</TD><TD>Always prediction then Profile...</TD></TR>"; for (int i1 = 0; i1 < adnolist.Count + 2; i1++) { s += "<tr>"; for (int j1 = 0; j1 < 2 * courselist.Count + 4; j1 = j1 + 2) { s += "<td>" + list2[i1, j1] + "</td>"; s += "<td>" + list2[i1, j1 + 1] + "</td>"; } s += "</tr>"; } s += "</table></div></p>"; return(s); }
protected void Button_CheckTime_Click(object sender, EventArgs e) { string s = TextBox1.Text; string ErrorMsg = ""; TextFileType ftype1 = TextFileType.Unknown; try { ftype1 = (TextFileType)ViewState["TextFileType"]; } catch { Label_Text.Text = "File Type not recognised"; return; } char[] ct1 = new char[1]; ct1[0] = (char)0x09; string[] fields = new string[20]; ExamsUtility u = new ExamsUtility(); PupilGroupList pgl = new PupilGroupList(); ExamConversions Ec = new ExamConversions(); SimplePupil pupil1 = new SimplePupil(); Guid g1 = new Guid(); g1 = Guid.Empty; DateTime t1 = new DateTime(); t1 = DateTime.Now; using (StringReader sr = new StringReader(s)) { string firstline = sr.ReadLine(); string line = sr.ReadLine(); fields = line.Split(ct1); Exam_Board exbde1 = Ec.GetExamBoard(fields[1]); switch (ftype1) { case TextFileType.Unknown: Label_Text.Text = "File Type not recognised"; break; case TextFileType.Students: //Admission Number,Surname, GivenName,Board,Syllabus,Option..."; try { pupil1.Load_StudentIdOnly(System.Convert.ToInt32(fields[0])); ///loads lft students aswell if (!u.AddEntry(pupil1.m_StudentId, exbde1, Year, YearCode, SeasonCode, fields[3], 3, true, ref ErrorMsg, ref g1)) { Label_Text.Text = ErrorMsg; return; } else { Exam_Entry en1 = new Exam_Entry(); en1.m_ExamEntryID = g1; en1.Delete(); } } catch (Exception ex) { Label_Text.Text = ex.ToString(); return; } break; case TextFileType.Sets: pgl.m_pupilllist.Clear(); pgl.AddToList(fields[0], DateTime.Now); foreach (SimplePupil p in pgl.m_pupilllist) { try { if (!u.AddEntry(p.m_StudentId, exbde1, Year, YearCode, SeasonCode, fields[3], 3, true, ref ErrorMsg, ref g1)) { Label_Text.Text = ErrorMsg; return; } else { Exam_Entry en1 = new Exam_Entry(); en1.m_ExamEntryID = g1; en1.Delete(); } } catch (Exception ex) { Label_Text.Text = ex.ToString(); return; } } break; default: break; } //done one set or one student...scale up.... TimeSpan ts1 = DateTime.Now - t1; TimeSpan ts2 = new TimeSpan(); ts2 = ts1; while ((line = sr.ReadLine()) != null) { ts2 += ts1; } TextBox_Warning.Text = "WARNING: This operation is likely to take about " + ts2.ToString() + Environment.NewLine + "Press Process Button to continue..."; TextBox_Warning.Visible = true; Button_CheckTime.Visible = false; Button_Process.Visible = true; } }
protected void Button_Process_Click(object sender, EventArgs e) { string s = TextBox1.Text; string ErrorMsg = ""; TextFileType ftype1 = TextFileType.Unknown; try { ftype1 = (TextFileType)ViewState["TextFileType"]; } catch { Label_Text.Text = "File Type not recognised"; return; } char[] ct1 = new char[1]; ct1[0] = (char)0x09; string[] fields = new string[20]; ExamsUtility u = new ExamsUtility(); PupilGroupList pgl = new PupilGroupList(); ExamConversions Ec = new ExamConversions(); SimplePupil pupil1 = new SimplePupil(); Guid g1 = new Guid(); g1 = Guid.Empty; int number_entered = 0; using (StringReader sr = new StringReader(s)) { string firstline = sr.ReadLine(); string line; while ((line = sr.ReadLine()) != null) { fields = line.Split(ct1); switch (ftype1) { case TextFileType.Unknown: Label_Text.Text = "File Type not recognised"; break; case TextFileType.Students: //Admission Number,Surname, GivenName,Board,Syllabus,Option..."; try { Exam_Board exbde1 = Ec.GetExamBoard(fields[3]); pupil1.Load_StudentIdOnly(System.Convert.ToInt32(fields[0])); ///loads lft students aswell if (!u.AddEntry(pupil1.m_StudentId, exbde1, Year, YearCode, SeasonCode, fields[5], 3, true, ref ErrorMsg, ref g1)) { Label_Text.Text = ErrorMsg; return; } else { number_entered++; } } catch (Exception ex) { Label_Text.Text = ex.ToString(); return; } break; case TextFileType.Sets: //Set, Board, Syllabus, Option. pgl.m_pupilllist.Clear(); pgl.AddToList(fields[0], DateTime.Now); foreach (SimplePupil p in pgl.m_pupilllist) { try { Exam_Board exbde1 = Ec.GetExamBoard(fields[1]); if (!u.AddEntry(p.m_StudentId, exbde1, Year, YearCode, SeasonCode, fields[3], 3, true, ref ErrorMsg, ref g1)) { Label_Text.Text = ErrorMsg; return; } else { number_entered++; } } catch (Exception ex) { Label_Text.Text = ex.ToString(); return; } } break; default: break; } } } Label_Text.Text = "Correctly processed... " + number_entered.ToString() + " entries"; }