private static bool CheckSickLeave(CalendarEvent existingEvent, CalendarEventsModel updatedEvent, EmployeePermissionsEntry employeePermissions) { var statusChanged = StatusChanged(existingEvent, updatedEvent); if (!statusChanged && updatedEvent.Status == SickLeaveStatuses.Approved && updatedEvent.Dates != existingEvent.Dates) { return(employeePermissions.HasFlag(EmployeePermissionsEntry.ProlongSickLeave)); } if (statusChanged && updatedEvent.Status == SickLeaveStatuses.Completed) { return(employeePermissions.HasFlag(EmployeePermissionsEntry.CompleteSickLeave)); } return(true); }
private static bool CheckIfRejected(CalendarEvent existingEvent, CalendarEventsModel updatedEvent, EmployeePermissionsEntry employeePermissions) { var calendarEventStatuses = new CalendarEventStatuses(); var rejected = calendarEventStatuses.RejectedForType(existingEvent.Type); var statusChanged = StatusChanged(existingEvent, updatedEvent); if (statusChanged && updatedEvent.Status == rejected) { return(employeePermissions.HasFlag(EmployeePermissionsEntry.RejectCalendarEvents)); } return(true); }
private static bool CheckIfCancelled(CalendarEvent existingEvent, CalendarEventsModel updatedEvent, EmployeePermissionsEntry employeePermissions) { var calendarEventStatuses = new CalendarEventStatuses(); var approvedStatus = calendarEventStatuses.ApprovedForType(existingEvent.Type); var cancelledStatus = calendarEventStatuses.CancelledForType(updatedEvent.Type); var statusChanged = StatusChanged(existingEvent, updatedEvent); if (statusChanged && existingEvent.Status == approvedStatus && updatedEvent.Status == cancelledStatus) { return(employeePermissions.HasFlag(EmployeePermissionsEntry.CancelApprovedCalendarEvents)); } return(true); }