Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!currentTT.IsFinalised())
            {
                currentTT.Finalise();                           //finalises structure, so that we can't change it.
            }
            if (cb_periodStart.Text == "")
            {
                return;
            }
            if (cb_noOfPeriods.Text == "")
            {
                return;
            }
            if ((cb_periodStart.SelectedIndex < 0) || (cb_periodStart.SelectedIndex > 255))
            {
                return;
            }

            byte   periodIndex    = Convert.ToByte(cb_periodStart.SelectedIndex);
            byte   dayIndex       = Convert.ToByte(cb_day.SelectedIndex);
            byte   noOfPeriods    = Convert.ToByte(cb_noOfPeriods.Text);
            string teacherCode    = cb_teacherCode.Text;
            string subjectCode    = cb_subjectCode.Text;
            string roomCode       = cb_room.Text;
            byte   yearIndex      = Convert.ToByte(cb_yearGroup.SelectedIndex);
            byte   formIndex      = Convert.ToByte(cb_class.SelectedIndex);
            byte   homeworkAmount = Convert.ToByte(num_hwkAmount.Value);
            string message        = "";
            string m2             = "";

            if (currentTT.IsClassClash(dayIndex, periodIndex, yearIndex, formIndex, out message))
            {
                m2 += message + Environment.NewLine;
            }
            if (currentTT.IsRoomClash(dayIndex, periodIndex, cb_room.SelectedIndex, out message))
            {
                m2 += message;
            }
            if (currentTT.IsStaffClash(dayIndex, periodIndex, cb_teacherCode.SelectedIndex, out message))
            {
                m2 += message;
            }

            if (m2 != "")
            {
                MessageBox.Show(m2);
                return;
            }

            if (mode == AddLessonMode.Edit)
            {
                currentTT.DeleteLesson(loadedLesson);
            }

            currentTT.AddLesson(dayIndex, periodIndex, noOfPeriods, subjectCode, teacherCode, roomCode, yearIndex, formIndex, homeworkAmount, ck_locked.Checked, ck_invisible.Checked);

            this.Close();
        }
Ejemplo n.º 2
0
 private void btn_addLessonViaSelection_Click(object sender, EventArgs e)
 {
     if (!currentTT.IsFinalised())
     {
         currentTT.Finalise();
     }
     addLessonViaMenu = true; //this makes sure that we select blank places to add new lessons to.
     lbl_status.Text  = "Click where the lesson should be added.";
 }