Ejemplo n.º 1
0
        private void SelectionDeclineButton_Click(object sender, EventArgs e)
        {
            if (New) //reset
            {
                //reset
                SetSelection(new SubjectSelection());

                //reset all lecturers
                for (int i = 0; i < LecturersGridView.Rows.Count; ++i)
                {
                    if (LecturersGridView["Select", i].Value != null &&
                        (bool)LecturersGridView["Select", i].Value)
                    {
                        LecturersGridView["Select", i].Value = false;
                    }
                }
                checked_lecturers_id.Clear();

                TimetableControl.ResetLectureTimes();
            }
            else if (CustomMessages.YesNoDelete(this))
            {
                Deleted = controller.Delete(selection);
                Close();
            }
        }
Ejemplo n.º 2
0
 private void UpdateTimetable()
 {
     TimetableControl.Update();
     _subjects[LvSubjects.SelectedIndex] = TimetableControl.Model;
     LvSubjects.Items.Refresh();
     _changed = true;
 }
Ejemplo n.º 3
0
 private void OkayButton_Click(object sender, EventArgs e)
 {
     preferred_times = TimetableControl.GetLectureTimes(TimetableControl.IsPreferredCell);
     denied_times    = TimetableControl.GetLectureTimes(TimetableControl.IsDeniedCell);
     if (preferred_times.Count > 0 || denied_times.Count > 0)
     {
         CustomMessages.OptionsSaved(this);
     }
     Hide();
 }
Ejemplo n.º 4
0
        private void timetablesMenuButton_Click(object sender, EventArgs e)
        {
            mainPanel.Controls.Clear();
            TimetableControl timetableControl = new TimetableControl {
                Dock = DockStyle.Fill
            };

            mainPanel.Controls.Add(timetableControl);
            UnderlineMenuButton(timetablesMenuButton);
        }
Ejemplo n.º 5
0
        public void SetSelection(SubjectSelection selection)
        {
            this.selection = selection;
            deep_copy      = new SubjectSelection(selection);
            New            = (selection.Id == 0);

            //BindData();
            SubjectCombobox.SelectedValue = selection.SubjectId;
            HallCombobox.SelectedValue    = selection.HallId;

            TimetableControl.AddSubjectAndTimes(
                selection.Subject,
                selection.Times);
        }
Ejemplo n.º 6
0
        private void SelectionAcceptButton_Click(object sender, EventArgs e)
        {
            if (SubjectCombobox.SelectedIndex == -1 ||
                HallCombobox.SelectedIndex == -1)
            {
                CustomMessages.ChooseBeforeCarryOn(this, "subject and hall");
                return;
            }

            if (New)
            {
                //databinding by hand
                selection.HallId    = Convert.ToInt32(HallCombobox.SelectedValue);
                selection.SubjectId = Convert.ToInt32(SubjectCombobox.SelectedValue);

                int selection_id = (int)controller.Insert(selection);
                selection.Id = selection_id;
                if (selection_id > 0)
                {
                    selection_time_controller.InsertTimes(selection_id,
                                                          TimetableControl.GetLectureTimes(TimetableControl.IsSelectedCell));
                    selection_lecturer_controller.InsertLecturers(selection_id,
                                                                  checked_lecturers_id.ToList());
                    CustomMessages.Inserted(this, "selection");

                    InsertedSelections.Add(selection);
                    SetAfterInsert();
                }
            }
            else
            {
                //quite the horrible way as I delete everything and re-insert them
                if (controller.Update(selection))
                {
                    selection_time_controller.DeleteBySelection(selection.Id);
                    selection_lecturer_controller.DeleteBySelection(selection.Id);

                    selection_time_controller.InsertTimes(selection.Id,
                                                          TimetableControl.GetLectureTimes(TimetableControl.IsSelectedCell));
                    selection_lecturer_controller.InsertLecturers(selection.Id,
                                                                  checked_lecturers_id.ToList());

                    SetSelection(selection);
                    CustomMessages.Updated(this, "selection");
                    //TimetableControl.ResetLectureTimes();
                    Updated = true;
                }
            }
        }
Ejemplo n.º 7
0
 private void SelectionApplyButton_Click(object sender, EventArgs e)
 {
     TimetableControl.ResetLectureTimes();
     TimetableControl.AddSubjectToSelectedCells((Subject)SubjectCombobox.SelectedItem);
 }
Ejemplo n.º 8
0
 private void SetAfterInsert()
 {
     deep_copy = new SubjectSelection(selection);
     selection = new SubjectSelection();
     TimetableControl.ResetLectureTimes();
 }
Ejemplo n.º 9
0
 private void ResetButton_Click(object sender, EventArgs e)
 {
     TimetableControl.ResetLectureTimes();
 }
Ejemplo n.º 10
0
 private void resetSelectedTimesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     TimetableControl.ResetSelectedTimes();
 }
Ejemplo n.º 11
0
 private void resetAllToolStripMenuItem_Click(object sender, EventArgs e)
 {
     TimetableControl.ResetLectureTimes();
 }
Ejemplo n.º 12
0
 private void addDeniedTimesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     TimetableControl.SetDeniedLectureTimes();
 }