예제 #1
0
        public ActionResult Approve(int idRequisition)
        {
            _requisitionDAO.UpdateApproveStatus(idRequisition);

            //@Shutong: send notification here
            Requisition req        = _requisitionDAO.FindRequisitionByRequisionId(idRequisition);
            int         IdEmployee = req.IdEmployee;
            var         hub        = GlobalHost.ConnectionManager.GetHubContext <ChatHub>();

            hub.Clients.All.receiveNotification(IdEmployee);
            EmailClass emailClass = new EmailClass();
            string     message    = "Hi," + _employeeDAO.FindEmployeeById(IdEmployee).Name
                                    + " your requisition: " + req.IdRequisition + " raised on " + req.RaiseDate + " has been approved.";

            _notificationChannelDAO.CreateNotificationsToIndividual(IdEmployee, (int)Session["IdEmployee"], message);
            emailClass.SendTo(_employeeDAO.FindEmployeeById(IdEmployee).Email, "SSIS System Email", message);
            //end of notification sending

            return(RedirectToAction("PendingLists", "DepartmentHead"));
        }