Exemplo n.º 1
0
        public List <ExamLinkComponent> ExamsLinkComponentsFromBaseData(Exam_Board eb, string season, string year)

        {
            List <ExamLinkComponent> temp = new List <ExamLinkComponent>();

            while (year.Length > 2)
            {
                year = year.Substring(1, year.Length - 1);
            }
            string search = "L" + 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) == "L1")
                            {
                                JCQ_Version = System.Convert.ToInt32(line.Substring(24, 2));
                            }
                            if (line.Substring(0, 2) == "L5")
                            {
                                ExamLinkComponent eco1 = new ExamLinkComponent();
                                eco1.LoadFromBaseData(line, JCQ_Version, eb.m_ExamBoardId.ToString());
                                temp.Add(eco1);
                            }
                        }
                    }
                }
            }
            //temp.Sort();

            return(temp);
        }