Пример #1
0
 public void AddSubject(Subject s)
 {
     subjects.Add(s);
 }
Пример #2
0
 public void Read()
 {
     System.IO.StreamReader input = new System.IO.StreamReader("Input.txt");
     System.IO.StreamReader sub = new System.IO.StreamReader("Subjects.txt");
     while (!input.EndOfStream)
     {
         Group gr = new Group();
         gr.Name = input.ReadLine();
         gr.year = (Year)int.Parse(input.ReadLine());
         int quantity = int.Parse(input.ReadLine());
         for (int i = 0; i < quantity; i++)
         {
             Student s = new Student();
             s.group = gr;
             string[] line = input.ReadLine().Split(' ');
             s.Surname = line[0];
             s.Name = line[1];
             s.Patronymic = line[2];
             s.Id = line[3];
             s.Year = int.Parse(line[4]);
             gr.AddStudent(s);
         }
         groups.Add(gr);
         input.ReadLine();
     }
     while(!sub.EndOfStream)
     {
         Subject sb = new Subject();
         string[] line = sub.ReadLine().Split(' ');
         sb.Name = line[0];
         sb.Lecturer = line[1];
         int counter = int.Parse(line[2]);
         for (int i = 0; i < counter; i++)
         {
             foreach(Group gr in groups)
             {
                 if(gr.Name == line[3+i])
                 {
                     gr.AddSubject(sb);
                     sb.AddGroup(gr);
                 }
             }
         }
         subjects.Add(sb);
     }
 }