InternalAccount user = intBo.findUserByusername(name);
System.out.println("User name is: "+user.getFirstname());
System.out.println("User Role is: "+user.getPosition());
System.out.println("Emp Id is: "+criticaltran.getEmployeeId());
InternalCriticalTransaction internalCriticalTransaction = new InternalCriticalTransaction();
if(user.getPosition().equals(ceo)){
System.out.println("User Role is matched: "+user.getPosition());
internalCriticalTransaction = intCriticalTrans.updatebyempidfromceo(criticaltran.getEmployeeId(), "yes");
}
if(user.getPosition().equals(pres)){
System.out.println("User Role is matched: "+user.getPosition());
internalCriticalTransaction = intCriticalTrans.updatebyempidfrompresident(criticaltran.getEmployeeId(), "yes");
}
if(user.getPosition().equals(vpres)){
System.out.println("User Role is matched: "+user.getPosition());
internalCriticalTransaction = intCriticalTrans.updatebyempidfromvpresident(criticaltran.getEmployeeId(), "yes");
}
String yes = "yes";
if(internalCriticalTransaction.getPresapp().equals(internalCriticalTransaction.getCeoapp()) && internalCriticalTransaction.getCeoapp().equals(internalCriticalTransaction.getVpresapp()) && internalCriticalTransaction.getVpresapp().equals(yes)){
ModelAndView modelAndView = new ModelAndView("internalmgmtsuccessmsg");
intBo.delete(criticaltran.getEmployeeId());
System.out.println(criticaltran.getEmployeeId()+", deleted!");
String msg = "All approval completed! Internal User with Employee ID " +criticaltran.getEmployeeId()+ "deleted Successfully!";
modelAndView.addObject("message", msg);