Exemple #1
0
        void dgvSchedule_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex <= 1 || e.RowIndex < 0)
            {
                return;
            }

            LessonForm      frmLesson = new LessonForm(curSheduleType);
            SchedulePointer Tag       = dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag as SchedulePointer;

            frmLesson.txtSheduleTime.Text = ScheduleTime.GetDescription(Tag.Time1);
            frmLesson.Employments         = Schedule.Employments;
            frmLesson.ds      = ScheduleDataSet;
            frmLesson.Adapter = EducationAdapter;
            frmLesson.Rooms   = Rooms;
            frmLesson.curClmn = dgvSchedule.CurrentCell.ColumnIndex;

            frmLesson.Time1   = Tag.Time1;
            frmLesson.Lesson1 = Schedule.GetLesson(Tag.Time1, Tag.Room1);

            frmLesson.Time2   = Tag.Time2;
            frmLesson.Lesson2 = Schedule.GetLesson(Tag.Time2, Tag.Room2);

            frmLesson.Shedule = Schedule;

            if (frmLesson.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                UpdateTableShedule();
                if (curSheduleType == scheduleType.exams)
                {
                    if (frmLesson.Lesson1 != null)
                    {
                        OneDayTimeBlocked(dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex + 1], frmLesson.Time1.Week);
                        OneDayTimeBlocked(dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex + 2], frmLesson.Time1.Week);
                        OneDayTimeBlocked(dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex + 3], frmLesson.Time1.Week);
                    }
                    if (frmLesson.Lesson2 != null)
                    {
                        OneDayTimeBlocked(dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex + 1], frmLesson.Time2.Week);
                        OneDayTimeBlocked(dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex + 2], frmLesson.Time2.Week);
                        OneDayTimeBlocked(dgvSchedule.Rows[e.RowIndex].Cells[e.ColumnIndex + 3], frmLesson.Time2.Week);
                    }
                }
            }
        }