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");
        }
        // POST: VacationRequests/Delete/5
        public ActionResult Cancel(ulong id)
        {
            DBQuery dbq = new DBQuery();

            Boolean result = dbq.UpdateVacationRequestStatus(id, VacationRequestProcessingState.canceled, DateTime.Now);
            if (result)
            {
                VacationRequest vr = dbq.SelectVacationRequest(id);
                //Restore Net Vacation Days of VacationRequest to Employee's VacationEntitlement
                result = RestoreVacationDaysInEmployeeVacationEntitlement(vr);
                if (result)
                {
                    TempData["success"] = "Der Urlaubsantrag wurde erfolgreich storniert.";
                }
                else
                {
                    ErrorState.ErrorStateInstance.setError(ErrorState.DATABASE_ERROR);
                    //TempData["error"] = "Die Gutschrift der Urlaubstage konnte nicht durchgeführt werden!";
                }
                // set NetVacationDays of cancelled VacationRequest to zero
                result = ClearNetVacationDaysOfCanceledVacationRequest(vr.getVacationRequestID());
                if (!result)
                {
                    ErrorState.ErrorStateInstance.setError(ErrorState.DATABASE_ERROR);
                }
                // remove any VacationPeriodOverlapNotes in VacationRequests of ShiftPartner, if applicable
                if (vr.getVacationPeriodOverlapNote())
                {
                    result = RemoveVacationPeriodOverlapNote(vr);
                    if (!result)
                    {
                        ErrorState.ErrorStateInstance.setError(ErrorState.DATABASE_ERROR);
                    }
                }
            }
            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"] = "Der Urlaubsantrag konnte nicht storniert werden. Grund: " + ErrorState.ErrorStateInstance.getErrorMessage(lastError);
            }

            return RedirectToAction("Index");
        }
        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());
        }