public ActionResult Delegation(Delegation delegation)
        {
            deptId = GetDeptId();
            status = "Ongoing";
            string currentStatus = departmentDAO.GetDepartmentByDeptId(deptId).DelegateStatus;

            if (currentStatus == status)
            {
                SetFlash(Enums.FlashMessageType.Error, "You've already granted authourity to someone!");

                return(RedirectToAction("Delegation", "DepartmentHead"));
            }
            else
            {
                delegation.EmployeeId = employeeDAO.GetEmployeeByName(deptId, delegation.EmployeeName).Id;

                if (!departmentDAO.InsertDelegation(delegation, deptId))
                {
                    SetFlash(Enums.FlashMessageType.Error, "Something went wrong!");

                    return(RedirectToAction("Delegation", "DepartmentHead"));
                }
                ///// start Email /////
                EmailDAO emailDAO = new EmailDAO();
                Employee employee = emailDAO.EmailDelegation(delegation.EmployeeId);
                Email    email    = new Email();
                email.SendEmail(employee.Email, "Delegation", "Please Check delegation status");
                ///////////////////////
                ///
                SetFlash(Enums.FlashMessageType.Success, "Authourity successfully granted!");
                //delegationDAO.CreateDelegation(delegation);
                //departmentDAO.UpdateDepartmentDelegation(deptId, delegation.EmployeeId, status);

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