Beispiel #1
0
        protected void Button_Upload_Click(object sender, EventArgs e)
        {
            string     id   = DropDownList_ExamBoards.SelectedValue;
            Exam_Board eb1  = new Exam_Board(new Guid(id));
            string     s1   = DropDownList_data.SelectedValue;
            ExamOption exo1 = new ExamOption();
            ExamFiles  ef1  = new ExamFiles();

            exo1.Load(s1, SeasonCode.ToString(), YearCode.ToString(), eb1.m_LegacyExamBdId);
            if (!exo1.m_valid)
            {
                ExamOption exo2 = ef1.Find_Option(s1, eb1, SeasonCode.ToString(), YearCode.ToString());
                if (exo2 != null)
                {
                    //Label_Result.Text = "Successfully uploaded " + exo.m_OptionCode + " : " + exo.m_OptionTitle + " to Cerval";
                    //DropDownList1.SelectedIndex = -1;
                    //ListItem l = DropDownList1.SelectedItem;
                    //DropDownList1.Items.Remove(l);
                }
                else
                {
                    //Label_Result.Text = "Failed to upload " + exo.m_OptionCode + " : " + exo.m_OptionTitle + " to Cerval";
                }
            }
        }
Beispiel #2
0
        protected bool CheckComponents(Exam_Board eb)
        {
            ExamFiles            ef = new Cerval_Library.ExamFiles();
            List <ExamComponent> BaseComponentList = new List <ExamComponent>();
            ExamCompononent_List ecl1 = new ExamCompononent_List();

            ecl1.LoadAllComponents_IncNonTimetabled(YearCode.ToString(), SeasonCode.ToString());
            BaseComponentList = ef.ExamsComponentsFromBaseData(eb, SeasonCode.ToString(), YearCode.ToString());
            foreach (ExamComponent c in ecl1.m_list)
            {
                foreach (ExamComponent c1 in BaseComponentList)
                {
                    if (c.m_ComponentCode == c1.m_ComponentCode)
                    {
                        c.m_Teachermarks     = c1.m_Teachermarks;
                        c.m_Due_Date         = c1.m_Due_Date;
                        c.m_ExamBoardID      = c1.m_ExamBoardID;
                        c.m_MaximumMark      = c1.m_MaximumMark;
                        c.m_Teachermarks     = c1.m_Teachermarks;
                        c.m_ComponentTitle   = c1.m_ComponentTitle;
                        c.m_Timetabled       = c1.m_Timetabled;
                        c.m_TimetableSession = c1.m_TimetableSession;
                        c.m_Time             = c1.m_Time;
                        c.m_TimetableDate    = c1.m_TimetableDate;
                        c.Save();
                    }
                }
            }
            return(true);;
        }
        public void should_success_instantiate()
        {
            YearCode yearCode = new YearCode(2019, "code");

            Assert.Equal("code", yearCode.Code);
            Assert.Equal(2019, yearCode.Year);
        }
Beispiel #4
0
        private void AssignBirthDateAndSex(IndexedTokens tokens)
        {
            BirthDate = CalculateBirthdate(tokens);

            Year  = new YearCode(BirthDate.Value).ToString();
            Month = new MonthCode(BirthDate.Value).ToString();
            Day   = new DayCode(BirthDate.Value, Sex).ToString();
        }
        protected string GetSQLOptString()
        {
            string s = "SELECT TOP (100) PERCENT { fn CONCAT({ fn CONCAT(OptionCode, '   :   ') }, OptionTitle) }    AS Expr1 , ";

            s += " OptionID AS ID  ";
            s += " FROM dbo.tbl_Exams_Options ";
            s += " WHERE        (YearCode = '" + YearCode.ToString() + "') AND(SeasonCode = '" + SeasonCode.ToString() + "')  ORDER BY OptionCode  ";
            return(s);
        }
Beispiel #6
0
        private string GetFilename()
        {
            ExamConversions c          = new ExamConversions();
            string          s_filename = "";
            string          s          = YearCode.ToString();

            s_filename = c.GetSeasonCode(SeasonCode) + "a" + s + "_99";
            return(s_filename);
        }
Beispiel #7
0
		internal ControlCode(
			LastNameCode lastNameCode,
			FirstNameCode firstNameCode,
			YearCode yearCode,
			MonthCode monthCode,
			DayCode dayCode,
			AreaCode areaCode)
		{
			partialCode = string.Concat(lastNameCode, firstNameCode, yearCode, monthCode, dayCode, areaCode);
		}
Beispiel #8
0
        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);
        }
Beispiel #9
0
 public ControlCode(
     LastNameCode lastNameCode,
     FirstNameCode firstNameCode,
     YearCode yearCode,
     MonthCode monthCode,
     DayCode dayCode,
     AreaCode areaCode)
 {
     partialCode = string.Concat(lastNameCode, firstNameCode, yearCode, monthCode, dayCode, areaCode);
 }
        private void SetUpForReatkes()
        {
            List <ExamOption> list1 = new List <ExamOption>();
            int             no_new = 0; int no_found = 0; string Errors = "The following Options seem not to be offered this summer:  ";
            ExamOption_List exoL1 = new ExamOption_List();
            ExamFiles       ef1   = new ExamFiles();
            ExamOption      exo1  = new ExamOption();

            //load results for last JUNE sitting now.

            exoL1.Load((YearCode - 1).ToString(), SeasonCode.ToString());

            foreach (ExamOption exo in exoL1.m_list)
            {
                Exam_Board eb1 = new Exam_Board(exo.m_ExamBoardID);
                exo1.Load(exo.m_OptionCode, SeasonCode.ToString(), YearCode.ToString(), eb1.m_LegacyExamBdId);
                if (exo1.m_valid)
                {
                    no_found++;
                }
                else
                {
                    if (!exo.NeedsTeacherMarks())
                    {
                        ExamOption exo2 = ef1.Find_Option(exo.m_OptionCode, eb1, SeasonCode.ToString(), YearCode.ToString());
                        if (exo2 != null)
                        {
                            no_new++;
                        }
                        else
                        {
                            Errors += exo.m_OptionCode + ",  ";
                        }
                    }
                    else
                    {
                        list1.Add(exo);  //list has those needing teacher marks
                    }
                }
            }
            Label_Result.Text = "We made  " + no_new.ToString() + " new options and found already " + no_found.ToString();
            Label_Error.Text  = Errors;
            //now need to offer those with coursework...
            if (list1.Count > 0)
            {
                DropDownList1.Visible = true; Button_Upload.Visible = true;
                foreach (ExamOption e in list1)
                {
                    ListItem l = new ListItem(e.m_OptionCode + e.m_OptionTitle, e.m_OptionID.ToString());
                    DropDownList1.Items.Add(l);
                }
                LabelDropDown.Text = "The list below are options that require Teacher marks... select and add any you want students to see.";
            }
        }
Beispiel #11
0
        protected void DropDownList_ExamBoards_SelectedIndexChanged(object sender, EventArgs e)
        {
            ExamOption_List exol1 = new ExamOption_List();

            exol1.Load(DropDownList_ExamBoards.SelectedValue, YearCode.ToString(), SeasonCode.ToString());
            DropDownList_Options.Items.Clear();
            foreach (ExamOption e1  in exol1.m_list)
            {
                ListItem l1 = new ListItem(e1.m_OptionCode + ":" + e1.m_OptionTitle, e1.m_OptionID.ToString());
                DropDownList_Options.Items.Add(l1);
            }
        }
        private string GetWhereString()
        {
            string s = " WHERE (ExamYear='" + Year.ToString() + "') AND ( ExamSeason='" + SeasonCode.ToString() + "' ) ";

            switch (DisplayType)
            {
            case "Student":
                s += " AND StudentAdmissionNumber ='" + StudentAdno + "' ";
                break;

            case "Option":
                s += " AND OptionCode = '" + DropDownList1.SelectedItem.Text + "' ";
                break;

            case "Subject":
                //need to work out which options....
                if (CourseId == "0")
                {    //so load all options...
                    s = "HAVING (ExamYear = '" + Year.ToString() + "') AND(ExamSeason = '" + SeasonCode.ToString() + "')"; return(s);
                }
                ExamOption_List el1 = new ExamOption_List();
                el1.LoadforCourse(new Guid(CourseId), YearCode.ToString(), SeasonCode.ToString());
                s = "";
                bool first = true;
                foreach (ExamOption e in el1.m_list)
                {
                    if (first)
                    {
                        first = false; s = " HAVING ";
                    }
                    else
                    {
                        s += " OR ";
                    }
                    s += " (OptionCode = '" + e.m_OptionCode + "' ) AND (ExamYear = '" + Year.ToString() + "' ) AND (ExamSeason = '" + SeasonCode.ToString() + "')";
                }
                if (first)
                {                                           //we didn't have any options...
                    s = " HAVING (OptionCode = 'ZZZZZZ' )"; //null return!
                }
                break;

            case "Status":
                s += " AND (EntryStatusCode  ='" + DropDownList1.SelectedItem.Value + "' ) ";
                break;
            }
            return(s);
        }
Beispiel #13
0
        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 DropDownList_ExamBoards_SelectedIndexChanged(object sender, EventArgs e)
        {
            ExamOption_List exol1 = new ExamOption_List();

            exol1.Load(DropDownList_ExamBoards.SelectedValue, YearCode.ToString(), SeasonCode.ToString());
            DropDownList_Options.Items.Clear();
            foreach (ExamOption e1 in exol1.m_list)//only add if we HAVE components!!
            {
                ExamCompononent_List ecl1 = new ExamCompononent_List(); ecl1.Load(e1.m_OptionID);
                if (ecl1.m_list.Count > 0)
                {
                    ListItem l1 = new ListItem(e1.m_OptionCode + ":" + e1.m_OptionTitle, e1.m_OptionID.ToString());
                    DropDownList_Options.Items.Add(l1);
                }
            }
            DropDownList_Options_SelectedIndexChanged(sender, e);
        }
Beispiel #15
0
        public FiscalCode Calculate(NaturalPerson naturalPerson, AreaCode areaCode)
        {
            var lastName = new LastNameCode(naturalPerson.LastName.Replace(" ", null));

            var firstName = new FirstNameCode(naturalPerson.FirstName.Replace(" ", null));

            var year = new YearCode(naturalPerson.BirthDate);

            var month = new MonthCode(naturalPerson.BirthDate);

            var day = new DayCode(naturalPerson.BirthDate, naturalPerson.Sex);

            var control = new ControlCode(lastName, firstName, year, month, day, areaCode);

            var fiscalCode = new FiscalCode(lastName, firstName, year, month, day, areaCode, control);

            return(fiscalCode);
        }
Beispiel #16
0
		internal FiscalCode(
			LastNameCode lastNameCode,
			FirstNameCode firstNameCode,
			YearCode yearCode,
			MonthCode monthCode,
			DayCode dayCode,
			AreaCode areaCode,
			ControlCode controlCode)
			: this(
				lastNameCode.ToString(),
				firstNameCode.ToString(),
				yearCode.ToString(),
				monthCode.ToString(),
				dayCode.ToString(),
				areaCode.ToString(),
				controlCode.ToString())
		{
		}
Beispiel #17
0
 public FiscalCode(
     LastNameCode lastNameCode,
     FirstNameCode firstNameCode,
     YearCode yearCode,
     MonthCode monthCode,
     DayCode dayCode,
     AreaCode areaCode,
     ControlCode controlCode)
     : this(
         lastNameCode.ToString(),
         firstNameCode.ToString(),
         yearCode.ToString(),
         monthCode.ToString(),
         dayCode.ToString(),
         areaCode.ToString(),
         controlCode.ToString())
 {
 }
        protected void Button_Opt_Find_Click(object sender, EventArgs e)
        {
            //find code...
            string s     = TextBox_FindOption.Text.ToUpper().Trim();
            bool   found = false;

            foreach (ListItem item in ListBox_Options.Items)
            {
                if (item.Text.Substring(0, 6).ToUpper().Trim() == s)
                {
                    item.Selected = true; found = true; TextBox_FindOption.Text = "";
                }
            }
            if (found)
            {
                return;
            }
            found = false; ExamOption eo1 = new ExamOption();
            ExamBoardList             ebl1 = new ExamBoardList(); ExamFiles ef1 = new ExamFiles();

            foreach (Exam_Board eb in ebl1._ExamBoardList)
            {
                eo1 = ef1.Find_Option(s, eb, SeasonCode.ToString(), YearCode.ToString());
                if (eo1 != null)
                {
                    found = true; break;
                }
            }
            if (!found)
            {
                TextBox1.Text = "NOT FOUND!!!!"; TextBox1.Visible = true; return;
            }

            ListItem i1 = new ListItem(eo1.m_OptionCode + ":" + eo1.m_OptionTitle, eo1.m_OptionID.ToString());

            ListBox_Options.Items.Add(i1);
            foreach (ListItem item in ListBox_Options.Items)
            {
                if (item.Text.Substring(0, 6).ToUpper().Trim() == s)
                {
                    item.Selected = true; found = true; TextBox_FindOption.Text = "";
                }
            }
        }
Beispiel #19
0
        protected bool CheckOptions(Exam_Board eb)
        {
            ExamFiles       ef      = new Cerval_Library.ExamFiles();
            ExamOption_List examOl1 = new ExamOption_List();

            examOl1.Load(eb.m_ExamBoardId.ToString(), YearCode.ToString(), SeasonCode.ToString());
            System.Collections.ArrayList ExamOptionsList = new System.Collections.ArrayList();
            ExamOptionsList = ef.ExamsOptionsFromBaseData(eb, SeasonCode.ToString(), YearCode.ToString());
            int m1 = 0; int m2 = 0;

            foreach (ExamOption examo1 in examOl1.m_list)
            {
                foreach (ExamBaseOption eb1 in ExamOptionsList)
                {
                    if (eb1.m_OptionEntryCode == examo1.m_OptionCode)
                    {
                        m1 = 0; m2 = 0;
                        try { m1 = System.Convert.ToInt32(eb1.m_MaximiumMark); }
                        catch { }
                        try { m2 = System.Convert.ToInt32(examo1.m_OptionMaximumMark); }
                        catch { }
                        try
                        {
                            if (m1 != m2)
                            {
                                examo1.m_OptionMaximumMark = eb1.m_MaximiumMark;
                                examo1.UpdateMaxMark();
                            }
                            //ought to check we have all the components for this...
                            string component_file = ef.path + "c" + eb1.m_file_path.Substring(1, eb1.m_file_path.Length - 1);
                            string link_file      = ef.path + "l" + eb1.m_file_path.Substring(1, eb1.m_file_path.Length - 1);
                            ef.Install_Components(examo1.m_OptionCode, link_file, component_file, eb, SeasonCode.ToString(), YearCode.ToString());
                        }
                        catch
                        {
                        }
                    }
                }
            }

            return(true);
        }
Beispiel #20
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            // going to delete option/component values

            ExamOption_List eol1 = new ExamOption_List();

            eol1.Load(YearCode.ToString(), SeasonCode.ToString());
            ExamCompononent_List ecl1 = new ExamCompononent_List();

            ecl1.LoadAllComponentsSeason(YearCode.ToString(), SeasonCode.ToString());

            foreach (ExamOption eo in eol1.m_list)
            {
                eo.Delete();
            }
            foreach (ExamComponent ec in ecl1.m_list)
            {
                ec.Delete();
            }
        }
Beispiel #21
0
        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);
        }
		public FiscalCode Calculate(NaturalPerson naturalPerson, AreaCode areaCode)
		{
			Enforce.Argument(() => areaCode);

			var lastName = new LastNameCode(naturalPerson.LastName.Replace(" ", null));

			var firstName = new FirstNameCode(naturalPerson.FirstName.Replace(" ", null));

			var year = new YearCode(naturalPerson.BirthDate);

			var month = new MonthCode(naturalPerson.BirthDate);

			var day = new DayCode(naturalPerson.BirthDate, naturalPerson.Sex);

			var control = new ControlCode(lastName, firstName, year, month, day, areaCode);

			var fiscalCode = new FiscalCode(lastName, firstName, year, month, day, areaCode, control);

			return fiscalCode;
		}
Beispiel #23
0
        protected void Button_PullEntries_Click(object sender, EventArgs e)
        {
            ISAMS_SimpleExamEntry_List IEntries = new ISAMS_SimpleExamEntry_List();

            int c = 0;

            c = System.Convert.ToInt32(TextBox_CycleNumber.Text);
            IEntries.LoadList(c);

            foreach (ISAMS_SimpleExamEntry Ien in IEntries.m_list)
            {
                //need to find Guids for Pupil, OPtion etc...
                Utility u   = new Utility();
                Guid    SId = new Guid();
                SId = u.GetStudentIDfromiSAMS(Ien.m_PupilId);
                Exam_Board eb1 = new Exam_Board(Ien.m_UABCode);
                ExamOption eo1 = new ExamOption();
                eo1.Load(Ien.m_OptionCode, SeasonCode.ToString(), YearCode.ToString(), Ien.m_UABCode.ToString());

                Exam_Entry Ex1 = new Exam_Entry();
                Ex1.Load(Ien.m_OptionCode, SeasonCode.ToString(), YearCode.ToString(), eb1.m_ExamBoardId, SId);
                if (!Ex1.m_valid)
                {
                    Ex1.m_Date_Created = DateTime.Now;
                    Ex1.m_OptionID     = eo1.m_OptionID;
                    Ex1.m_season       = SeasonCode.ToString();
                    Ex1.m_StudentID    = SId;
                    Ex1.m_withdrawn    = false;
                    Ex1.m_year         = Year.ToString();
                    Ex1.m_EntryStatus  = 7;
                    Ex1.Save();
                }
                else
                {
                    bool f = Ex1.m_valid;
                }
            }
        }
Beispiel #24
0
 protected void DropDownList_ExamBoards_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DropDownList_ExamBoards.SelectedIndex > -1)
     {
         string     id = DropDownList_ExamBoards.SelectedValue;
         Exam_Board eb = new Exam_Board(new Guid(id));
         ExamFiles  ef = new ExamFiles();
         DropDownList_data.Items.Clear();
         foreach (ExamBaseOption ebo in ef.ExamsOptionsFromBaseData(eb, SeasonCode.ToString(), YearCode.ToString()))
         {
             ListItem l = new ListItem(ebo.ToString(), ebo.m_OptionEntryCode);
             DropDownList_data.Items.Add(l);
         }
     }
 }
Beispiel #25
0
        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";
        }
Beispiel #26
0
        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;
            }
        }
Beispiel #27
0
        protected void UpdateTimetable(DateTime start, DateTime end)
        {
            // add scheduled components for any components not scheduled...
            //TODO also delete any withdrawn....
            ExamConversions      u    = new ExamConversions();
            ExamCompononent_List ecl1 = new ExamCompononent_List();

            //ecl1.LoadAllComponents(Year.ToString(), SeasonCode.ToString());
            ecl1.LoadAllComponentsSeasonDate(YearCode.ToString(), SeasonCode.ToString(), start, end);
            Encode en = new Encode();
            string s  = "";

            ScheduledComponent sched1 = new ScheduledComponent();

            s = ""; int n = 0;
            DateTime    d1 = new DateTime();

            foreach (ExamComponent ec in ecl1.m_list)
            {
                ExamLinkComponent_List elcl1 = new ExamLinkComponent_List();
                elcl1.LoadList_Component(ec.m_ComponentID);
                foreach (ExamLinkComponent elc in elcl1.m_list)
                {
                    ExamEntries_List exl1 = new ExamEntries_List();
                    //now need all entries for this option.....
                    exl1.Load_Option(elc.m_OptionId);
                    n += exl1.m_list.Count;
                }
            }

            int n1 = 0; int n2 = 0;

            foreach (ExamComponent ec in ecl1.m_list)
            {
                if (ec.m_Timetabled == "T")
                {
                    d1 = ec.m_TimetableDate;
                    if (ec.m_TimetableSession == "A")
                    {
                        d1 = d1.AddHours(8); d1 = d1.AddMinutes(50);
                    }
                    else
                    {
                        d1 = d1.AddHours(13); d1 = d1.AddMinutes(40);
                    }
                    //need to find all entries that use this component.....
                    ExamLinkComponent_List elcl1 = new ExamLinkComponent_List();
                    elcl1.LoadList_Component(ec.m_ComponentID);
                    foreach (ExamLinkComponent elc in elcl1.m_list)
                    {
                        ExamEntries_List exl1 = new ExamEntries_List();
                        //now need all entries for this option.....
                        exl1.Load_Option(elc.m_OptionId);
                        foreach (Exam_Entry ex in exl1.m_list)
                        {
                            if (!ex.m_withdrawn)
                            {
                                sched1.Load(ec.m_ComponentID, ex.m_StudentID);
                                if (!sched1.m_valid)
                                {
                                    sched1.m_StudentId   = ex.m_StudentID;
                                    sched1.m_ComponentId = ec.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        = d1;
                                    sched1.m_Desk        = "";
                                    sched1.m_Will_Type   = false;// do these later...
                                    sched1.Save();
                                    n2++;
                                }
                            }
                            else
                            {
                                sched1.Load(ec.m_ComponentID, ex.m_StudentID);
                                if (sched1.m_valid)
                                {
                                    //need to delete
                                    sched1.Delete();
                                    n1++;
                                }
                            }
                        }
                    }
                }
            }


            //now ought to update the willtype fields to agree with the cantype entry..
            //oohhh this is going to be messy.....
            //read from a querry..... then update Exams_Scheduled_components...

            CanTypeList typists = new CanTypeList();

            foreach (Guid g in typists.m_List)
            {
                s = "UPDATE dbo.tbl_Exams_ScheduledComponents SET WillType =1 WHERE (StudentId = '" + g.ToString() + "'  )AND (Year='" + YearCode.ToString() + "' ) AND (Season ='" + u.GetSeasonCode(SeasonCode) + "' )";
                en.ExecuteSQL(s);
            }
        }
Beispiel #28
0
        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;
        }
Beispiel #29
0
        protected void DropDownList_data_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (DropDownList_data.SelectedIndex > -1)
            {
                string     id = DropDownList_ExamBoards.SelectedValue; string s = "";
                Exam_Board eb = new Exam_Board(new Guid(id));
                ExamFiles  ef = new ExamFiles();
                foreach (ExamBaseOption ebo in ef.ExamsOptionsFromBaseData(eb, SeasonCode.ToString(), YearCode.ToString()))
                {
                    if (ebo.m_OptionEntryCode == DropDownList_data.SelectedValue)
                    {
                        s  = "Option Code:           " + ebo.m_OptionEntryCode + Environment.NewLine;
                        s += "Option Title:          " + ebo.m_Title + Environment.NewLine;
                        s += "Qualification/Level:   " + ebo.m_Qualification + ebo.m_Level + Environment.NewLine;
                        s += "Cost:                  " + ebo.m_Fee + Environment.NewLine;
                        s += "SyllabusCode:          " + ebo.m_SyllabusCode + Environment.NewLine;
                        s += "Item (C=Cert.):        " + ebo.m_Item + Environment.NewLine;
                        s += "QCA Number:             " + ebo.m_QCANumber + Environment.NewLine;
                        ExamOption eo1 = new ExamOption();
                        if (eo1.Load(DropDownList_data.SelectedValue, SeasonCode.ToString(), YearCode.ToString(), eb.m_ExamBoardId))
                        {
                            s += Environment.NewLine + Environment.NewLine + "Option is known to Cerval";
                        }
                        else
                        {
                            s += Environment.NewLine + Environment.NewLine + "Option is NOT known to Cerval";
                        }


                        TextBox1.Text = s;
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetMasterValues();
                DropDownList1.Visible = false;
                GridView2.Visible     = false;
                GridView1.Visible     = false;
                ListBox1.Visible      = false;
                TextBox1.Visible      = false;
                Label_Select3.Text    = "";
                if (Request.QueryString.Count >= 1)
                {
                    DisplayType = Request.QueryString["Type"];
                }
                switch (DisplayType)
                {
                case "Student":
                    Label_Select1.Text    = "Select Year:";
                    Label_Select3.Text    = "OR type Admission Number:";
                    DropDownList1.Visible = true;
                    DropDownList1.Items.Add("14");
                    DropDownList1.Items.Add("13");
                    DropDownList1.Items.Add("12");
                    DropDownList1.Items.Add("11");
                    DropDownList1.Items.Add("10");
                    DropDownList1.SelectedIndex = 1;
                    DropDownList1.Visible       = true;
                    ListBox1.Visible            = true;
                    TextBox1.Visible            = true;
                    GridView2.Visible           = true;

                    StudentYearList styl1 = new StudentYearList(ListBox1, DropDownList1.SelectedValue + "Year", DateTime.Now);

                    break;

                case "Option":
                    Label_Select1.Text    = "Select Option:";
                    DropDownList1.Visible = true;
                    GridView1.Visible     = true;
                    DropDownList1.Items.Clear();
                    ExamOption_List exol1 = new ExamOption_List(); exol1.Load(YearCode.ToString(), SeasonCode.ToString());
                    foreach (ExamOption exo in exol1.m_list)
                    {
                        DropDownList1.Items.Add(new ListItem(exo.m_OptionCode, exo.m_OptionID.ToString()));
                    }
                    DropDownList1.SelectedIndex = -1;
                    break;

                case "Subject":
                    Label_Select1.Text    = "Select Subject:";
                    DropDownList1.Visible = true;
                    GridView1.Visible     = true;
                    ListItem l1 = new ListItem("All", "0");
                    DropDownList1.Items.Add(l1);
                    CourseList cl1 = new CourseList(0);
                    foreach (Course c in cl1._courses)
                    {
                        if (c.KeyStage == 5)
                        {
                            ListItem l = new ListItem(c.CourseName + "( A-level)", c._CourseID.ToString());
                            DropDownList1.Items.Add(l);
                        }
                        if (c.KeyStage == 4)
                        {
                            ListItem l = new ListItem(c.CourseName + "( GCSE)", c._CourseID.ToString());
                            DropDownList1.Items.Add(l);
                        }
                    }
                    DropDownList1.SelectedIndex = -1;
                    break;

                case "Status":
                    Label_Select1.Text    = "Select Status:";
                    DropDownList1.Visible = true;
                    GridView1.Visible     = true;
                    Exam_Entry_Status_List el1 = new Exam_Entry_Status_List();
                    foreach (Exam_Entry_Status e1 in el1.m_list)
                    {
                        ListItem l2 = new ListItem(e1.m_EntryStatusDescription, e1.m_EntryStatusCode);
                        DropDownList1.Items.Add(l2);
                    }
                    //going to add extra line for Student resits...
                    ListItem l3 = new ListItem("Resit Request waiting to be processed", "RESITS");
                    DropDownList1.Items.Add(l3);
                    DropDownList1.SelectedIndex = -1;

                    break;

                default:
                    break;
                }
            }
        }
Beispiel #31
0
        protected void SetupSummaryTable()
        {
            DateTime t1 = new DateTime(Year, SeasonCode - 2, 1);//so summer season might start in april???
            DateTime t0 = new DateTime(); t0 = t1;

            //advance to Monday
            while (t0.DayOfWeek != DayOfWeek.Monday)
            {
                t0 = t0.AddDays(1);
            }
            //this is our start date...
            string[] data = new string[300];//should be enough!
            for (int i = 0; i < 120; i++)
            {
                data[i] = "";
            }

            int n = 0; int nmin = 200; int nmax = -1;
            // list for the contents of this row...
            DateTime             t2        = new DateTime();
            TimeSpan             tspan1    = new TimeSpan();
            TimeSpan             tspanWeek = new TimeSpan(0, 1, 0, 0);
            ExamCompononent_List ecl1      = new ExamCompononent_List();

            ecl1.LoadAllComponentsSeason(YearCode.ToString(), SeasonCode.ToString());
            ExamsUtility u                 = new ExamsUtility();

            //ecl1.LoadAllComponents_NotScheduled(Year.ToString(), SeasonCode.ToString());
            foreach (ExamComponent ec in ecl1.m_list)
            {
                t2       = ec.m_TimetableDate; tspan1 = t2 - t0; n = tspan1.Days;
                data[n] += ec.m_ComponentTitle + ":" + ec.m_ComponentCode + ":" + ec.m_ComponentID.ToString() + (char)0x09;
                //component title:option code
                if (n > nmax)
                {
                    nmax = n;
                }
                if (n < nmin)
                {
                    nmin = n;
                }
            }
            List <ComponentNotScheduled> list1 = new List <ComponentNotScheduled>();

            //so want to do whole weeks from t0;
            n = 0; while ((nmin - n) > 7)
            {
                n += 7;
            }
            //so we start the table at n...
            t2 = t0.AddDays(n);
            while (n < nmax)
            {
                TableRow  r1 = new TableRow(); Table_Summary.Rows.Add(r1);
                TableCell c0 = new TableCell(); c0.Text = t2.ToShortDateString(); r1.Cells.Add(c0);
                for (int i = 0; i < 5; i++)
                {
                    //so date is t2
                    list1 = u.LoadComponentsNotSchedlued(Year.ToString(), SeasonCode.ToString(), t2.AddHours(-1), t2.AddHours(22));
                    TableCell c1 = new TableCell();
                    if (list1.Count > 0)
                    {
                        Button b1 = new Button();
                        b1.Text = t2.ToString("M");

                        c1.Controls.Add(b1);
                        b1.Click    += B1_Click;
                        b1.ID        = "Button" + (n + i).ToString();
                        b1.BackColor = System.Drawing.Color.AntiqueWhite;
                    }
                    r1.Cells.Add(c1); t2 = t2.AddDays(1);
                }
                n += 7; t2 = t2.AddDays(2);
            }
        }