예제 #1
0
 /// <summary>
 /// this allows the user to add the yeargroup 
 /// information to the datagridview and the database 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAdd_Click(object sender, EventArgs e)
 {
     DBconnector dbc = new DBconnector();
     dbc.insertYG(new YearGroupCL(0, txtGroupName.Text, int.Parse(txtGroupSizeTB.Text)));
     this.yeargroupTableAdapter.Fill(this.timetableseDS.yeargroup);
     MessageBox.Show(" year group information added");
 }
예제 #2
0
 /// <summary>
 /// this allows the  user to  
 /// enter the lectuer informaton 
 /// into the database form the text boxes  
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAdd_Click(object sender, EventArgs e)
 {
     //TODO: Validate Data
     DBconnector dbc = new DBconnector();
     // dbc.insertMOD(new ModuleCL(0, txtModName.Text, int.Parse(txtModTeachingHrs.Text), int.Parse(txtReqTeachHrs.Text)));
     dbc.insertMOD(new ModuleCL(0, txtModName.Text, int.Parse(txtReqTeachHrs.Text), int.Parse(txtModTeachingHrs.Text)));
     this.moduleTableAdapter.Fill(this.timetableseDS.module);
     MessageBox.Show("module information added");
 }
예제 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     DBconnector dbc = new DBconnector();
      int id = dbc.GetLessID(cmblect.Text, cmbGroup.Text, cmbRoom.Text, cmbMod.Text, cmbStartTime.Text, cmbDay.Text);
      if (id > -1)
      {
          dbc.DeleteLess(id);
          dgvLesson.DataSource = dbc.LessonVeiw();
      }
 }
예제 #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dtgRoom.SelectedRows.Count > 0)
            {
                int id = (int)this.dtgRoom.SelectedRows[0].Cells[0].Value;
                DBconnector db = new DBconnector();
                db.DeleteRoom(id);
                this.roomTableAdapter.Fill(this.timetableseDS.room);

            }
        }
예제 #5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DBconnector dbc = new DBconnector();

            //TODO: Validate Data
            // adds the room information form the text boxes to the  databases and up dates it

             dbc.InsertRoom(new RoomCL(0, txtRName.Text, cmbType.SelectedItem.ToString(), int.Parse(txtCap.Text)));
             this.roomTableAdapter.Fill(this.timetableseDS.room);
             MessageBox.Show("Room information added");
        }
예제 #6
0
        /// <summary>
        /// allows the user to delete a seclected 
        /// modlue from the datagrid view and the data base 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dataGridViewModule.SelectedRows.Count > 0)
            {
               int id = (int)this.dataGridViewModule.SelectedRows[0].Cells[0].Value;
                DBconnector db = new DBconnector();
                db.DeleteMod(id);
                this.moduleTableAdapter.Fill(this.timetableseDS.module);

            }
        }
예제 #7
0
        /// <summary>
        /// this  allow the user to  and a  lectuer  to the 
        /// database and show it in the datagridLect the  the user can see 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param> 
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DBconnector dbc = new DBconnector();

            //TODO: Validate Data
            // adds the lectuer information form the text boxes to the  databases and up dates it
            dbc.InsertLect(new LecturerCL(0, txtLectName.Text, int.Parse(txtTeachingHrs.Text), int.Parse(txtReqHrs.Text)));
            // TODO: This line of code loads data into the 'timetableseDS.lecturer' table. You can move, or remove it, as needed.
            this.lecturerTableAdapter.Fill(this.timetableseDS.lecturer);
            MessageBox.Show("lectuer information added");
        }
예제 #8
0
 /// <summary>
 /// this buton allows the user to delete a module 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     //TODO call  on  detle  fucntion to  make it cann be delted (TRY CAtch
     if (dataGridViewYG.SelectedRows.Count > 0)
     {
         int id = (int)this.dataGridViewYG.SelectedRows[0].Cells[0].Value;
         DBconnector db = new DBconnector();
         db.DeleteYG(id);
         this.yeargroupTableAdapter.Fill(this.timetableseDS.yeargroup);
     }
     else
         MessageBox.Show("record not deleted");
 }
예제 #9
0
        /// <summary>
        /// this button allows the user to 
        /// delete a sectected lecuter from the dataGridView based  on the 
        /// frist Colume and the frist Cell   
        /// </summary>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            // if statement that counts the number of recods in the
            //table and deletes the one thats secleted
            if (dataGridViewLect.SelectedRows.Count > 0)
            {
                int id = (int)this.dataGridViewLect.SelectedRows[0].Cells[0].Value;
                DBconnector db = new DBconnector();
                db.DeleteLect(id);
                // TODO: This line of code loads data into the 'timetableseDS.lecturer' table. You can move, or remove it, as needed.
                this.lecturerTableAdapter.Fill(this.timetableseDS.lecturer);

            }
        }
예제 #10
0
        private void Lesson_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'timetableseDS.yeargroup' table. You can move, or remove it, as needed.
            this.yeargroupTableAdapter.Fill(this.timetableseDS.yeargroup);
            // TODO: This line of code loads data into the 'timetableseDS.room' table. You can move, or remove it, as needed.
            this.roomTableAdapter.Fill(this.timetableseDS.room);
            // TODO: This line of code loads data into the 'timetableseDS.module' table. You can move, or remove it, as needed.
            this.moduleTableAdapter.Fill(this.timetableseDS.module);
            // TODO: This line of code loads data into the 'timetableseDS.lecturer' table. You can move, or remove it, as needed.
            this.lecturerTableAdapter.Fill(this.timetableseDS.lecturer);

            DBconnector dbc = new DBconnector();
            dgvLesson.DataSource = dbc.LessonVeiw();
            // dt.Fill(dbc.LessonView());
        }
예제 #11
0
        // Checks user input for clashes with the database
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DBconnector dbc = new DBconnector();
            if (dbc.checkClash(cmblect.Text, cmbGroup.Text, cmbRoom.Text, cmbMod.Text, cmbStartTime.Text, cmbEndTime.Text, cmbDay.Text))
            {
                MessageBox.Show("Sorry there is a clash with your selection");
                return;
            }

            //TODO: Validate Data
            // adds the lectuer information form the text boxes to the  databases and up dates it
            dbc.InsertLess(new LessonCL(0, cmblect.Text, cmbGroup.Text, cmbRoom.Text, cmbMod.Text, cmbStartTime.Text, cmbEndTime.Text, cmbDay.Text));
            dgvLesson.DataSource = dbc.LessonVeiw();
            MessageBox.Show("Lesson added information added");
        }
예제 #12
0
 private void Form1_Load(object sender, EventArgs e)
 {
     DBconnector dbc = new DBconnector();
       //  dgvT.DataSource = dbc.LessonVeiw();
      dgvTimeTable.DataSource = dbc.LessonVeiw();
 }