예제 #1
0
        public DataEntityDTO CreatePupil(
            Guid ID, 
            string legalForename, 
            string legalSurname, 
            Date dateOfBirth,
            Guid genderID,
            Guid schoolID, 
            int referenceID, 
            ExtensionDataObject extensionData)
        {
            DataEntityDTO.SimplePropertyDTOGuid IDProperty = new DataEntityDTO.SimplePropertyDTOGuid { Value = ID };
            DataEntityDTO.SimplePropertyDTOString legalForenameProperty = new DataEntityDTO.SimplePropertyDTOString { Value = legalForename };
            DataEntityDTO.SimplePropertyDTOString legalSurnameProperty = new DataEntityDTO.SimplePropertyDTOString { Value = legalSurname };
            DataEntityDTO.SimplePropertyDTODate dateOfBirthProperty = new DataEntityDTO.SimplePropertyDTODate { Value = dateOfBirth };
            DataEntityDTO.ReferencePropertyDTO schoolProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = schoolID };
            DataEntityDTO.ReferencePropertyDTO genderProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = genderID };
            DataEntityDTO entity = new DataEntityDTO
            {
                EntityName = "Learner",
                Values = new Dictionary<string, DataEntityDTO.SimplePropertyDTO>
                {
                    {"ID", IDProperty},
                    {"LegalForename", legalForenameProperty},
                    {"LegalSurname", legalSurnameProperty},
                    {"DateOfBirth", dateOfBirthProperty},
                    {"Gender", genderProperty},
                    {"School", schoolProperty}
                }
            };

            return PupilDetails.EntitySettings(entity, ID, referenceID, extensionData);
        }
예제 #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            // going to run through db and add any missing uci where we have an exam no...

            SimpleStudentList sl1    = new SimpleStudentList(SimpleStudentList.LIST_TYPE.NOFORM_ONROLE);
            PupilDetails      pupil1 = new PupilDetails();
            string            s      = "";

            ExamFiles ef = new ExamFiles();
            Encode    en = new Encode();
            int       n = 0; int n1 = 0;

            foreach (SimplePupil p in sl1._studentlist)
            {
                pupil1.m_UCI = "";
                pupil1.Load(p.m_StudentId.ToString());
                string year = DateTime.Now.Year.ToString();
                if ((pupil1.m_UCI == "") && (pupil1.m_examNo > 0))
                {
                    pupil1.m_UCI = ef.Calculate_UCI_Checksum("52205", "0", year, pupil1.m_examNo.ToString());
                    s            = "UPDATE dbo.tbl_Core_Students SET StudentUCI='" + pupil1.m_UCI + "' ";
                    s           += "WHERE StudentId = '" + p.m_StudentId.ToString() + "' ";
                    en.ExecuteSQL(s);
                    n++;
                }
                if (pupil1.m_examNo == 0)
                {
                    n1++;
                }
            }
            Label1.Text = "Created " + n.ToString() + " new UCIs.  There were " + n1.ToString() + " students found with no Exam Number!";
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility u = new Utility();

                Guid               g1     = u.GetPersonIdfromRequest(Request);
                MessageList        ml1    = new MessageList();
                MessageGroupList   mgl1   = new MessageGroupList();
                Group              group1 = new Group();
                PupilDetails       pupil1 = new PupilDetails();
                MessageStudentList msl1   = new MessageStudentList();
                PersonDetails      p2     = new PersonDetails(g1.ToString());
                ml1.LoadList_Person(g1, 20);
                bool   first = true;
                string s     = "<h4>Last 20 messages sent from " + p2.m_GivenName + " " + p2.m_Surname + "</h4>";
                s += "<br><table  border  class=\"EventsTable\"  >";
                s += "<tr><th>Valid From</th><th>Message</th><th>To</th><th>Delivered</th></tr>";
                foreach (Message m1 in ml1.m_list)
                {
                    first = true;
                    s    += "<tr><td>" + m1.ValidFrom.ToShortDateString() + "</td><td>" + m1.Msg + "</td>";
                    //fi nd groups
                    mgl1.LoadList_Message(m1.Id);
                    foreach (MessageGroup mg1 in mgl1.m_list)
                    {
                        group1.Load(mg1.GroupId);
                        if (!first)
                        {
                            s += "<tr><td></td><td></td>";
                        }
                        s += "<td>" + group1._GroupCode + "</td>";
                        if (mg1.Delivered)
                        {
                            s += "<td>" + mg1.DateDelivered + "</td>";
                        }
                        s    += "</tr>";
                        first = false;
                    }
                    msl1.LoadList_Message(m1.Id);
                    foreach (MessageStudent ms1 in msl1.m_list)
                    {
                        pupil1.Load(ms1.StudentId.ToString());
                        if (!first)
                        {
                            s += "<tr><td></td><td></td>";
                        }
                        s += "<td>" + pupil1.m_GivenName + " " + pupil1.m_Surname + "</td>";
                        if (ms1.Delivered)
                        {
                            s += "<td>" + ms1.DateDelivered.ToString() + "</td>";
                        }
                        s    += "</tr>";
                        first = false;
                    }
                }
                s += "</table>";
                content0.InnerHtml = s;
            }
        }
예제 #4
0
        public DataEntityDTO CreateStandardPupilLogNote(
            Guid ID, 
            string title, 
            string noteText, 
            Guid learnerID, 
            Guid categoryID, 
            Guid userID,
            bool pinned, 
            int collectionCount, 
            int referenceID, 
            ExtensionDataObject extensionData)
        {
            DataEntityDTO.SimplePropertyDTOGuid IDProperty = new DataEntityDTO.SimplePropertyDTOGuid { Value = ID };
            DataEntityDTO.SimplePropertyDTOString titleProperty = new DataEntityDTO.SimplePropertyDTOString { Value = title };
            DataEntityDTO.SimplePropertyDTOString noteTextProperty = new DataEntityDTO.SimplePropertyDTOString { Value = noteText };
            DataEntityDTO.SimplePropertyDTOBool pinnedProperty = new DataEntityDTO.SimplePropertyDTOBool { Value = pinned };
            DataEntityDTO.SimplePropertyDTODateTime createdOnProperty = new DataEntityDTO.SimplePropertyDTODateTime { Value = DateTime.Now };
            DataEntityDTO.SimplePropertyDTOGuid createdByProperty = new DataEntityDTO.SimplePropertyDTOGuid { Value = userID };
            DataEntityDTO.ReferencePropertyDTO learnerProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = learnerID };
            DataEntityDTO.ReferencePropertyDTO categoryProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = categoryID };

            DataEntityDTO entity = new DataEntityDTO
            {
                EntityName = "PupilLogNoteStandard",
                Values = new Dictionary<string, DataEntityDTO.SimplePropertyDTO>
                {
                    {"ID", IDProperty},
                    {"Title", titleProperty},
                    {"NoteText", noteTextProperty},
                    {"Pinned", pinnedProperty},
                    {"CreatedOn", createdOnProperty},
                    {"CreatedByUserId", createdByProperty},
                    {"Learner", learnerProperty},
                    {"PupilLogNoteCategory", categoryProperty}
                }
            };

            return PupilDetails.EntitySettings(entity, ID, referenceID, extensionData);
        }
예제 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString.Count >= 1)
                {
                    string type = Request.QueryString["Type"];
                    if (type == "Student")
                    {
                        string       Paper  = Request.QueryString["Paper"];
                        string       Date   = Request.QueryString["Date"];
                        string       Id     = Request.QueryString["Id"];
                        string       path   = Request.QueryString["path"];
                        PupilDetails pupil1 = new PupilDetails(Id);

                        //construct filename.....
                        string fname = path;
                        //date is 11/03/2012 etc.....
                        fname += Date.Substring(6, 4) + "_";
                        //for month want to go back to either 1 or 6.....
                        int m = System.Convert.ToInt16(Date.Substring(3, 2));
                        if (m < 5)
                        {
                            fname += "01_";
                        }
                        else
                        {
                            fname += "06_";
                        }
                        fname += Paper.Trim(); fname += ".txt";


                        //going to open the file

                        Cerval_Library.TextReader tr1 = new Cerval_Library.TextReader();
                        try
                        {
                            FileStream f1 = new FileStream(fname, FileMode.Open);
                            Cerval_Library.TextRecord tx1 = new TextRecord();
                            tr1.ReadTextLine(f1, ref tx1);
                            //field 3 onwards are q nos..
                            string[] questions = new string[50];
                            for (int i = 3; i < tx1.number_fields + 1; i++)
                            {
                                questions[i] = tx1.field[i];
                            }
                            tr1.ReadTextLine(f1, ref tx1);
                            //field 3 onwards are max marks..
                            string[] max = new string[50];
                            for (int i = 3; i < tx1.number_fields + 1; i++)
                            {
                                max[i] = tx1.field[i];
                            }

                            //row 3 has descriptions...
                            tr1.ReadTextLine(f1, ref tx1);
                            //field 3 onwards are max marks..
                            string[] desc = new string[50];
                            for (int i = 3; i < tx1.number_fields + 1; i++)
                            {
                                desc[i] = tx1.field[i];
                            }

                            while (tr1.ReadTextLine(f1, ref tx1) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID)
                            {
                                if (tx1.field[1].Trim() == pupil1.m_adno.ToString())
                                {
                                    string s = tx1.field[0];//this is uci
                                    s  = "<p ><h3>Paper Breakdowns for " + pupil1.m_GivenName + " " + pupil1.m_Surname + " for" + Paper + "</h3><br /><TABLE BORDER   class=\"ResultsTbl\" style = \"font-size:small ;  \">";
                                    s += "<tr><th>Question</th><th>Max Mark</th><th>Your Mark</th><th>Question Description</th></tr>";
                                    for (int i = 3; i < tx1.number_fields + 1; i++)
                                    {
                                        s += "<tr><td>" + questions[i] + "</td><td>" + max[i] + "</td><td>" + tx1.field[i] + "</td><td>" + desc[i] + "</td></tr>";
                                    }
                                    s += "</table>";

                                    s += "<br/><h3>Please  note these are raw not UMS marks.</h3>";
                                    content4.InnerHtml = s;
                                    f1.Close();
                                    break;
                                }
                            }
                            f1.Close();
                        }
                        catch
                        {
                            //assume file not found....
                            content4.InnerHtml = "<h3> No data found for this paper</h3>";
                        }
                    }
                }
            }
        }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //going to try to get from iSAMS data
                iSAMSLoad(); return;

                Utility  u1 = new Utility();
                DateTime t1 = new DateTime();
                DateTime t0 = new DateTime();
                t0 = DateTime.Now;
                t1 = t0.AddMonths(6);
                t0 = t0.AddMonths(-1);
                //SO   in future and up to 1 month in the past
                //string season = u1.ThisSeason(t0);

                //season = "3";

                ArrayList m_list   = new ArrayList();
                Guid      PersonID = new Guid();
                PersonID = u1.GetPersonIdfromRequest(Request);


#if DEBUG
                PersonID = u1.GetPersonIDX(@"CHALLONERS\charles.manning");//development
#endif

                //check they have read the exams notice...

                //string y = t0.Year.ToString();
                //bool v = false;
                //WarningNoticeRead w = new WarningNoticeRead(u1.GetStudentId(PersonID), u1.ThisSeason(t0), y, ref v);
                //if (!v)
                //{
                //Server.Transfer("ExamWarnings.aspx");//go and make them read the notice...
                //}

                PupilDetails p1 = new PupilDetails(u1.GetStudentId(PersonID).ToString());
                {
                    string s0 = "";
                    string s  = "PersonImagePage.aspx?id=" + p1.m_PersonId.ToString();
                    s  = "\"" + s;
                    s += "\" width = \"110\" height=\"140\"";
                    s  = "<FONT FACE = \"Arial\"><p align=\"center\"> <img src=" + s + "></p>";
                    s += "<p align=\"center\">This page should be printed and brought to all exams</p>";
                    {
                        s += "<center><h2>Exam Timetable for " + p1.m_GivenName + "  " + p1.m_Surname + "</h2></center>";
                        StudentSENList sen1 = new StudentSENList(p1.m_StudentId.ToString()); s0 = "";
                        foreach (StudentSEN s1 in sen1.m_List)
                        {
                            if (s1.m_ExamsExtraTime > 0)
                            {
                                s0 += "Extra Time (" + s1.m_ExamsExtraTime.ToString() + "%)  ";
                            }
                            if (s1.m_ExamsCanType)
                            {
                                s0 += " Can Type(Please report to IT4 for any exam where you wish to type)";
                            }
                        }
                        if (s0 != "")
                        {
                            s += "<center><h3>" + s0 + "</h3></center>";
                        }
                        ScheduledComponentList scl1 = new ScheduledComponentList();
                        t0 = t0.AddMonths(-3);
                        scl1.LoadList_Student(t0, t1, p1.m_StudentId.ToString());
                        SimpleRoom room1 = new SimpleRoom();
                        s += "<BR><center><TABLE BORDER><TR>";
                        s += "<Th>Date</Th>";
                        s += "<Th>Day</Th>";
                        s += "<Th>Start Time</Th>";
                        s += "<Th>End Time</Th>";
                        s += "<Th>Paper Code</Th>";
                        s += "<Th>Paper Name</Th>";
                        s += "<Th>Room</Th>";
                        s += "<Th>Desk</Th></TR>";
                        foreach (ScheduledComponent sc in scl1.m_List)
                        {
                            s += "<TR><TD>" + sc.m_Date.ToShortDateString() + "</TD>";
                            s += "<TD>" + sc.m_Date.DayOfWeek.ToString() + "</TD>";
                            t1 = sc.m_Date;
                            s += "<TD>" + sc.m_Date.ToShortTimeString() + "</TD>";
                            t1 = t1.AddMinutes(sc.m_TimeAllowed);
                            s += "<TD>" + t1.ToShortTimeString() + "</TD>";
                            s += "<TD>" + sc.m_ComponentCode + "</TD>";
                            s += "<TD>" + sc.m_ComponentTitle.ToLower() + "</TD>";
                            if (sc.m_RoomId != Guid.Empty)
                            {
                                room1.Load(sc.m_RoomId.ToString());
                                s += "<TD>" + room1.m_roomcode + "</TD>";
                            }
                            else
                            {
                                s += "<TD>not yet assigned</TD>";
                            }

                            s += "<TD>" + sc.m_Desk + "</TD></TR>";
                        }
                        s += "</TABLE></center>";
                    }
                    s += "<br><center><h3>Candidate Number = " + p1.m_examNo.ToString() + " , UCI=" + p1.m_UCI + "</h3></center></Font>";
                    servercontent.InnerHtml = s;
                }
            }
        }
예제 #7
0
        protected void Button_ShowTimetable_Click(object sender, EventArgs e)
        {
            GridView1.Visible = false;
            visibility(3);
            string       studentID = Label_StudentID.Text;
            PupilDetails p1        = new PupilDetails(studentID);
            {
                Utility  u1 = new Utility();
                DateTime t1 = new DateTime();
                DateTime t0 = new DateTime();
                t0 = DateTime.Now;
                t1 = t0.AddMonths(6);
                t0 = t0.AddMonths(-2);
                //string season = u1.ThisSeason(t0);
                ArrayList m_list = new ArrayList();

                string s = "PersonImagePage.aspx?id=" + p1.m_PersonId.ToString();
                s  = "\"" + s;
                s += "\" width = \"110\" height=\"140\"";
                Response.Write("<FONT FACE = \"Arial\"><p align=\"center\"> <img src=" + s + "></p>");
                {
                    Response.Write("<br><center><h2>Exam Timetable for " + p1.m_GivenName + "  " + p1.m_Surname + "</h2></center>");
                    StudentSENList sen1 = new StudentSENList(p1.m_StudentId.ToString()); s = "";
                    foreach (StudentSEN s1 in sen1.m_List)
                    {
                        if (s1.m_ExamsExtraTime > 0)
                        {
                            s += "Extra Time (" + s1.m_ExamsExtraTime.ToString() + "%)  ";
                        }
                        if (s1.m_ExamsCanType)
                        {
                            s += "  Can Type ";
                        }
                    }
                    if (s != "")
                    {
                        s = "<center><h3>" + s + "</h3></center>";
                        Response.Write(s);
                    }
                    ScheduledComponentList scl1 = new ScheduledComponentList();
                    scl1.LoadList_Student(t0, t1, studentID);
                    SimpleRoom room1 = new SimpleRoom();
                    Response.Write("<BR><p  align=\"center\" ><TABLE BORDER><TR>");
                    s = "Date"; Response.Write("<TD>" + s + "</TD>");
                    s = "Day"; Response.Write("<TD>" + s + "</TD>");
                    s = "Start Time"; Response.Write("<TD>" + s + "</TD>");
                    s = "End Time"; Response.Write("<TD>" + s + "</TD>");
                    s = "Paper Code"; Response.Write("<TD>" + s + "</TD>");
                    s = "Paper Name"; Response.Write("<TD>" + s + "</TD>");
                    s = "Room"; Response.Write("<TD>" + s + "</TD>");
                    s = "Desk"; Response.Write("<TD>" + s + "</TD>");
                    Response.Write("</TR>");
                    foreach (ScheduledComponent sc in scl1.m_List)
                    {
                        Response.Write("<TR>");
                        s  = sc.m_Date.ToShortDateString(); Response.Write("<TD>" + s + "</TD>");
                        s  = sc.m_Date.DayOfWeek.ToString(); Response.Write("<TD>" + s + "</TD>");
                        t1 = sc.m_Date;
                        s  = sc.m_Date.ToShortTimeString(); Response.Write("<TD>" + s + "</TD>");
                        t1 = t1.AddMinutes(sc.m_TimeAllowed);
                        s  = t1.ToShortTimeString(); Response.Write("<TD>" + s + "</TD>");
                        s  = sc.m_ComponentCode; Response.Write("<TD>" + s + "</TD>");
                        s  = sc.m_ComponentTitle.ToLower(); Response.Write("<TD>" + s + "</TD>");
                        if (sc.m_RoomId != Guid.Empty)
                        {
                            room1.Load(sc.m_RoomId.ToString());
                            s = room1.m_roomcode; Response.Write("<TD>" + s + "</TD>");
                        }
                        else
                        {
                            Response.Write("<TD>not yet assigned</TD>");
                        }

                        s = sc.m_Desk; Response.Write("<TD>" + s + "</TD>");
                        Response.Write("</TR>");
                    }
                    Response.Write("</TABLE>");
                }
                Response.Write("<br><center><h3>Candidate Number = " + p1.m_examNo.ToString() + " , UCI=" + p1.m_UCI + "</h3></center></Font>");
            }
        }
        /*
         *  private void RenderModuleResultLine(HttpResponse Response, Result r1,bool retake)
         *  {
         *      string s = "";
         *      ExamOption exo1 = new ExamOption();
         *      Response.Write("<TR>");
         *      s = r1.Date.ToShortDateString(); Response.Write("<TD>" + s + "</TD>");
         *      s = r1.Coursename; Response.Write("<TD>" + s + "</TD>");
         *      s = r1.OptionTitle; Response.Write("<TD>" + s + "</TD>");
         *      s = r1.OptionCode; Response.Write("<TD>" + s + "</TD>");
         *      s = r1.Value; Response.Write("<TD>" + s + "</TD>");
         *      s = r1.OptionMaximumMark; Response.Write("<TD>" + s + "</TD>");
         *
         *      s = "";
         *      if (r1.Resulttype == 27)//UMS mark for GCSE
         *      {
         *          try
         *          {
         *              double v1 = System.Convert.ToDouble(r1.Value);
         *              double v2 = System.Convert.ToDouble(r1.OptionMaximumMark);
         *              v1 = v1 / v2;
         *              if (v1 >= 0.9) s = "a*";
         *              if ((v1 < 0.9) && (v1 >= 0.8)) s = "a";
         *              if ((v1 < 0.8) && (v1 >= 0.7)) s = "b";
         *              if ((v1 < 0.7) && (v1 >= 0.6)) s = "c";
         *              if ((v1 < 0.6) && (v1 >= 0.5)) s = "d";
         *              if ((v1 < 0.5) && (v1 >= 0.4)) s = "e";
         *              if ((v1 < 0.4)) s = "u";
         *          }
         *          catch (Exception exc1)
         *          {
         *              s = exc1.Message;
         *          }
         *      }
         *      if (r1.Resulttype == 11)//GCE module mark
         *      {
         *          try
         *          {
         *              double v1 = System.Convert.ToDouble(r1.Value);
         *              double v2 = System.Convert.ToDouble(r1.OptionMaximumMark);
         *              v1 = v1 / v2;
         *              if (v1 >= 0.8) s = "a";
         *              if ((v1 < 0.8) && (v1 >= 0.7)) s = "b";
         *              if ((v1 < 0.7) && (v1 >= 0.6)) s = "c";
         *              if ((v1 < 0.6) && (v1 >= 0.5)) s = "d";
         *              if ((v1 < 0.5) && (v1 >= 0.4)) s = "e";
         *              if ((v1 < 0.4)) s = "u";
         *          }
         *          catch (Exception exc1)
         *          {
         *              s = exc1.Message;
         *          }
         *      }
         *
         *      Response.Write("<TD>" + s + "</TD>");
         *      exo1.Load(r1.OptionId);
         *      Exam_Board exb1 = new Exam_Board(exo1.m_ExamBoardID);
         *      Response.Write("<TD>" + exb1.m_OrganisationFriendlyName + "</TD>");
         *      if (retake)
         *      {
         *          CheckBox cb1 = new CheckBox();
         *          cb1.ID = "CheckBox-" + r1.OptionId.ToString() ;
         *          Response.Write("<TD><asp:CheckBox ID=\"" + cb1.ID.ToString() + "\"  runat=\"server\" /></TD>");
         *      }
         *      Response.Write("</TR>");
         *  }
         *
         *  private void RenderModuleResultTableHeader(HttpResponse Response, Guid PersonId,bool retake)
         *  {
         *      Utility u1 = new Utility();
         *      Response.Write("<H1><center> Module Results for " + u1.GetPersonName(PersonID) + "</H1></center><BR>");
         *      Response.Write("<BR><p  align=\"center\"><TABLE BORDER><TR>");
         *      Response.Write("<TD>Date</TD>");
         *      Response.Write("<TD>Subject</TD>");
         *      Response.Write("<TD>Option Title</TD>");
         *      Response.Write("<TD>Option Code</TD>");
         *      Response.Write("<TD>Result</TD>");
         *      Response.Write("<TD>Max Mark</TD>");
         *      Response.Write("<TD>Grade</TD>");
         *      Response.Write("<TD>Exam Board</TD>");
         *      if (retake) Response.Write("<TD>Retake ?</TD>");
         *      Response.Write("</TR>");
         *  }
         */
        protected void Button_submit_Click(object sender, EventArgs e)
        {
            Guid PersonID = (Guid)ViewState["PersonID"];

            Table1.Visible        = false;
            Label1.Visible        = false;
            TextBox_cost.Visible  = false;
            Button_submit.Visible = false;
            Label_title.Visible   = false;
            ExamOption           exo1 = new ExamOption();
            ExamCompononent_List ecl1 = new ExamCompononent_List();
            string  dates             = "";
            double  cost  = 0;
            double  total = 0;
            Utility u1    = new Utility();

            Guid[]       list1 = new Guid[100]; int no_list1 = 0; bool in_list1 = false;
            PupilDetails pupil1 = new PupilDetails(u1.GetStudentId(PersonID).ToString());

            int    cover_cost = RetakeCoverCost();
            string season     = RetakeSeason();
            string year       = RetakeYear();
            string s1         = RetakeMessage();
            string s2         = "";

            s2  = "<H2><center>Entry Requests for " + u1.GetPersonName(PersonID) + "  " + u1.Get_Form(pupil1.m_StudentId.ToString()) + "(" + pupil1.m_examNo.ToString() + ")</H2></center><BR>";
            s2 += "<H3><center>You should print this page and take it with your cheque ";
            s2 += "made out to DCGS to the Exams Office.</H3></center><BR><H3><center>" + s1 + "</H3></center><BR>";


            s2 += "<BR><p  align=\"center\"><TABLE BORDER><TR><TD>Option Code</TD><TD>Option Title</TD>";
            s2 += "<TD>Exam Board</TD><TD>Date</TD><TD>Cost</TD><TD>Comment</TD></TR>";

            resultlist1 = (ResultsList)ViewState["ResultList"];
            string   s   = "";
            CheckBox cb1 = new CheckBox();

            foreach (Result r1 in resultlist1._results)
            {
                s   = r1.OptionId.ToString(); cb1 = null;
                cb1 = (CheckBox)content.FindControl(s);
                if (cb1 != null)
                {
                    if (cb1.Checked)
                    {
                        exo1.Load(r1.OptionId);
                        ecl1.m_list.Clear();
                        ecl1.Load(r1.OptionId);
                        Exam_ResitEntry exres1 = new Exam_ResitEntry();
                        exres1.Load(r1.StudentID, r1.OptionId);
                        in_list1 = false;
                        for (int i = 0; i < no_list1; i++)
                        {
                            if (list1[i] == r1.OptionId)
                            {
                                in_list1 = true;
                            }
                        }

                        if (in_list1)
                        {
                            //already entered......
                        }
                        else
                        {
                            s2 += "<TR><TD>" + r1.OptionCode + "</TD><TD>" + r1.OptionTitle + "</TD>";
                            Exam_Board exb1 = new Exam_Board(exo1.m_ExamBoardID);
                            s2   += "<TD>" + exb1.m_OrganisationFriendlyName + "</TD>";
                            dates = "";
                            foreach (ExamComponent c1 in ecl1.m_list)
                            {
                                if (c1.m_Timetabled == "T")
                                {
                                    dates += c1.m_TimetableDate.ToShortDateString();
                                }
                            }
                            s2  += "<TD>" + dates + "</TD>";
                            cost = (double)exo1.m_feeInt + cover_cost;
                            exres1.Load(r1.StudentID, r1.OptionId);
                            if (!exres1.m_valid)
                            {
                                exres1.m_cost        = (int)cost;
                                exres1.m_DateCreated = DateTime.Now;
                                exres1.m_OptionId    = r1.OptionId;//has been updated when we loaded it to be the new one..
                                exres1.m_season      = season;
                                exres1.m_year        = year;
                                exres1.m_StudentId   = u1.GetStudentId(PersonID);
                                exres1.m_version     = 1;
                                exres1.Save();
                            }
                            cost   = cost / 100;
                            total += cost;
                            s2    += "<TD>" + cost.ToString() + "</TD>";
                            if (exo1.NeedsTeacherMarks())
                            {
                                s2 += "<TD>Warning - Needs CW</TD></TR>";
                            }
                            else
                            {
                                s2 += "<TD></TD></TR>";
                            }
                            list1[no_list1] = r1.OptionId; no_list1++;
                        }
                    }
                    else
                    {
                        Exam_ResitEntry exres1 = new Exam_ResitEntry();
                        exres1.Load(r1.StudentID, r1.OptionId);
                        if (exres1.m_valid)
                        {
                            exres1.Delete();                 //need to delete it!!!;
                        }
                    }
                }
            }
            s2 += "</TABLE> <H3><center>Total Cost : £" + total.ToString() + "</H3></center><H3><center>Dates are provisional!</H3></center>";
            servercontent.InnerHtml = s2;
        }
예제 #9
0
        private bool ProcessFile(Exam_Board exb1, string series, ref string Errors)
        {
            //so are we able to do E file or A file...
            string s               = "";
            string line            = "";
            Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_Exams_CentreNumber");
            string centre_number   = "";

            if (c.valid)
            {
                centre_number = c.Value;
            }
            else
            {
                Errors = "Centre Number not found in cerval..." + centre_number; return(false);
            }



            //check that if we are asked for an E file we dont already have one...
            //could just check no entries have been sent for this series...
            ExamEntries_List exl0 = new ExamEntries_List();

            exl0.LoadAllSeries(Year.ToString(), series, true, exb1.m_ExamBoardId.ToString());
            char type = exl0.m_list.Count > 0 ? 'A' : 'E';

            int          n1    = 0;
            Encode       en    = new Encode();
            PupilDetails p1    = new PupilDetails();
            DateTime     date1 = new DateTime();

            date1 = DateTime.Now;


            if (centre_number.Length != 5)
            {
                Errors = "Centre Number wrong!" + centre_number; return(false);
            }

            Exam_File    ef1 = new Exam_File();
            StreamWriter fs  = OpenFile(exb1, type, ref ef1, 194, series, centre_number, "14");

            if (fs == null)
            {
                Errors = "Error opening file"; return(false);
            }
            if (type == 'A')
            {
                //going to find any not yet sent and for these students clear the sent dates...
                exl0.m_list.Clear();



                exl0.LoadAllSeries(Year.ToString(), series, false, exb1.m_ExamBoardId.ToString());


                //now for each student in this list we need to re-send entries....
                foreach (Exam_Entry ex in exl0.m_list)
                {
                    ExamOption exo0 = new ExamOption();
                    exo0.Load(ex.m_OptionID);
                    ExamEntries_List exl2 = new ExamEntries_List();
                    exl2.Load(ex.m_StudentID, Year.ToString(), series, true, exb1.m_ExamBoardId.ToString());
                    foreach (Exam_Entry ex0 in exl2.m_list)
                    {
                        s  = "UPDATE tbl_Exams_Entries SET EntryFileID = NULL , DateEntered = NULL WHERE (ExamEntryID ='" + ex0.m_ExamEntryID.ToString() + "')";
                        n1 = en.Execute_count_SQL(s);
                    }
                }
            }

            ExamEntries_List exl1 = new ExamEntries_List();

            exl1.LoadAllSeries(Year.ToString(), series, false, exb1.m_ExamBoardId.ToString());
            int  n         = 0;
            int  n_record  = -1;//don't write first one
            int  n_records = 0;
            Guid std1      = Guid.Empty;

            foreach (Exam_Entry ex1 in exl1.m_list)
            {
                if (ex1.m_StudentID != std1)
                {
                    //have a new student
                    while (line.Length < 192)
                    {
                        line += " ";
                    }
                    if (n_record >= 0)
                    {
                        fs.WriteLine(line); n_records++;
                    }
                    std1     = ex1.m_StudentID;
                    p1.m_UCI = "";
                    p1.Load(std1.ToString());
                    n_record = 0;
                    line     = "";
                }
                if (n_record == 12)
                {
                    while (line.Length < 192)
                    {
                        line += " ";
                    }
                    fs.WriteLine(line); n_records++;
                    line = ""; n_record = 0;
                }
                n++;
                if (line == "")
                {
                    line = type + "5";
                    if (p1.m_IsOnRole)
                    {
                        line += "C";
                    }
                    else
                    {
                        line += "P";
                    }
                    line += centre_number;
                    s     = p1.m_examNo.ToString();
                    while (s.Length < 4)
                    {
                        s = "0" + s;
                    }
                    line += s;
                    //going to strip , from middle names to space...
                    s = p1.m_Surname + ":" + p1.m_GivenName + " " + p1.m_MiddleName.Replace(",", " ");
                    while (s.Length < 40)
                    {
                        s += " ";
                    }
                    if (s.Length > 40)
                    {
                        s.Substring(0, 40);
                    }
                    line += s;
                    if (p1.m_Gender == "F")
                    {
                        line += "F";
                    }
                    else
                    {
                        line += "M";
                    }
                    if (p1.m_dob == null)
                    {
                        s = "000000";
                    }
                    else
                    {
                        s = p1.m_dob.ToString("ddMMyy");
                    }
                    if (s == "010101")
                    {
                        s = "000000";               //010101  appears to the the defauult date if date in NULL in db
                    }
                    line += s;
                    if ((p1.m_UCI.Length != 13) || (p1.m_examNo == 0))
                    {
                        // todo  .. need to hanlde this error
                        /// clean up or offer UCI generation....
                        Errors  = "No UCI for " + p1.m_GivenName + " " + p1.m_Surname + "(" + p1.m_adno.ToString() + ")";
                        Errors += "Please create UCI for student and re-run";
                        //first mark any entries made for this file as not made........
                        s  = "UPDATE dbo.tbl_Exams_Entries SET EntryFileID = NULL , DateEntered = NULL ";
                        s += " WHERE (EntryFileID ='" + ef1.m_EntryFileId.ToString() + "' )";
                        Encode en1 = new Encode();
                        n1 = en1.Execute_count_SQL(s);
                        fs.Close();
                        return(false);
                    }
                    s     = p1.m_UCI;
                    line += s;
                    line += p1.m_upn.Trim();

                    //TODO....
                    line += p1.m_uln.Trim();
                    //line += "          ";//uln
                    //now the guest flag..... hmm...
                    //ought to do this really for cand from collaboration...

                    line += "             ";// up to byte 108 in jcq mess...
                }
                ExamOption exo1 = new ExamOption();
                exo1.Load(ex1.m_OptionID);
                if (exo1.m_ExamBoardID == exb1.m_ExamBoardId)
                {
                    //add it to the file unless withdrawn
                    if (!ex1.m_withdrawn)
                    {
                        s     = exo1.m_OptionCode + "      "; s = s.Substring(0, 6);
                        line += s + " "; n_record++;
                    }
                    //now update the Exam Entry record...
                    s  = "UPDATE tbl_Exams_Entries SET EntryFileID ='" + ef1.m_EntryFileId.ToString() + "' ";
                    s += " , DateEntered =CONVERT(DATETIME, '" + ef1.m_DateCreated.ToString("yyyy-MM-dd HH:mm:ss") + "', 102)  ";
                    s += " , EntryStatus = '4' ";
                    s += " WHERE (ExamEntryID = '" + ex1.m_ExamEntryID.ToString() + "' )";
                    en.ExecuteSQL(s);
                }
            }
            while (line.Length < 192)
            {
                line += " ";
            }
            if (n_record >= 0)
            {
                fs.WriteLine(line); n_records++;
            }
            EndFile(type, n_records, date1, fs, 194, ef1);
            return(true);
        }