private void addAlternativeClassroomsButton_Click(object sender, EventArgs e) { List<ChooseItemsParameters> classrooms = new List<ChooseItemsParameters>(); List<ChooseItemsParameters> alreadySelectedClassrooms = new List<ChooseItemsParameters>(); foreach (var classroom in mDBManager.Classrooms) { if (long.Parse(dropDownListWantedRoom.SelectedValue.ToString()) != classroom.ID) { classrooms.Add(new ChooseItemsParameters(classroom.Name, classroom.ShortName, classroom.ID)); } } if (mFormState == FormState.AddingNew) { chooseAlternativeClassroomsForm = new ChooseItemsForm(ChooseItems.Mode.MultipleItems, "Избери алтернативни стаи за този урок", classrooms); } if(mFormState == FormState.Editing){ foreach(var room in mLesson.AlternativeClassrooms){ alreadySelectedClassrooms.Add(new ChooseItemsParameters(room.Name, room.ShortName, room.ID)); } chooseAlternativeClassroomsForm = new ChooseItemsForm(ChooseItems.Mode.MultipleItems, "Редактирай алтернативните стаи за този урок", classrooms, alreadySelectedClassrooms); } chooseAlternativeClassroomsForm.OnReadyButtonClicked += chooseAlternativeClassroomsForm_OnReadyButtonClicked; chooseAlternativeClassroomsForm.Show(); }
private void chooseSubjectsToBeTaughtInThisRoomButton_Click(object sender, EventArgs e) { List<ChooseItemsParameters> subjects = new List<ChooseItemsParameters>(); foreach (var s in mDBManager.Subjects) { subjects.Add(new ChooseItemsParameters(s.Name, s.ShortName, s.ID)); } Console.WriteLine("Count of the subjects: {0}", subjects.Count); List<ChooseItemsParameters> alreadySpecialisatedSubjects = new List<ChooseItemsParameters>(); try { foreach (var sID in specialisatedSubjectsIDs) { foreach (var subject in mDBManager.Subjects) { if (sID == subject.ID) { alreadySpecialisatedSubjects.Add(new ChooseItemsParameters(subject.Name, subject.ShortName, subject.ID)); } } } } catch { } try { chooseSubjectsToBeTaughtForm.gridviewItems.Rows.Clear(); } catch { } chooseSubjectsToBeTaughtForm = new ChooseItemsForm(ChooseItems.Mode.MultipleItems, "Избери предмети, които да се преподават в тази стая", subjects, alreadySpecialisatedSubjects); chooseSubjectsToBeTaughtForm.OnReadyButtonClicked += chooseSubjectsToBeTaught_OnReadyButtonClicked; chooseSubjectsToBeTaughtForm.Show(); }
private void chooseHeadclassOfThisClassroom_Click(object sender, EventArgs e) { if (mFormState == FormState.AddingNew) { List<ChooseItemsParameters> classes = new List<ChooseItemsParameters>(); foreach (var s in mDBManager.Classes) { classes.Add(new ChooseItemsParameters(s.Name, s.ShortName, s.ID)); } chooseHeadclassOfThisClassroomForm = new ChooseItemsForm(ChooseItems.Mode.SingleItem, "Избери клас, на който тази стая да бъде класна стая", classes); } if (mFormState == FormState.Editing) { List<ChooseItemsParameters> classes = new List<ChooseItemsParameters>(); foreach (var s in mDBManager.Classes) { classes.Add(new ChooseItemsParameters(s.Name, s.ShortName, s.ID)); } List<ChooseItemsParameters> alreadyChoosedClass = new List<ChooseItemsParameters>(); Class choosedClass = mDBManager.Classes[0]; foreach(Class c in mDBManager.Classes){ if(c.ID == mHomeClassID){ choosedClass = c; break; } } alreadyChoosedClass.Add(new ChooseItemsParameters(choosedClass.Name, choosedClass.Name, choosedClass.ID)); chooseHeadclassOfThisClassroomForm = new ChooseItemsForm(ChooseItems.Mode.SingleItem, "Избери клас, на който тази стая да бъде класна стая", classes, alreadyChoosedClass); } chooseHeadclassOfThisClassroomForm.OnReadyButtonClicked += chooseHeadclassOfThisClassroom_OnReadyButtonClicked; chooseHeadclassOfThisClassroomForm.Show(); }