Esempio n. 1
0
 //add group
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Window1 win1 = new Window1();
     win1.Title = "Добавление новой группы";
     win1.ShowDialog();
     if (win1.flag)
     {
         MyList<Group> clear = new MyList<Group>();
         Group g = new Group();
         g.number = Convert.ToInt32(win1.textbox.Text);
         faclist.getElement(listbox.SelectedIndex).groups.addObject(g);
         foreach (Group gg in faclist.getElement(listbox.SelectedIndex).groups)
             clear.addObject(gg);
         grouplist.ItemsSource = clear;
     }
 }
Esempio n. 2
0
 //delete group
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (grouplist.SelectedIndex != -1)
     {
         Window3 win3 = new Window3();
         win3.Karl.Text += " " + faclist.getElement(listbox.SelectedIndex).groups.getElement(grouplist.SelectedIndex).number.ToString() + "?";
         win3.ShowDialog();
         if (win3.flag)
         {
             MyList<Group> clear = new MyList<Group>();
             Group g = new Group();
             g = faclist.getElement(listbox.SelectedIndex).groups.getElement(grouplist.SelectedIndex);
             faclist.getElement(listbox.SelectedIndex).groups.Remove(grouplist.SelectedIndex);
             foreach (Group gg in faclist.getElement(listbox.SelectedIndex).groups)
                 clear.addObject(gg);
             grouplist.ItemsSource = clear;
         }
     }
 }
Esempio n. 3
0
        public static void loadFromFile(String filename)
        {
            FileStream fin;
            try{
                fin = new FileStream(filename,FileMode.Open);
            }catch(FileNotFoundException exc){
                Console.WriteLine (exc.Message + " не удалось открыть файл ");
                return;
            }
            StreamReader reader = new StreamReader (fin);
            String str;
            String[] arr;

            while ((str = reader.ReadLine())!=null) {
                arr = str.Split (' ');
                Faculty temp = new Faculty ();
                temp.name = arr [0];
                int countOfGroup = Convert.ToInt32(arr [1]);

                for (int i = 0; i < countOfGroup; i++) {
                    str = reader.ReadLine ();
                    arr = str.Split (' ');
                    Group tempg = new Group ();
                    tempg.number = int.Parse (arr [0]);
                    int studentsSize = int.Parse (arr [1]);
                    for (int j = 0; j < studentsSize; j++) {
                        str = reader.ReadLine ();
                        arr = str.Split (' ');
                        Student temps = new Student ();
                        temps.name = arr [1];
                        temps.surname = arr [0];
                        tempg.addStudent (temps);
                    }
                    temp.addGroup (tempg);
                }

                faculties.addObject (temp);
            }

            reader.Close ();
            fin.Close ();
        }
Esempio n. 4
0
 public void addGroup()
 {
     Group group = new Group (groups.getSize()+1);
     addGroup (group);
 }
Esempio n. 5
0
 public void addGroup(Group group)
 {
     group.faculty = this.name;
     groups.addObject(group);
 }
Esempio n. 6
0
 public void addGroup(Group group)
 {
     groups.addObject(group);
 }