Пример #1
0
        private void GenerateButton_Click(object sender, EventArgs e)
        {
            if (checked_subjects_id.Count == 0)
            {
                CustomMessages.SelectFail(this);
                return;
            }

            manipulator.AllSelections = new SubjectSelectionController().GetAll();

            manipulator.Halls_Height_Preference
                = floorsHeightPreferenceToolStripMenuItem.Checked;

            manipulator.Preferred_Lecturers.Clear();
            manipulator.Denied_Lecturers.Clear();

            foreach (int id in lecturers_option_form.preferred_lecturers_id)
            {
                manipulator.Preferred_Lecturers.Add(lecturer_controller.Get(id));
            }
            foreach (int id in lecturers_option_form.denied_lecturers_id)
            {
                manipulator.Denied_Lecturers.Add(lecturer_controller.Get(id));
            }

            if (times_option_form.preferred_times != null)
            {
                manipulator.Preferred_Lecture_Times = times_option_form.preferred_times;
            }
            if (times_option_form.denied_times != null)
            {
                manipulator.Denied_Lecture_Times = times_option_form.denied_times;
            }

            manipulator.Selected_Subjects.Clear();

            foreach (int id in checked_subjects_id)
            {
                manipulator.Selected_Subjects.Add(subject_controller.Get(id));
            }
            optimized_selections = manipulator.GetOptimizedSelections();

            if (optimized_selections.Count == 0 || optimized_selections[0].Count == 0)
            {
                CustomMessages.NoSelectionAvailable(this);
            }
            else
            {
                CurrentSelection = 0;
            }
        }
Пример #2
0
        private void RemoveCurrentSelection()
        {
            if (SelectionsGridView.Rows.Count == 0)
            {
                CustomMessages.SelectFail(this);
                return;
            }


            int index = SelectionsGridView.CurrentCell.RowIndex,
                id    = Convert.ToInt32(SelectionsGridView["Id", index].Value);

            controller.Delete(new SubjectSelection()
            {
                Id = id
            });
            RemoveFromTableById(id);
        }