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_Components_SelectedIndexChanged(object sender, EventArgs e) { //so a component is selected ExamComponent ec1 = new ExamComponent(); ec1.Load(new Guid(DropDownList_Component.SelectedValue.ToString())); TextBoxValue.Text = ec1.m_MaximumMark; Label1.Text = "Current Max Mark for " + ec1.m_ComponentCode + " is:"; }
protected void ButtonUpdate_Click(object sender, EventArgs e) { //so do it? ExamComponent ec1 = new ExamComponent(); ec1.Load(new Guid(DropDownList_Component.SelectedValue.ToString())); ec1.m_MaximumMark = TextBoxValue.Text; ec1.Save(); }
protected void Button_PullBaseData_Click(object sender, EventArgs e) { // so first we are going to get a list of all options used... int c = 0; c = System.Convert.ToInt32(TextBox_CycleNumber.Text); ISAMS_OptionsUsed_List list1 = new ISAMS_OptionsUsed_List(); list1.LoadList(c); string s = ""; foreach (ISAMS_OptionUsed o in list1.m_list) { s += o.m_OptionCode; //need the Cerval ExamBde Guid Exam_Board CExamBoard = new Exam_Board(o.m_UABCode); // so load option / link /components ISAMS_ExamOption Opt = new ISAMS_ExamOption(); Opt.Load(c, o.m_OptionCode, o.m_UABCode); s += " : " + Opt.m_OptionTitle; ISAMS_ExamSyllabus Syl = new ISAMS_ExamSyllabus(); Syl.Load(Opt.m_cycle, Opt.m_ExamBoardCode, Opt.m_Syllabus_Code); ISAMS_ExamLink_List Link = new ISAMS_ExamLink_List(); Link.LoadList_Option(Opt.m_OptionCode, Opt.m_ExamBoardCode, Opt.m_cycle); //so try to find the Ceral Syllabus ExamSyllabus CSyllabus = new ExamSyllabus(); CSyllabus.Load(Syl.m_SyllabusCode, SeasonCode.ToString(), YearCode.ToString(), CExamBoard.m_ExamBoardId); if (!CSyllabus.m_valid) { CSyllabus.m_ExamBoardId = CExamBoard.m_ExamBoardId; CSyllabus.m_Syllabus_Code = Syl.m_SyllabusCode; CSyllabus.m_Syllabus_Title = Syl.m_SyllabusTitle; CSyllabus.m_SyllabusId = CSyllabus.CreateNew("22"); } //now try to find the option ExamOption COption = new ExamOption(); COption.Load(Opt.m_OptionCode, SeasonCode.ToString(), YearCode.ToString(), Opt.m_ExamBoardCode); if (COption.m_valid) { //option found... } else { //option not found need to create... COption.m_SyllabusID = CSyllabus.m_SyllabusId; COption.m_OptionCode = Opt.m_OptionCode; COption.m_OptionTitle = Opt.m_OptionTitle; COption.m_OptionQualification = Opt.m_OptionQualification; COption.m_OptionLevel = Opt.m_OptionLevel; COption.m_Item = Opt.m_Item; COption.m_Process = Opt.m_Process; COption.m_QCACode = Opt.m_QCACode; COption.m_QCANumber = Opt.m_QCANumber; COption.m_fee = Opt.m_fee; COption.m_OptionMaximumMark = Opt.m_OptionMaximumMark; COption.m_year_Code = YearCode.ToString(); COption.m_Season_code = SeasonCode.ToString(); COption.m_SeriesIdentifier = Opt.m_SeriesIdentifier; COption.m_OptionID = COption.CreateNew("22"); } foreach (ISAMS_ExamLink el1 in Link.m_list) { ISAMS_ExamComponent ec1 = new ISAMS_ExamComponent(); ec1.Load(el1.m_ComponentCode, Opt.m_cycle, Opt.m_ExamBoardCode); s += " & " + ec1.m_ComponentTitle; //so should be able to insert into Cerval //OK so now the components... ExamComponent CComp = new ExamComponent(); CComp.Load(ec1.m_ComponentCode, SeasonCode.ToString(), YearCode.ToString()); if (!CComp.m_valid) { //so need to create CComp.m_ComponentCode = ec1.m_ComponentCode; CComp.m_ComponentTitle = ec1.m_ComponentTitle; CComp.m_ExamBoardID = CExamBoard.m_ExamBoardId; CComp.m_year = YearCode.ToString(); CComp.m_season = SeasonCode.ToString(); CComp.m_Teachermarks = ec1.m_Teachermarks; CComp.m_MaximumMark = ec1.m_MaximumMark; CComp.m_Due_Date = ec1.m_Due_Date; CComp.m_Timetabled = ec1.m_Timetabled; CComp.m_TimetableSession = ec1.m_TimetableSession; CComp.m_Time = ec1.m_TimeAllowed; DateTime t1 = new DateTime(); t1 = System.Convert.ToDateTime(ec1.m_TimetableDate); CComp.m_TimetableDate = t1; CComp.m_ComponentID = CComp.CreateNew(); } ExamLinkComponent_List l2 = new ExamLinkComponent_List(); l2.LoadList_OptionComponent(COption.m_OptionID, CComp.m_ComponentID); if (l2.m_list.Count == 0) { //need to make the link ExamLinkComponent Clink = new ExamLinkComponent(); Clink.m_OptionId = COption.m_OptionID; Clink.m_ComponentId = CComp.m_ComponentID; Clink.CreateNew("22"); } } s += Environment.NewLine; } TextBox_test.Text = s; }
protected bool Apply_Rule(string rule, Guid rule_roomId, ScheduledComponentList scl1, ref string ErrorS, List <Guid> Components, List <int> number, ref int RoomCapacity) { int n = 0; ExamRoom er = new ExamRoom(); switch (rule) { case "None": break; case "ExtraTime": n = 0; ExamComponent ec1 = new ExamComponent(); int time1 = 0; foreach (ScheduledComponent c in scl1.m_List) { ec1.Load(c.m_ComponentId); time1 = Convert.ToInt32(ec1.m_Time); if ((c.m_TimeAllowed > time1) && (c.m_RoomId == Guid.Empty)) { n++; } } er.Load(rule_roomId); if (n > er.m_capacity) { ErrorS = "Rule" + rule + " Exceeds capacity in" + DropDownList_Rule1Room.Text; return(false); } foreach (ScheduledComponent c in scl1.m_List) { ec1.Load(c.m_ComponentId); time1 = Convert.ToInt32(ec1.m_Time); if ((c.m_TimeAllowed > time1) && (c.m_RoomId == Guid.Empty)) { c.m_RoomId = rule_roomId; c.Save(); n = 0; RoomCapacity--; foreach (Guid d in Components) { if (d == c.m_ComponentId) { number[n]--; } n++; } } } break; case "Typists": n = 0; foreach (ScheduledComponent c in scl1.m_List) { if ((c.m_Will_Type) && (c.m_RoomId == Guid.Empty)) { n++; } } er.Load(rule_roomId); if (n > er.m_capacity) { ErrorS = "Rule" + rule + " Exceeds capacity in" + DropDownList_Rule1Room.Text; return(false); } foreach (ScheduledComponent c in scl1.m_List) { if ((c.m_Will_Type) && (c.m_RoomId == Guid.Empty)) { c.m_RoomId = rule_roomId; c.Save(); n = 0; RoomCapacity--; foreach (Guid d in Components) { if (d == c.m_ComponentId) { number[n]--; } n++; } } } break; default: //it is a rule based on a component foreach (ScheduledComponent c in scl1.m_List) { if ((c.m_ComponentCode == rule) && (c.m_RoomId == Guid.Empty)) { n++; } } er.Load(rule_roomId); if (n > er.m_capacity) { ErrorS = "Rule" + rule + " Exceeds capacity in" + DropDownList_Rule1Room.Text; return(false); } foreach (ScheduledComponent c in scl1.m_List) { if ((c.m_ComponentCode == rule) && (c.m_RoomId == Guid.Empty)) { c.m_RoomId = rule_roomId; c.Save(); n = 0; RoomCapacity--; foreach (Guid d in Components) { if (d == c.m_ComponentId) { number[n]--; } n++; } } } break; } ErrorS += "Success_Rule1"; return(true); }
public Guid Find_Component(string c_file, string component, string ExamBoard, string season, string year, bool forceupdate) { ExamComponent com1 = new ExamComponent(); Guid com1ID = new Guid(); com1ID = Guid.Empty; Stream myStream; string line = ""; int JCQ_Version = 0; //try to find in db com1ID = com1.Find_ComponentID(component, ExamBoard, season, year); if ((com1ID != Guid.Empty) && !forceupdate) { return(com1ID); } //so not in db... find in c_file and make... try { if ((myStream = File.Open(c_file, FileMode.Open)) != null) { using (StreamReader sr = new StreamReader(myStream)) { ExamComponent examcom1 = new ExamComponent(); ExamComponent examcom2 = new ExamComponent();//used for forced update while ((line = sr.ReadLine()) != null) { if (line.Substring(0, 2) == "C1") { JCQ_Version = System.Convert.ToInt32(line.Substring(24, 2)); } if ((line.Substring(0, 2) == "C5") && (line.Substring(2, 12) == component)) { examcom1.m_ComponentCode = component; examcom1.LoadFromBaseData(line, JCQ_Version, ExamBoard); examcom1.m_season = season; examcom1.m_year = year; if (com1ID != Guid.Empty) { // we are doing a forced update..... and already know the ID.... examcom2.Load(com1ID);//has current db version..... //now if any significant changes need to delete current scheduled components... examcom1.m_ComponentID = com1ID; if (!examcom1.EqualTo(examcom2)) { ScheduledComponentList scl1 = new ScheduledComponentList(); scl1.LoadList(com1ID); foreach (ScheduledComponent sc1 in scl1.m_List) { sc1.Delete(); } } examcom1.Save(); } else { examcom1.Create(); } return(Find_Component("", component, ExamBoard, season, year, false)); } } } } } catch (Exception e1) { System.Windows.Forms.MessageBox.Show("Error writing the component file... " + e1.Message, "File Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); } //not found - this could be a poblem System.Windows.Forms.MessageBox.Show("Warning.... Can't find a component: " + component, "Warning", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); return(com1ID); }
protected void Button_Process_Click(object sender, EventArgs e) { string s = TextBox1.Text; TextFileType ftype1 = TextFileType.Unknown; try { ftype1 = (TextFileType)ViewState["TextFileType"]; } catch { Label_Text.Text = "File Type not recognised"; return; } if (ftype1 == TextFileType.Unknown) { Label_Text.Text = "Board Not Set!!!"; 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; Exam_Board eb1 = new Exam_Board(); SimplePupil p1 = new SimplePupil(); ExamComponent ec1 = new ExamComponent(); ExamOption exo1 = new ExamOption(); ExamComponentResultList ecrl1 = new ExamComponentResultList(); string component_code = ""; int adno1 = 0; string Option_Code = ""; string ScaledMark = ""; string ComponentUMS = ""; string ComponentStatus = ""; string TQM_value = ""; int n_Year = (int)ViewState["n_Year"]; int n_Season = (int)ViewState["n_Season"]; int n_OptionCode = (int)ViewState["n_OptionCode"]; int n_TQM = (int)ViewState["n_TQM"]; int n_ComponentCode = (int)ViewState["n_ComponentCode"]; int n_ComponentUMS = (int)ViewState["n_ComponentUMS"]; int n_ScaledMark = (int)ViewState["n_ScaledMark"]; int n_Status = (int)ViewState["n_Status"]; int n_CandNo = (int)ViewState["n_CandNo"]; int number_entered = 0; //get exam board.... switch (ftype1) { case TextFileType.Unknown: return; case TextFileType.AQA_GCE: eb1 = new Exam_Board("70"); break; case TextFileType.OCR_GCE: eb1 = new Exam_Board("01"); break; case TextFileType.EDEXCEL_GCE: eb1 = new Exam_Board("11"); break; case TextFileType.AQA_GCSE: eb1 = new Exam_Board("70"); break; case TextFileType.OCR_GCSE: break; case TextFileType.EDEXCEL_GCSE: eb1 = new Exam_Board("10"); break; case TextFileType.CIE: eb1 = new Exam_Board("02"); break; case TextFileType.WJEC_GCSE: eb1 = new Exam_Board("40"); break; case TextFileType.WJEC_GCE: eb1 = new Exam_Board("41"); break; default: break; } using (StringReader sr = new StringReader(s)) { string firstline = sr.ReadLine(); string line; while ((line = sr.ReadLine()) != null) { fields = line.Split(ct1); adno1 = 0; component_code = ""; Option_Code = ""; ScaledMark = ""; ComponentUMS = ""; ComponentStatus = ""; adno1 = Convert.ToInt32(fields[n_CandNo]); if (Year.ToString() != fields[n_Year]) { Label_Text.Text = "Year code mismatch in file, line" + number_entered.ToString(); return; } if (SeasonCode.ToString() != fields[n_Season].Substring(0, 1)) { Label_Text.Text = "Series code mismatch in file, line" + number_entered.ToString(); return; } component_code = fields[n_ComponentCode]; Option_Code = fields[n_OptionCode]; ScaledMark = fields[n_ScaledMark]; ComponentUMS = fields[n_ComponentUMS]; ComponentStatus = fields[n_Status]; TQM_value = fields[n_TQM]; ExamComponentResult r = new ExamComponentResult(); try { p1.Load_StudentIdOnly(adno1); ec1.Load(component_code, SeasonCode.ToString(), YearCode.ToString()); exo1.Load(Option_Code, SeasonCode.ToString(), YearCode.ToString(), eb1.m_ExamBoardId); r.OptionId = exo1.m_OptionID; r.ComponentId = ec1.m_ComponentID; r.StudentId = p1.m_StudentId; try { r.ComponentScaledMark = System.Convert.ToInt32(ScaledMark); } catch { //assume it is non integer.... double d = Convert.ToDouble(ScaledMark); r.ComponentScaledMark = Convert.ToInt32(d); } try { r.ComponentUMS = System.Convert.ToInt32(ComponentUMS); } catch { } r.ComponentStatus = ComponentStatus; switch (ecrl1.Load_OptionStudent(r.OptionId, r.StudentId, r.ComponentId)) { case 0: //so can write in r.Save(); break; case 1: //so update r.ComponentResultId = ecrl1.m_list[0].ComponentResultId; r.Save(); break; case 2: //so problem break; default: break; } //now find the result.... ResultsList rl1 = new ResultsList(); rl1.m_parameters = 0; rl1.m_where = "WHERE (dbo.tbl_Core_Students.StudentId='" + r.StudentId.ToString() + "')AND(dbo.tbl_Core_Results.ExamsOptionId='" + r.OptionId.ToString() + "') "; rl1.LoadList("", ""); Result r1 = new Result(); r1 = (Result)rl1._results[0]; r1.Text = "TQM=" + TQM_value; r1.UpdateResultTextOnly(); number_entered++; } catch (Exception ex) { Label_Text.Text = ex.ToString(); } } } Label_Text.Text = "Correctly processed... " + number_entered.ToString() + " entries"; }