Beispiel #1
0
 static void Main()
 {
     bool groups_directory_exist = false;
     bool subjects_directory_exist = false;
     DirectoryInfo current_dir_info = new DirectoryInfo(Environment.CurrentDirectory);
     foreach (DirectoryInfo cur_dir_info in current_dir_info.GetDirectories())
     {
         if (cur_dir_info.Name == "all_subjects")
         {
             subjects_directory_exist = true;
         }
         if (cur_dir_info.Name == "all_groups")
         {
             groups_directory_exist = true;
         }
     }
     if (!subjects_directory_exist)
     {
         List<subject> test_list_of_subjects = new List<subject>();
         test_list_of_subjects.Add(new subject("mathematics", new List<string> { "math_theme_1", "math_theme_2", "math_theme_3" }));
         test_list_of_subjects.Add(new subject("physics", new List<string> { "phys_theme_1", "phys_theme_2", "phys_theme_3" }));
         test_list_of_subjects.Add(new subject("biology", new List<string> { "bio_theme_1", "bio_theme_2", "bio_theme_3" }));
         Directory.CreateDirectory("all_subjects");
         XmlSerializer serializer_for_subjects = new XmlSerializer(typeof(List<subject>));
         FileStream stream_to_subjects = new FileStream(@"all_subjects\all_subjects.xml",
              FileMode.Create, FileAccess.Write);
         serializer_for_subjects.Serialize(stream_to_subjects, test_list_of_subjects);
         stream_to_subjects.Close();
     }
     if (!groups_directory_exist)
     {
         group test_group = new group("TEST_GROUP_1", new List<student> {new student("first_student_1"),
            new student("second_student_1"),new student("third_student_1")});
         group test_group_2 = new group("TEST_GROUP_2", new List<student> {new student("first_student_2"),
            new student("second_student_2"),new student("third_student_2")});
         Directory.CreateDirectory(@"all_groups\" + test_group.name_of_group + @"\all_lessons");
         Directory.CreateDirectory(@"all_groups\" + test_group_2.name_of_group + @"\all_lessons");
         FileStream stream_to_groups = new FileStream(@"all_groups\" + test_group.name_of_group +
             @"\" + test_group.name_of_group + ".xml", FileMode.Create, FileAccess.Write);
         XmlSerializer serializer_for_groups = new XmlSerializer(typeof(group));
         serializer_for_groups.Serialize(stream_to_groups, test_group);
         stream_to_groups.Close();
         FileStream stream_to_groups_2 = new FileStream(@"all_groups\" + test_group_2.name_of_group +
             @"\" + test_group_2.name_of_group + ".xml", FileMode.Create, FileAccess.Write);
         serializer_for_groups.Serialize(stream_to_groups_2, test_group_2);
         stream_to_groups_2.Close();
     }
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new Form1());
 }
Beispiel #2
0
 public form_for_lesson(group new_group, subject new_subject, int index_of_theme, DateTime date,
     teacher new_teacher)
 {
     InitializeComponent();
     current_teacher = new_teacher;
     this.date_label.Text = lesson_form.date_string + date.Day.ToString() + "." + date.Month.ToString() +
         "." + date.Year.ToString();
     current_group = new_group;
     current_subject = new_subject;
     current_index_of_theme = index_of_theme;
     this.current_name_of_group.Text = current_group.name_of_group;
     this.journal_table.ColumnCount = 2;
     this.journal_table.RowCount = current_group.all_students.Count + 1;
     Label buf_for_label = new Label();
     buf_for_label.Text = main_strings.students_string;
     this.journal_table.Controls.Add(buf_for_label,0,0);
     Label buf_for_label_2 = new Label();
     buf_for_label_2.Text = main_strings.marks_string;
     this.journal_table.Controls.Add(buf_for_label_2,1,0);
     int counter_of_students = 1;
     foreach (student current_student in current_group.all_students)
     {
         Label student_name_label = new Label();
         student_name_label.AutoSize = true;
         student_name_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, 
             System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
         student_name_label.Text = current_student.name;
         this.journal_table.Controls.Add(student_name_label, 0, counter_of_students);
         ++counter_of_students;
     }
     string [] list_of_marks = new string[] {"1","2","3","4","5","6","7","8","9","10","N","nothing"};
     for (int counter = 0; counter < current_group.all_students.Count; ++counter)
     {
         ComboBox buf_for_list_of_marks = new ComboBox();
         buf_for_list_of_marks.Items.AddRange(list_of_marks);
         all_marks.Add(buf_for_list_of_marks);
         this.journal_table.Controls.Add(buf_for_list_of_marks,1,counter + 1);
     }
     current_lesson = new lesson(current_group.name_of_group, current_subject.all_themes[current_index_of_theme],
         current_teacher.name, date);
     this.subject_label.Text = current_manager.GetString("subject_string") + current_subject.name;
     this.theme_label.Text = current_manager.GetString("theme_string") + current_subject.all_themes[current_index_of_theme];
 }