Beispiel #1
0
        public static void read()
        {
            FileStream   fs = new FileStream("Course.txt", FileMode.Open);
            StreamReader sr = new StreamReader(fs);

            while (sr.Peek() != -1)
            {
                string   s    = sr.ReadLine();
                string[] arr  = s.Split(',');
                string   id   = arr[0];
                string   lec  = arr[1];
                string   lab  = arr[2];
                int      pir  = Convert.ToInt32(arr[3]);
                string   inst = arr[4];
                string   TA   = arr[5];
                Course   cc   = new Course(id, lec, lab, pir, inst, TA);
                courselist.Add(cc);
            }
            fs.Close();
            FileStream   fs1 = new FileStream("Instructor.txt", FileMode.Open);
            StreamReader sr1 = new StreamReader(fs1);

            while (sr1.Peek() != -1)
            {
                string     s     = sr1.ReadLine();
                string[]   arr   = s.Split(',');
                int        id    = int.Parse(arr[0]);
                string     Name  = arr[1];
                string     Phone = arr[2];
                string     mail  = arr[3];
                string     ads   = arr[4];
                Instructor cc    = new Instructor(id, Name, Phone, mail, ads);
                Instructor.Instructorlist.Add(cc);
            }
            sr1.Close();
            //fs1.Close();
            FileStream   fsa = new FileStream("Room.txt", FileMode.Open);
            StreamReader sra = new StreamReader(fsa);

            while (sra.Peek() != -1)
            {
                string   s    = sra.ReadLine();
                string[] arr  = s.Split(',');
                string   id   = arr[0];
                string   num  = arr[1];
                int      cap  = Convert.ToInt32(arr[2]);
                string   plc  = arr[4];
                string   avlb = arr[3];
                Room     cc   = new Room(id, num, cap, avlb, plc);
                Room.roomlist.Add(cc);
            }
            sra.Close();
            fsa.Close();
            FileStream   fst = new FileStream("TeacherAssestant.txt", FileMode.Open);
            StreamReader srt = new StreamReader(fst);

            while (srt.Peek() != -1)
            {
                string            s     = srt.ReadLine();
                string[]          arr   = s.Split(',');
                int               id    = int.Parse(arr[0]);
                string            Name  = arr[1];
                string            Phone = arr[2];
                string            mail  = arr[3];
                string            ads   = arr[4];
                Teacher_Assistant cc    = new Teacher_Assistant(id, Name, Phone, mail, ads);
                Teacher_Assistant.TAlist.Add(cc);
            }
            srt.Close();
            fst.Close();
        }