private void LoadFromModel(ExamComponent model) { BaseComponentId = model.BaseComponentId; ExamSeriesId = model.ExamSeriesId; AssessmentModeId = model.AssessmentModeId; ExamDateId = model.ExamDateId; DateDue = model.DateDue; DateSubmitted = model.DateSubmitted; MaximumMark = model.MaximumMark; if (model.BaseComponent != null) { BaseComponent = new ExamBaseComponentModel(model.BaseComponent); } if (model.Series != null) { Series = new ExamSeriesModel(model.Series); } if (model.AssessmentMode != null) { AssessmentMode = new ExamAssessmentModeModel(model.AssessmentMode); } if (model.ExamDate != null) { ExamDate = new ExamDateModel(model.ExamDate); } }
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 AddSupervision(DateTime t_start, DateTime t_end, ScheduledComponent sc) { ScheduledComponent sched1 = new ScheduledComponent(); TimeSpan tgap = new TimeSpan(); tgap = t_end - t_start; if ((tgap.TotalMinutes >= 10) && (tgap.TotalDays < 2)) { ExamConversions u = new ExamConversions(); ExamComponent ec1 = new ExamComponent(); ec1.m_ComponentCode = "Super"; ec1.m_ComponentTitle = "Supervision"; ec1.m_ComponentTitle += "-" + sc.GetHashCode().ToString(); ec1.m_ExamBoardID = new Guid("436ff234-0457-430a-b1e2-b08758ff30ef"); ec1.m_year = Year.ToString().Substring(2, 2); ec1.m_season = u.GetSeasonCode(SeasonCode); ec1.m_Teachermarks = "0"; ec1.m_MaximumMark = "0"; ec1.m_Timetabled = "T"; ec1.m_TimetableDate = t_start; ec1.m_TimetableSession = "A"; ec1.m_Time = tgap.TotalMinutes.ToString(); //now if the brat has extra time we need to reduce...>!!!! StudentSENList ssen1 = new StudentSENList(sc.m_StudentId.ToString()); double extra_time = 0; double time1 = tgap.TotalMinutes; //now if the brat has extra time we need to reduce.. becasue it will be increased by code when read... foreach (StudentSEN sen1 in ssen1.m_List) { if (sen1.m_ExamsExtraTime > 0) { extra_time = (double)sen1.m_ExamsExtraTime; } } time1 = time1 / ((100 + extra_time) / 100); int i = (int)time1; ec1.m_Time = i.ToString(); ec1.Create(); ec1.m_ComponentID = ec1.Find_ComponentID(ec1.m_ComponentCode, ec1.m_ComponentTitle, ec1.m_ExamBoardID.ToString(), ec1.m_season, ec1.m_year); if (ec1.m_ComponentID != Guid.Empty) { sched1.Load(ec1.m_ComponentID, sc.m_StudentId); if (!sched1.m_valid) { sched1.m_StudentId = sc.m_StudentId; sched1.m_ComponentId = ec1.m_ComponentID; sched1.m_RoomId = Guid.Empty; sched1.m_Year = Year.ToString(); sched1.m_Season = u.GetSeasonCode(SeasonCode); sched1.m_valid = true; sched1.m_Date = t_start; sched1.m_Desk = ""; sched1.m_Will_Type = false;// do these later... sched1.Save(); } } } }
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(); }
public System.Collections.Generic.List <ExamComponent> ExamsComponentsFromBaseData(Exam_Board eb, string season, string year) { System.Collections.Generic.List <ExamComponent> temp = new List <ExamComponent>(); while (year.Length > 2) { year = year.Substring(1, year.Length - 1); } string search = "C" + season + "?" + year + "_" + eb.m_LegacyExamBdId + ".X??"; string[] filelist = System.IO.Directory.GetFiles(path, search); foreach (string f in filelist) { Stream myStream; string line; int JCQ_Version = 0; if ((myStream = File.Open(f, FileMode.Open)) != null) { using (StreamReader sr = new StreamReader(myStream)) { 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") { ExamComponent eco1 = new ExamComponent(); eco1.LoadFromBaseData(line, JCQ_Version, eb.m_ExamBoardId.ToString()); temp.Add(eco1); } } } } } temp.Sort(); return(temp); }
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 void Button1_Click(object sender, EventArgs e) { //create table... List <ExamSyllabus> syllabuses = new List <ExamSyllabus>(); List <ExamComponent> components = new List <ExamComponent>(); List <ExamBaseOption> options = new List <ExamBaseOption>(); List <ExamLinkComponent> Links = new List <ExamLinkComponent>(); string s = TextBox1.Text; Label1.Text = ""; Label1.BackColor = System.Drawing.Color.White; string[] s1 = new string[20]; char[] c1 = new char[2]; char c2 = (char)0x09; c1[0] = c2; c1[1] = ','; string[] s2 = new string[1]; s2[0] = Environment.NewLine; string [] s3 = new string[10]; s1 = s.Split(s2, StringSplitOptions.RemoveEmptyEntries); int n = -1; bool correct = true; string errorstring = ""; foreach (string s5 in s1) { n++; if (n == 0) { //so this needs to be Subject Option Component CODE Date Length AM/PM s3 = s5.Split(c1); correct = (s3[0].ToUpper() == "SUBJECT") && (s3[1].ToUpper() == "OPTION") && (s3[2].ToUpper() == "COMPONENT"); correct = correct && (s3[3].ToUpper() == "CODE"); correct = correct && (s3[4].ToUpper() == "DATE") && (s3[5].ToUpper() == "LENGTH") && (s3[6].ToUpper() == "AM/PM"); } if (!correct) { errorstring = "Header Row incorrect; should be Subject Option Component Date Length AM/PM"; break; } if (n > 0) { s3 = s5.Split(c1); int k = 1; //so s3[0] has subject ExamSyllabus es1 = new ExamSyllabus(); es1.m_Syllabus_Title = s3[0]; es1.m_Syllabus_Code = s3[0].Substring(0, 2) + k.ToString(); while (es1.m_Syllabus_Code.Length < 6) { es1.m_Syllabus_Code += " "; } while (es1.m_Syllabus_Title.Length < 36) { es1.m_Syllabus_Title += " "; } //check code unique foreach (ExamSyllabus es in syllabuses) { if ((es.m_Syllabus_Code == es1.m_Syllabus_Code) && (es.m_Syllabus_Title != es1.m_Syllabus_Title)) { k++; es1.m_Syllabus_Code = s3[0].Substring(0, 2) + k.ToString(); while (es1.m_Syllabus_Code.Length < 6) { es1.m_Syllabus_Code += " "; } } } syllabuses.Add(es1); ExamBaseOption ebo1 = new ExamBaseOption(); ebo1.m_Title = s3[1]; k = 1; if (s3[1].Contains("[")) { //use defined code after [ int i1 = s3[1].IndexOf("["); int i2 = s3[1].IndexOf("]"); ebo1.m_OptionEntryCode = s3[1].Substring(i1 + 1, i2 - i1 - 1); ebo1.m_Title = s3[1].Substring(0, i1); } else { ebo1.m_OptionEntryCode = s3[1].Substring(0, 2) + k.ToString(); //check code unique foreach (ExamBaseOption ebo in options) { if ((ebo.m_OptionEntryCode == ebo1.m_OptionEntryCode) && (ebo.m_Title != ebo1.m_Title)) { k++; ebo1.m_OptionEntryCode = s3[1].Substring(0, 2) + k.ToString(); while (ebo1.m_OptionEntryCode.Length < 6) { ebo1.m_OptionEntryCode += " "; } } } } ebo1.m_SyllabusCode = es1.m_Syllabus_Code; while (ebo1.m_OptionEntryCode.Length < 6) { ebo1.m_OptionEntryCode += " "; } while (ebo1.m_Title.Length < 36) { ebo1.m_Title += " "; } options.Add(ebo1); ExamComponent ec1 = new ExamComponent(); k = 1; int t1 = 0; ec1.m_ComponentCode = s3[3]; ec1.m_ComponentTitle = s3[2]; ec1.m_Time = s3[5]; ec1.m_TimetableDate = new DateTime(); try { ec1.m_TimetableDate = System.Convert.ToDateTime(s3[4]); }catch { errorstring = "Time must be in format dd/mm/yyyy"; correct = false; break; } ec1.m_TimetableSession = s3[6]; try { t1 = Convert.ToInt16(s3[5]); } catch { errorstring = "Length must be an integer."; correct = false; break; } while (ec1.m_Time.Length < 3) { ec1.m_Time = "0" + ec1.m_Time; } while (ec1.m_ComponentCode.Length < 12) { ec1.m_ComponentCode += " "; } while (ec1.m_ComponentTitle.Length < 36) { ec1.m_ComponentTitle += " "; } //check code unique foreach (ExamComponent ec in components) { if ((ec.m_ComponentCode == ec1.m_ComponentCode) && (ec.m_ComponentTitle != ec1.m_ComponentTitle)) { k++; ec1.m_ComponentCode = s3[2].Substring(0, 2) + k.ToString(); while (ec1.m_ComponentCode.Length < 12) { ec1.m_ComponentCode += " "; } } } components.Add(ec1); ExamLinkComponent el0 = new ExamLinkComponent(); el0.m_ComponentCode = ec1.m_ComponentCode; el0.m_OptionCode = ebo1.m_OptionEntryCode; Links.Add(el0); TableRow r = new TableRow(); Table1.Rows.Add(r); TableCell cell1 = new TableCell(); cell1.Text = es1.m_Syllabus_Title; r.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.Text = es1.m_Syllabus_Code; r.Cells.Add(cell2); TableCell cell3 = new TableCell(); cell3.Text = ebo1.m_Title; r.Cells.Add(cell3); TableCell cell4 = new TableCell(); cell4.Text = ebo1.m_OptionEntryCode; r.Cells.Add(cell4); TableCell cell5 = new TableCell(); cell5.Text = ec1.m_ComponentTitle; r.Cells.Add(cell5); TableCell cell6 = new TableCell(); cell6.Text = ec1.m_ComponentCode; r.Cells.Add(cell6); TableCell cell7 = new TableCell(); cell7.Text = ec1.m_TimetableDate.ToShortDateString(); r.Cells.Add(cell7); TableCell cell8 = new TableCell(); cell8.Text = ec1.m_Time.ToString(); r.Cells.Add(cell8); TableCell cell9 = new TableCell(); cell9.Text = ec1.m_TimetableSession; r.Cells.Add(cell9); } } if (correct) { Table1.Visible = true; Label1.Text = "Data Correctly Parsed....."; Button_Upload.Visible = true; ViewState["syllabuses"] = syllabuses; ViewState["components"] = components; ViewState["options"] = options; ViewState["Links"] = Links; } else { Label1.Text = errorstring; Label1.BackColor = System.Drawing.Color.Red; } }
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); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utility u1 = new Utility(); DateTime t1 = new DateTime(); DateTime t0 = new DateTime(); DateTime t2; t0 = u1.ThisExamSeasonStart(); t1 = u1.ThisExamSeasonEnd(t0); string season = u1.ThisSeason(t0); season = "3"; ArrayList m_list = new ArrayList(); PersonID = u1.GetPersonIdfromRequest(Request); #if DEBUG u1.Is_student = true; u1.Is_student = true; PersonID = u1.GetPersonIDX(@"CHALLONERS\william.arnold");//development #endif string s = ""; string s1 = ""; if ((PersonID != Guid.Empty) && (u1.Is_student)) { s1 += "<br><center><h2>Exam Entries</h2></center>"; s1 += "<p align=\"center\"><TABLE BORDER><Tr>"; s = "Option"; s1 += "<Th>" + s + "</Th>"; s = "Code"; s1 += "<Th>" + s + "</Th>"; s = "Qualification"; s1 += "<Th>" + s + "</Th>"; s = "Level"; s1 += "<Th>" + s + "</Th>"; s = "Status"; s1 += "<Th>" + s + "</Th>"; s1 += "</Tr>"; ExamEntries_List exl1 = new ExamEntries_List(); exl1.Load(u1.GetStudentId(PersonID)); foreach (Exam_Entry ex1 in exl1.m_list) { ExamOption exo1 = new ExamOption(); exo1.Load(ex1.m_OptionID); //if ((ex1.m_season == season) && (ex1.m_year == t0.Year.ToString())&&(!ex1.m_withdrawn)) if ((ex1.m_year == t0.Year.ToString()) && (!ex1.m_withdrawn)) { //ExamOption exo1 = new ExamOption(); exo1.Load(ex1.m_OptionID); //if (exo1.m_Item == "C") { s1 += "<TR>"; s = exo1.m_OptionTitle; s1 += "<TD>" + s + "</TD>"; s = exo1.m_OptionCode; s1 += "<TD>" + s + "</TD>"; s = exo1.m_OptionQualification; s1 += "<TD>" + s + "</TD>"; if (exo1.m_OptionLevel != "B") { s = exo1.m_OptionLevel; s1 += "<TD>" + s + "</TD>"; } else { s1 += "<TD></TD>"; } if (ex1.m_EntryFileID == Guid.Empty) { //if DCGS board then Mock/Internal exam if (exo1.m_ExamBoardID.ToString() == "436ff234-0457-430a-b1e2-b08758ff30ef") { //so internal.. if Jan is mocks.. if (exo1.m_Season_code == "1") { s1 += "<td>Mock</td>"; } else { s1 += "<td>Internal</td>"; } } else { s1 += "<TD>Provisional</TD>"; } } else { s1 += "<TD>Entered</TD>"; } s1 += "</TR>"; } ExamCompononent_List excl1 = new ExamCompononent_List(); excl1.Load(ex1.m_OptionID); foreach (ExamComponent ec in excl1.m_list) { if (ec.m_Timetabled == "T") { ExamComponent ec2 = new ExamComponent(); ec2 = ec; m_list.Add(ec2); ec2.m_OptionTitle = exo1.m_Syllabus_Title; } } } } s1 += "</TABLE>"; s1 += "<center>FC = Full Course, SC = Short(Half) Course<br>"; foreach (ExamComponent ec in m_list) { t2 = System.Convert.ToDateTime(ec.m_TimetableDate); if (t2 < t1) { t1 = System.Convert.ToDateTime(ec.m_TimetableDate); } if (t2 > t0) { t0 = System.Convert.ToDateTime(ec.m_TimetableDate); } } int month = t1.Month; ExamComponent ecx; int day = t1.Day; s1 += "<br><br><br><center><h2>Outline Exam Timetable</h2>"; s1 += "Full Exam Timetable can be found <a href=\"ExamTimetables.aspx?\">here</a></center>"; s1 += "<center>Note that for GCSE Languages the tier (Foundation or Higher) is not significant. "; s1 += "<BR><p align=\"center\"><TABLE BORDER><TR>"; s = "Date"; s1 += "<Th>" + s + "</Th>"; s = "AM Session"; s1 += "<Th>" + s + "</Th>"; s = "PM Session"; s1 += "<Th>" + s + "</Th>"; s1 += "</TR>"; //from t1 to t0... t2 = t1; t0 = t0.AddDays(1); while (t2 < t0) { if ((t2.DayOfWeek.ToString() != "Saturday") && (t2.DayOfWeek.ToString() != "Sunday")) { s1 += "<TR>"; s = t2.DayOfWeek.ToString(); s += "<br>" + t2.ToShortDateString(); s1 += "<TD>" + s + "</TD>"; s = ""; ecx = null; foreach (ExamComponent ec in m_list) { if ((t2 == System.Convert.ToDateTime(ec.m_TimetableDate)) && (ec.m_TimetableSession == "A")) { s += ec.m_OptionTitle + ec.m_ComponentTitle.ToLower() + "<br>"; ecx = ec; } } if (ecx != null) { m_list.Remove(ecx); } s1 += "<TD>" + s + "</TD>"; s = ""; ecx = null; foreach (ExamComponent ec in m_list) { if ((t2 == System.Convert.ToDateTime(ec.m_TimetableDate)) && (ec.m_TimetableSession == "P")) { s += ec.m_OptionTitle + ec.m_ComponentTitle.ToLower() + "<br>"; ecx = ec; } } m_list.Remove(ecx); s1 += "<TD>" + s + "</TD>"; s1 += "</TR>"; } t2 = t2.AddDays(1); } s1 += "</TABLE>"; servercontent.InnerHtml = s1; } } }
public ExamComponentModel(ExamComponent model) : base(model) { LoadFromModel(model); }
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"; }