protected void btnUpdate_Click(object sender, EventArgs e) { Staff manager = (Staff)Session["LoginStaff"]; string deptID = manager.Dept_ID; string confirmValue = Request.Form["confirm_value"]; if (confirmValue == "Yes") { Staff Rep = UCDC.GetRepByDeptID(deptID); if (UCDC.GetStaffNameByStaffID(TBStaffID.Text, deptID) != null) { bool flag = UCDC.ChangeRepToStaff(Rep.Dept_ID); if (flag == true) { flag = UCDC.ChangeStaffToRep(TBStaffID.Text); if (flag == true) { UCDC.UpdateCollectionPoint(deptID, DDLCP.SelectedValue); Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('Update success!')</script>"); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('Department no rep! Please check the database.')</script>"); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('No such staff! Please check the staff ID!')</script>"); } } }