private void buttonStartLesson_Click(object sender, EventArgs e) { Lesson new_lesson = new Lesson(); new_lesson.subject = new Subject("Mathematics"); new_lesson.topic = "topic 1"; Pupil pupil1 = new Pupil("Tim"); Pupil pupil2 = new Pupil("Alex"); Pupil pupil3 = new Pupil("Jon"); Pupil pupil4 = new Pupil("Cindy"); new_lesson.pupil_group = new PupilsGroup("Group 1"); new_lesson.pupil_group.pupils.Add(pupil1.pupilId, pupil1); new_lesson.pupil_group.pupils.Add(pupil2.pupilId, pupil2); new_lesson.pupil_group.pupils.Add(pupil3.pupilId, pupil3); new_lesson.pupil_group.pupils.Add(pupil4.pupilId, pupil4); new_lesson.teacher = State.teachers[0]; StartLesson startLesson = new StartLesson(new_lesson); startLesson.Show(); }
public StartLesson(Lesson lesson) { this.lesson = lesson;// curriculum InitializeComponent(); for (int i = 0; i < State.lessonStarts.Count; i++) { comboBoxStartTime.Items.Add((i + 1).ToString() + ". " + State.lessonStarts[i]); } DateTime dateTime = DateTime.Now; var current_time = dateTime.TimeOfDay; int startIndex = 0; bool find = false; foreach(var lessonEnd in State.lessonEnds) { if (current_time.CompareTo(lessonEnd) == -1) { comboBoxStartTime.SelectedIndex = startIndex; find = true; break; } startIndex++; } if(find == false) { comboBoxStartTime.SelectedIndex = State.lessonStarts.Count - 1; } labelTeacherName.Text = lesson.teacher.name; labelSubjectName.Text = lesson.subject.name; labelGroupName.Text = lesson.pupil_group.group_name; textBoxTopic.Text = lesson.topic; }
static void Main(string[] args) { Teacher teacher = new Teacher("Maks"); Pupil pupil1 = new Pupil("Andrew"); Pupil pupil2 = new Pupil("Kolya"); Pupil pupil3 = new Pupil("Olya"); Pupil pupil4 = new Pupil("Ira"); PupilsGroup pupils_group = new PupilsGroup("P11014"); pupils_group.pupils.Add(pupil1); pupils_group.pupils.Add(pupil2); pupils_group.pupils.Add(pupil3); pupils_group.pupils.Add(pupil4); Subject subject = new Subject("C#"); subject.topics.Add("Binary and xml serializations"); subject.topics.Add("Global project"); Lesson lesson1 = new Lesson(subject, subject.topics[0], teacher, pupils_group); lesson1.ManageLesson(); Console.ReadLine(); }
public LessonForm(Lesson lesson) { InitializeComponent(); this.lesson = lesson; //Initialize page content this.labelSubject.Text = lesson.subject.name; this.labelTopic.Text = lesson.topic; this.labelGroup.Text = lesson.pupil_group.group_name; tableLayoutPanelGroup1.Controls.Add(new Label(){ Text = "pupil", TextAlign = ContentAlignment.MiddleCenter }, 0, tableLayoutPanelGroup1.RowCount - 1); tableLayoutPanelGroup1.Controls.Add(new Label(){ Text = "present", TextAlign = ContentAlignment.MiddleCenter }, 1, tableLayoutPanelGroup1.RowCount - 1); tableLayoutPanelGroup1.Controls.Add(new Label(){ Text = "put marks", TextAlign = ContentAlignment.MiddleCenter }, 2, tableLayoutPanelGroup1.RowCount - 1); tableLayoutPanelGroup1.Controls.Add(new Label(){ Text = "add mark", TextAlign = ContentAlignment.MiddleCenter }, 3, tableLayoutPanelGroup1.RowCount - 1); tableLayoutPanelGroup1.Controls.Add(new Label(){ Text = "delete mark", TextAlign = ContentAlignment.MiddleCenter }, 4, tableLayoutPanelGroup1.RowCount - 1); foreach(var pupil in lesson.pupil_group.pupils) { tableLayoutPanelGroup1.RowCount += 1; tableLayoutPanelGroup1.RowStyles.Add(new RowStyle(SizeType.Absolute, 25)); tableLayoutPanelGroup1.Controls.Add(new Label() { Text = pupil.Value.name, TextAlign = ContentAlignment.MiddleCenter }, 0, tableLayoutPanelGroup1.RowCount - 1); tableLayoutPanelGroup1.Controls.Add(new CheckBox() { CheckAlign = ContentAlignment.MiddleCenter }, 1, tableLayoutPanelGroup1.RowCount - 1); tableLayoutPanelGroup1.Controls.Add(new Label(), 2, tableLayoutPanelGroup1.RowCount - 1); } }
static void Main(string[] args) { List<Teacher> teachers = new List<Teacher>(); List<PupilsGroup> pupilGroups = new List<PupilsGroup>(); Teacher Max = new Teacher("Max"); Max.login = "******"; Max.password = "******"; teachers.Add(Max); Pupil pupil1 = new Pupil("Andrew"); Pupil pupil2 = new Pupil("Kolya"); Pupil pupil3 = new Pupil("Olya"); Pupil pupil4 = new Pupil("Ira"); PupilsGroup pupils_group1 = new PupilsGroup("P11014"); pupils_group1.pupils.Add(pupil1.pupilId, pupil1); pupils_group1.pupils.Add(pupil2.pupilId, pupil2); pupils_group1.pupils.Add(pupil3.pupilId, pupil3); pupils_group1.pupils.Add(pupil4.pupilId, pupil4); pupilGroups.Add(pupils_group1); Subject subject = new Subject("C#"); subject.topics.Add("Binary and xml serializations"); subject.topics.Add("Global project"); Lesson lesson1 = new Lesson(subject, subject.topics[0], Max, pupils_group1); lesson1.ManageLesson(); Teacher Alex = new Teacher("Alex"); Alex.login = "******"; Alex.password = "******"; teachers.Add(Alex); Pupil pupil11 = new Pupil("Jon"); Pupil pupil22 = new Pupil("Brad"); Pupil pupil33 = new Pupil("Josh"); Pupil pupil44 = new Pupil("Katrin"); PupilsGroup pupils_group2 = new PupilsGroup("P11015"); pupils_group2.pupils.Add(pupil11.pupilId, pupil11); pupils_group2.pupils.Add(pupil22.pupilId, pupil22); pupils_group2.pupils.Add(pupil33.pupilId, pupil33); pupils_group2.pupils.Add(pupil44.pupilId, pupil44); pupilGroups.Add(pupils_group2); Lesson lesson2 = new Lesson(subject, subject.topics[0], Alex, pupils_group2); //lesson2.ManageLesson(); List<Lesson> lessons = new List<Lesson>(); lessons.Add(lesson1); lessons.Add(lesson2); XML<List<PupilsGroup>>.Serialize(path + "pupilGroups.xml", pupilGroups); XML<List<Lesson>>.Serialize(path + "lessons.xml", lessons); XML<List<Teacher>>.Serialize(path + "teachers.xml", teachers); Console.ReadLine(); }