protected void Button_Update_Click(object sender, EventArgs e) { //so first check we have a valid option and value int v = 0; try { v = System.Convert.ToInt32(TextBox_Value.Text); } catch { //flag error return; } ExamOption ex1 = new ExamOption(); ex1.Load(new Guid(DropDownList_Options.SelectedValue)); if (!ex1.m_valid) { //flag error return; } ExamTQMBoundaryList exTQMlist1 = new ExamTQMBoundaryList(); exTQMlist1.LoadList(ex1.m_OptionID, YearCode.ToString(), SeasonCode.ToString()); bool found = false; foreach (ExamTQMBoundary eb in exTQMlist1.m_list) { if (eb.Grade == DropDownList_Grades.SelectedItem.Value) { found = true; eb.Mark = v; eb.Save(); break; } } if (!found) { ExamTQMBoundary eb1 = new ExamTQMBoundary(); eb1.OptionId = ex1.m_OptionID; eb1.Season = SeasonCode.ToString(); eb1.Year = YearCode.ToString(); eb1.Grade = DropDownList_Grades.SelectedItem.Value; eb1.Mark = v; eb1.Version = 1; eb1.Save(); } exTQMlist1.LoadList(ex1.m_OptionID, YearCode.ToString(), SeasonCode.ToString()); Current_Data.InnerHtml = UpdateCurrentData(exTQMlist1); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString.Count >= 2) { string s = "test"; string id0 = Request.QueryString["StudentId"]; ViewState.Add("StudentId", id0); string id1 = Request.QueryString["OptionId"]; ExamComponentResultList ecrl1 = new ExamComponentResultList(); ecrl1.Load_OptionStudent(new Guid(id1), new Guid(id0)); SimplePupil pupil1 = new SimplePupil(); pupil1.Load(id0); ExamOption exo1 = new ExamOption(); exo1.Load(new Guid(id1)); ExamComponent ec1 = new ExamComponent(); ResultsList rl1 = new ResultsList(); rl1.LoadListSimple(" WHERE (ExamsOptionId = '" + id1 + "') AND (StudentID = '" + id0 + "')"); Result r1 = new Result(); r1 = (Result)rl1._results[0]; s = " <p><h3> Component Scores for "; s += pupil1.m_GivenName + " " + pupil1.m_Surname + " for " + exo1.m_OptionTitle + "(" + r1.Text + ")</h3></p>"; s += "This table gives your component marks for this subject. Please note these are <b>not</b> UMS marks. "; s += "<br/> The sum of the component marks gives your TQM (Total Qualification Mark), which leads to your final grade."; s += "The table below tells you how the TQM is related to the final grade, i.e. the grade boundaries, if we know them! If not, please speak to a member of staff in school."; s += "<br/><br /> Note that for Drama and Music the non-integer Scaling factors may mean that the component marks do not exactly add up to the TQM. In this case the TQM is CORRECT!<br/>"; s += "<br/><br /><TABLE BORDER class=\"ResultsTbl\" style = \"font-size:small\" align=\"center\">"; s += "<TR><th>Syllabus Code</th><th>Option Code</th><th>Component Code</th><th>Component Name</th>"; s += "<th>Mark</th> <th>Max Mark</th></tr>"; foreach (ExamComponentResult r in ecrl1.m_list) { ec1.Load(r.ComponentId); s += "<tr align=\"center\">"; s += "<td>" + exo1.m_Syllabus_Code + "</td>"; s += "<td>" + exo1.m_OptionCode + "</td>"; s += "<td>" + ec1.m_ComponentCode + "</td>"; s += "<TD>" + ec1.m_ComponentTitle + "</td>"; s += "<td>" + r.ComponentScaledMark.ToString() + "</td>"; s += "<td>" + ec1.m_MaximumMark.ToString() + "</td>"; s += " </tr>"; } s += "</table>"; ExamTQMBoundaryList bl1 = new ExamTQMBoundaryList();//will be ordered largest first bl1.LoadList(new Guid(id1), exo1.m_year_Code, exo1.m_Season_code); s += "<br/><br/>"; s += " <p><h3 align=\"center\" > TQM Grade Boundaries</h3></p>"; s += "<TABLE BORDER class=\"TimetableTable\" style = \"font-size:small\" align=\"center\" >"; s += "<tr><th>Grade</th><th> TQM </th></tr>"; foreach (ExamTQMBoundary eb in bl1.m_list) { s += "<tr><td>" + eb.Grade + "</td><td>" + eb.Mark + "</td></tr>"; } s += "</table>"; content.InnerHtml = s; } } }
protected void DropDownList_Options_SelectedIndexChanged(object sender, EventArgs e) { //so option selection .. need to get TQM data ExamTQMBoundaryList bl1 = new ExamTQMBoundaryList();//will be ordered largest first bl1.LoadList(new Guid(DropDownList_Options.SelectedValue), YearCode.ToString(), SeasonCode.ToString()); Current_Data.InnerHtml = UpdateCurrentData(bl1); }
protected void Button_Delete_Click(object sender, EventArgs e) { ExamOption ex1 = new ExamOption(); ex1.Load(new Guid(DropDownList_Options.SelectedValue)); if (!ex1.m_valid) { //flag error return; } ExamTQMBoundaryList exTQMlist1 = new ExamTQMBoundaryList(); exTQMlist1.LoadList(ex1.m_OptionID, YearCode.ToString(), SeasonCode.ToString()); foreach (ExamTQMBoundary eb in exTQMlist1.m_list) { eb.Delete(); } exTQMlist1.LoadList(ex1.m_OptionID, YearCode.ToString(), SeasonCode.ToString()); Current_Data.InnerHtml = UpdateCurrentData(exTQMlist1); }
protected void Button1_Click(object sender, EventArgs e) { //file has Board short name/optioncode/grade/mark if (!FileUpload1.HasFile) { return; } Cerval_Library.TextReader TxtRd1 = new Cerval_Library.TextReader(); TextRecord t = new TextRecord(); int l = 0; int n = 0; string s1 = ""; char ct = (char)0x09; int n_Board = 0; int n_OptionCode = 0; int n_Grade = 0; int n_Mark = 0; bool f_Board = false; bool f_OptionCode = false; bool f_Grade = false; bool f_Mark = false; while (TxtRd1.ReadTextLine(FileUpload1.FileContent, ref t) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID) { l = s1.Length; for (int i = 0; i <= t.number_fields; i++) { s1 += t.field[i] + ct; } if (s1.Length > l) { s1 += Environment.NewLine; } if (n == 0) { //going to look for our columns: for (int i = 0; i <= t.number_fields; i++) { switch (t.field[i]) { case "Board": n_Board = i; f_Board = true; break; case "Option": n_OptionCode = i; f_OptionCode = true; break; case "Mark": n_Mark = i; f_Mark = true; break; case "Grade": n_Grade = i; f_Grade = true; break; default: break; } } // so do we have all the required columns?? if (!(f_Board && f_OptionCode && f_Grade && f_Mark)) { Label_Text.Text = "Can't recognise the format of this file. "; if (!f_Board) { Label_Text.Text += "No Board Column"; } if (!f_OptionCode) { Label_Text.Text += "No Option Column"; } if (!f_Mark) { Label_Text.Text += "No Mark Column"; } if (!f_Grade) { Label_Text.Text += "No Grade Column"; } return; } else { Label_Text.Text = "File Format Fine: "; } } } //so process the file... string s2 = ""; char[] ct1 = new char[1]; ct1[0] = (char)0x09; string[] fields = new string[20]; using (StringReader sr = new StringReader(s1)) { string firstline = sr.ReadLine(); string line; while ((line = sr.ReadLine()) != null) { fields = line.Split(ct1); bool found = false; Exam_Board eb1 = new Exam_Board(); eb1.Load(fields[n_Board]); ExamOption eo1 = new ExamOption(); if (eo1.Load(fields[n_OptionCode], SeasonCode.ToString(), YearCode.ToString(), eb1.m_ExamBoardId)) { //valid option cod ExamTQMBoundaryList l1 = new ExamTQMBoundaryList(); l1.LoadList(eo1.m_OptionID, YearCode.ToString(), SeasonCode.ToString()); foreach (ExamTQMBoundary b in l1.m_list) { if (b.Grade == fields[n_Grade]) { b.Mark = Convert.ToInt32(fields[n_Mark]); b.Save(); found = true; s2 += eb1.m_OrganisationFriendlyName + ct + eo1.m_OptionCode + ct + eo1.m_OptionTitle + ct + b.Grade + ct + b.Mark + ct + "Updated" + System.Environment.NewLine; } } if (!found) { ExamTQMBoundary etqm1 = new ExamTQMBoundary(); etqm1.OptionId = eo1.m_OptionID; etqm1.Mark = Convert.ToInt32(fields[n_Mark]); etqm1.Grade = fields[n_Grade]; etqm1.OptionCode = eo1.m_OptionCode; etqm1.OptionTitle = eo1.m_OptionTitle; etqm1.Season = SeasonCode.ToString(); etqm1.Year = YearCode.ToString(); etqm1.Version = 22; etqm1.Save(); s2 += eb1.m_OrganisationFriendlyName + ct + eo1.m_OptionCode + ct + eo1.m_OptionTitle + ct + etqm1.Grade + ct + etqm1.Mark + ct + "New Entry" + System.Environment.NewLine; } } } Label_Text.Text = " Completed... saved as below:"; TextBox1.Text = s2; } }