public ActionResult Disagree(ulong id)
        {
            DBQuery dbq = new DBQuery();
            Boolean result = false;
            result = dbq.UpdateVacationRequestStatus(id, VacationRequestProcessingState.rejectedByDeputy, DateTime.Now);
            if (result)
            {
                VacationRequest vr = dbq.SelectVacationRequest(id);
                CommunicationManagement.EmailService message = new CommunicationManagement.EmailService();
                message.sendMessage(vr, CommunicationManagement.EmailService.CONFIRMATION_EMAIL_REJECTED);

                TempData["success"] = "Die Vertretungsanfrage wurde abgelehnt.";
            }
            else
            {
                ErrorState.ErrorStateInstance.setError(ErrorState.DATABASE_ERROR);
                //TempData["error"] = "Die Änderung konnte nicht in die Datenbank übernommen werden!";
            }

            int lastError = ErrorState.ErrorStateInstance.getLastError();
            if (lastError != ErrorState.OK)
            {
                TempData["error"] = ErrorState.ErrorStateInstance.getErrorMessage(lastError);
            }

            return RedirectToAction("Index", "VacationRequests");
        }
        /// <summary>
        /// 1. starts the VacationRequestIDGenerator
        /// 2. starts the validation process
        /// </summary>
        /// <returns>"true" if the vacation request is successfully created, else "false" </returns>
        public virtual Boolean InsertIntoDB()
        {
            //return value
            Boolean result = false;

            //this._vacationRequestID = VacationRequestIDGenerator.GenerateID(_employeeID);
            this._vacationRequestID = VacationRequestIDGenerator.GetIDGeneratorInstance.GenerateID(_employeeID);

            //starts the validation process
            result = Validate();

            //result == true, if the employee has enough remaining vacation days
            if (result)
            {
                result = SendDataToDB();
            }

            if (result)
            {
                //send email
                String text = EmailService.CONFIRMATION_EMAIL_SUBMISSION;  // <- hier kommt der Inhalt der Mail
                EmailService message = new EmailService();
                message.sendMessage(this, text);
            }

            return result;
        }
        public ActionResult Reject(ulong id)
        {
            String currentUserId = User.Identity.GetUserId();
            DBQuery dbq = new DBQuery();
            Boolean result = false;

            result  = dbq.UpdateVacationRequestStatus(id, VacationRequestProcessingState.rejectedByDivisionManager, DateTime.Now);
            if (result)
            {
                // Restore VacationEntitlement to Employee
                VacationRequest vr = dbq.SelectVacationRequest(id);
                CommunicationManagement.EmailService message = new CommunicationManagement.EmailService();
                message.sendMessage(vr, CommunicationManagement.EmailService.CONFIRMATION_EMAIL_REJECTED);
                TempData["success"] = "Der Urlaubsantrag wurde abgelehnt.";
            }
            else
            {
                ErrorState.ErrorStateInstance.setError(ErrorState.DATABASE_ERROR);
                // TempData["error"] = "Die Änderung konnte nicht in die Datenbank übernommen werden!";
            }

            int lastError = ErrorState.ErrorStateInstance.getLastError();
            if (lastError != ErrorState.OK)
            {
                TempData["error"] = ErrorState.ErrorStateInstance.getErrorMessage(lastError);
            }

            return View("Index", GetAllPendingVacationRequestsOfDivision());
        }
        public ActionResult Permit(ulong id)
        {
            DBQuery dbq = new DBQuery();
            VacationRequest vr1 = dbq.SelectVacationRequest(id);
            Boolean result = false;

            // if vacationRequestStartDate is in the past then the status will be set to "taken"
            if (vr1.getVacationStartDate() < DateTime.Now)
            {
                result = dbq.UpdateVacationRequestStatus(id, VacationRequestProcessingState.taken, DateTime.Now);
            }
            else
            {
                result = dbq.UpdateVacationRequestStatus(id, VacationRequestProcessingState.permitted, DateTime.Now);
            }
            if (result)
            {
                VacationRequest vr = dbq.SelectVacationRequest(id);
                CommunicationManagement.EmailService message = new CommunicationManagement.EmailService();
                message.sendMessage(vr, CommunicationManagement.EmailService.CONFIRMATION_EMAIL_PERMITTED);

                TempData["success"] = "Der Urlaubsantrag wurde befürwortet.";
            }
            else
            {
                ErrorState.ErrorStateInstance.setError(ErrorState.DATABASE_ERROR);
                //TempData["error"] = "Die Änderung konnte nicht in die Datenbank übernommen werden!";
            }

            int lastError = ErrorState.ErrorStateInstance.getLastError();
            if (lastError != ErrorState.OK)
            {
                TempData["error"] = ErrorState.ErrorStateInstance.getErrorMessage(lastError);
            }

            return View("Index", GetAllPendingVacationRequestsOfDivision());
        }