Beispiel #1
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);;
        }
Beispiel #2
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 #3
0
        public bool AddEntry(Guid StudentId, Exam_Board exbde1, int Year, int YearCode, int Season, string option, int EntryStatusCode, bool checkDisallowed, ref string ErrorMessage, ref Guid EntryId)
        {
            //Year is 2 digit code.....
            bool       disallowed = false; ErrorMessage = "";
            ExamOption ex01       = new ExamOption();
            ExamOption ex02       = new ExamOption();
            ExamFiles  ef1        = new ExamFiles();

            ex01.Load(option, Season.ToString(), YearCode.ToString(), exbde1.m_ExamBoardId);
            if (!ex01.m_valid)
            {
                //need to search basedata...
                ex01 = ef1.Find_Option(option, exbde1, Season.ToString(), YearCode.ToString());
            }
            if (ex01 != null)
            {
                ExamEntries_List exen1 = new ExamEntries_List();
                exen1.Load(StudentId, Year.ToString(), Season.ToString());
                if (checkDisallowed)
                {
                    foreach (Exam_Entry ex1 in exen1.m_list)
                    {
                        if (!ex1.m_withdrawn)
                        {
                            ex02.Load(ex1.m_OptionID);
                            disallowed = ef1.CombinationDisallowed(exbde1, ex01.m_OptionCode, ex02.m_OptionCode, ex01.m_SeriesIdentifier, ex01.m_year_Code);
                            if (disallowed)
                            {
                                ErrorMessage = "Combination of " + ex01.m_OptionCode + " and " + ex02.m_OptionCode + " not allowed!";
                                return(false);
                            }
                        }
                    }
                }
                if (!disallowed)
                {
                    Exam_Entry entry1 = new Exam_Entry();
                    entry1.m_OptionID     = ex01.m_OptionID;
                    entry1.m_StudentID    = StudentId;
                    entry1.m_Date_Created = DateTime.Now;
                    entry1.m_season       = Season.ToString();
                    entry1.m_year         = Year.ToString();
                    entry1.m_ExamEntryID  = Guid.Empty;
                    entry1.m_EntryStatus  = EntryStatusCode;

                    foreach (Exam_Entry ex1 in exen1.m_list)
                    {
                        if (ex1.m_OptionID == ex01.m_OptionID)
                        {
                            //found this student, this series, this option
                            entry1.m_ExamEntryID = ex1.m_ExamEntryID;
                        }
                    }
                    entry1.Save();
                    EntryId = entry1.m_ExamEntryID;
                    return(true);
                }
            }
            else
            {
                ErrorMessage = "Option code  " + option + " not found"; return(false);
            }

            return(false);
        }