public static void sendApprovalNotification(TNF tnf, WorkflowApprover wfa) { User currentUser = tnf.getUser(); UserDAO userDAO = new UserDAO(); NotificationDAO notiDAO = new NotificationDAO(); User approver = new User(); List <User> hrApprovers = new List <User>(); if (tnf.getStatus().Equals("pending")) { int current_wf_status = tnf.getWFStatus(); int wfaLevel = wfa.getLevel(); //if (wfa.getLevel() == current_wf_status) //{ //get out who to send next string approverJobCat = wfa.getJobCategory(); if (approverJobCat.ToLower().Equals("ceo")) { approver = userDAO.getCEO(); } else if (approverJobCat.ToLower().Equals("hod")) { approver = userDAO.getHODbyDepartment(currentUser.getDepartment()); } else if (approverJobCat.ToLower().Equals("supervisor")) { approver = userDAO.getSupervisorbyDepartment(currentUser.getDepartment()); } else if (approverJobCat.ToLower().Equals("hr hod")) { approver = userDAO.getHRHOD(); } else if (approverJobCat.ToLower().Equals("hr")) { hrApprovers = userDAO.getAllHR(); } else if (approverJobCat.ToLower().Equals("superior")) { string supervisorID = userDAO.getSupervisorIDOfUser(currentUser.getUserID()); approver = userDAO.getUserByID(supervisorID); } //insert notification if (!hrApprovers.Any()) { Notification newNotification = new Notification(currentUser.getUserID(), approver.getUserID(), tnf.getTNFID(), "pending"); notiDAO.createNotification(newNotification); } else { foreach (User hrUser in hrApprovers) { Notification newNotification = new Notification(currentUser.getUserID(), hrUser.getUserID(), tnf.getTNFID(), "pending"); notiDAO.createNotification(newNotification); } } //} } }