protected void gv_testadmin_RowDeleting(object sender, GridViewDeleteEventArgs e) { DialogResult result = MessageBox.Show("Are you sure to delete the Test Administrator?", "Confirm:", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { System.Web.UI.WebControls.Label EmployeeID = gv_testadmin.Rows[e.RowIndex].FindControl("EmployeeID") as System.Web.UI.WebControls.Label; string empid = EmployeeID.Text; ITestAdministratorManager objTestAdminManager = (ITestAdministratorManager)TestAdministratorManagerFactory.Create_TestAdministratorManager(); int deleted = objTestAdminManager.DeleteTestAdministrator(Convert.ToInt32(EmployeeID.Text)); if (deleted == 1) { MessageBox.Show("Test Administrator with ID: " + empid + ", deleted successfully.", "Successful:", MessageBoxButtons.OK); } else { MessageBox.Show("Test Administrator with ID: " + empid + " is assigned a test, cannot be deleted.", "Failed:", MessageBoxButtons.OK); } gv_testadmin.EditIndex = -1; showgrid(); } else { } }
protected void gv_testadmin_RowDeleting(object sender, GridViewDeleteEventArgs e) { DialogResult result = MessageBox.Show("Are you sure to reject the employee as Test Administrator?", "Confirm:", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { System.Web.UI.WebControls.Label EmployeeID = gv_testadmin.Rows[e.RowIndex].FindControl("EmployeeID") as System.Web.UI.WebControls.Label; string empid = EmployeeID.Text; ITestAdministratorManager objTestAdminManager = (ITestAdministratorManager)TestAdministratorManagerFactory.Create_TestAdministratorManager(); if (objTestAdminManager.DeleteTestAdministrator(Convert.ToInt32(EmployeeID.Text)) == 1) { MessageBox.Show(" Employee with ID: " + empid + " has been rejected as Test Administartor.", "Success:", MessageBoxButtons.OK); } gv_testadmin.EditIndex = -1; showgrid(); } else { } }