private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            try
            {
                var     department = cbDepartment.SelectedItem as Department;
                Teacher teacher    = new Teacher();

                teacher.Name          = txtName.Text;
                teacher.Qualification = txtQualification.Text;
                teacher.Address       = txtAddress.Text;
                teacher.JoiningDate   = dtpJoiningDate.Value;
                teacher.DepartmentID  = department.DepartmentId;
                teacher.Salary        = int.Parse(txtSalary.Text);

                bool added = teacherCRUD.AddTeacher(teacher);
                if (added)
                {
                    MessageBox.Show("Successfully added '" + teacher.Name + "' as new Teacher.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ClearTextBoxes();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        public void StudentAdd_Test()
        {
            TeacherDTO teach = new TeacherDTO();

            teach.TeacherId     = "tbshfg676qe";
            teach.TeacherName   = "Mr Robot";
            teach.TeacherBranch = "IT";
            bool flag = TeacherCRUD.AddTeacher(teach);

            Assert.AreEqual(true, flag);
        }