private void button1_Click(object sender, EventArgs e)
        {
            if (chooseTS.SelectedIndex == -1)
            {
                MessageBox.Show("Must choose lecturer");
                return;
            }
            DataTable dt = Program.get_dt("select tsid from lessons where tsid='" + TS.Rows[chooseTS.SelectedIndex][1].ToString() + "'");

            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("Teaching Staff cannot be dissmised\n Teaching Staff assigned to lessons");
                return;
            }

            if (Hod.DismissTeachingStaff(TS.Rows[chooseTS.SelectedIndex][1].ToString()))
            {
                MessageBox.Show("deleted succesfully");
                chooseTS.SelectedIndex = -1;
                chooseTS.Items.Clear();
                TS = Program.get_dt("select f_name,id from login where permission='TS' and department='" + Hod.Department + "' order by f_name");
                for (int i = 0; i < TS.Rows.Count; i++)
                {
                    chooseTS.Items.Add(TS.Rows[i][0]);
                }
            }

            else
            {
                MessageBox.Show("not found");
            }
        }
Пример #2
0
        public void DismissTeachingStaffTest()
        {
            CHeadOfDepartment hod = new CHeadOfDepartment("test", "test", "test", "test", "test");
            CTeachingStaff    ts  = new CTeachingStaff("test", "test", "test", "test", "test", "Lecturer", null);

            Program.update_sql("insert into login values('" + ts.Id + "','" + ts.Name + "','" + ts.Password + "','" + ts.Permission + "','" + ts.Department + "')");
            Program.update_sql("insert into teaching_staff values('" + ts.Id + "','" + ts.Type + "','" + ts.Constraints + "')");
            hod.DismissTeachingStaff(ts.Id);
            DataTable dt  = Program.get_dt("SELECT * from teaching_staff WHERE Id='test'");
            DataTable dt2 = Program.get_dt("SELECT * from login WHERE Id='test'");

            Assert.IsTrue(dt.Rows.Count == 0 && dt2.Rows.Count == 0);
        }