private Task <List <Vacations> > GetVacationsInternal( ArcadiaCspContext context, string employeeId = null, string calendarEventId = null, bool trackChanges = true) { int?employeeDbId = null; if (int.TryParse(employeeId, out var tempEmployeeId)) { employeeDbId = tempEmployeeId; } var vacationDbId = calendarEventId == null ? (int?)null : this.calendarEventIdParser.GetCspIdFromCalendarEvent(calendarEventId, CalendarEventTypes.Vacation); var vacations = context.Vacations .Include(v => v.VacationApprovals) .Include(v => v.VacationCancellations) .Include(v => v.VacationProcesses) .Include(v => v.VacationReadies) .Where(v => (employeeId == null || v.EmployeeId == employeeDbId) && (calendarEventId == null || v.Id == vacationDbId)); if (!trackChanges) { vacations = vacations.AsNoTracking(); } return(vacations.ToListAsync()); }
private Task <List <SickLeaves> > GetSickLeavesInternal( ArcadiaCspContext context, string employeeId = null, string calendarEventId = null, bool trackChanges = true) { int?employeeDbId = null; if (int.TryParse(employeeId, out var tempEmployeeId)) { employeeDbId = tempEmployeeId; } var sickLeaveDbId = calendarEventId == null ? (int?)null : this.calendarEventIdParser.GetCspIdFromCalendarEvent(calendarEventId, CalendarEventTypes.Sickleave); var sickLeaves = context.SickLeaves .Include(v => v.SickLeaveCancellations) .Include(v => v.SickLeaveCompletes) .Where(v => (employeeId == null || v.EmployeeId == employeeDbId) && (calendarEventId == null || v.Id == sickLeaveDbId)); if (!trackChanges) { sickLeaves = sickLeaves.AsNoTracking(); } return(sickLeaves.ToListAsync()); }
public CspEmployeeQuery(ArcadiaCspContext ctx) { this.ctx = ctx; }
public CspEmployeeQuery(ArcadiaCspContext ctx, CspConfiguration cspConfiguration) { this.ctx = ctx; this.cspConfiguration = cspConfiguration; }