Пример #1
0
        public void Load_Option(string line, Exam_Board eb, string season, string series, string year, string syl_file, string path, int JCQ_Version)
        {
            //to load from line (from basedata file) to make a new option
            string component_file = "c" + syl_file.Substring(1, syl_file.Length - 1);
            string link_file      = "l" + syl_file.Substring(1, syl_file.Length - 1);

            ExamBaseOption ebo1 = new ExamBaseOption();

            ExamSyllabus syl = new ExamSyllabus();
            string       s   = line.Substring(0, 2);

            if (s == "O5")
            {
                if (!ebo1.Load(line, JCQ_Version))
                {
                    return;
                }

                syl = Find_SyllabusID(ebo1.m_SyllabusCode, year, season, eb, path + syl_file); // will find or make
                if (syl == null)
                {
                    return;
                }

                s  = "INSERT INTO dbo.tbl_Exams_Options  (SyllabusID ,OptionCode , OptionTitle, ";
                s += "OptionQualification, OptionLevel, OptionItem, OptionProcess, ";
                s += "QCAClassificationCode, QCAAccreditationNumber, OptionFee, OptionMaximumMark, YearCode, SeasonCode,  SeriesIdentifier, Version )";
                s += "VALUES  ('" + syl.m_SyllabusId.ToString() + "' , '";
                s += ebo1.m_OptionEntryCode + "' , '" + ebo1.m_Title + "' , '" + ebo1.m_Qualification + "' , '";
                s += ebo1.m_Level + "' , '" + ebo1.m_Item + "' , '" + ebo1.m_Process + "' , '";
                s += ebo1.m_QCACode + "' , '" + ebo1.m_QCANumber + "' , '";
                if (ebo1.m_FeeValid)
                {
                    s += ebo1.m_Fee.ToString();
                }
                else
                {
                    s += "-";
                }
                s += "' , '" + ebo1.m_MaximiumMark + "' ,'";
                s += year + "' , '" + season + "' , '" + series + "', '2' ) ";
                ExecuteSQL(s);
                Install_Components(ebo1.m_OptionEntryCode, path + link_file, path + component_file, eb, season, year);
            }
        }
Пример #2
0
        public System.Collections.ArrayList ExamsOptionsFromBaseData(Exam_Board eb, string season, string year)
        {
            System.Collections.ArrayList temp = new System.Collections.ArrayList();
            while (year.Length > 2)
            {
                year = year.Substring(1, year.Length - 1);
            }
            string search = "O" + season + "?" + year + "_" + eb.m_LegacyExamBdId + ".X??";

            string[] filelist = System.IO.Directory.GetFiles(path, search);

            foreach (string f in filelist)
            {
                Stream myStream;
                string line;
                int    JCQ_Version = 0;
                if ((myStream = File.Open(f, FileMode.Open)) != null)
                {
                    using (StreamReader sr = new StreamReader(myStream))
                    {
                        while ((line = sr.ReadLine()) != null)
                        {
                            if (line.Substring(0, 2) == "O1")
                            {
                                JCQ_Version = System.Convert.ToInt32(line.Substring(24, 2));
                            }
                            if (line.Substring(0, 2) == "O5")
                            {
                                ExamBaseOption ebo1 = new ExamBaseOption();
                                if (ebo1.Load(line, JCQ_Version))
                                {
                                    ebo1.m_file_path = f.Substring(path.Length);
                                    temp.Add(ebo1);
                                }
                            }
                        }
                    }
                }
            }
            temp.Sort();
            return(temp);
        }