コード例 #1
0
        protected void btnDeleteStudent_Click(object sender, EventArgs e)
        {
            DeleteStudent      ds  = new DeleteStudent();
            DeleteEmployer     de  = new DeleteEmployer();
            DeleteStudentSkill dss = new DeleteStudentSkill();
            DeleteStudentQual  dsq = new DeleteStudentQual();

            if (Label1.Text == "Students")
            {
                btnDeleteStudent.Text = "Delete Student";
                int studentNo = int.Parse(txtStudentNoDelete.Text);
                ds.studentNumber  = int.Parse(txtStudentNoDelete.Text);
                dss.studentNumber = int.Parse(txtStudentNoDelete.Text);
                dsq.studentNumber = int.Parse(txtStudentNoDelete.Text);
                handler.BLL_DeleteStudentSkill(dss);
                handler.BLL_DeleteStudentQual(dsq);
                handler.BLL_DeleteStudent(ds);
                dgvStudents.DataSource = handler.BLL_GetAllStudents();
                dgvStudents.DataBind();
                txtStudentNoDelete.Text = "";
            }
            else if (Label1.Text == "Employers")
            {
                btnDeleteStudent.Text = "Delete Employer";
                //int employerID = int.Parse(txtStudentNoDelete.Text);
                de.employerName = txtStudentNoDelete.Text;
                handler.BLL_DeleteEmployer(de);
                dgvStudents.DataSource = handler.BLL_GetAllEmployers();
                dgvStudents.DataBind();
                txtStudentNoDelete.Text = "";
            }
        }