/// <summary> /// Initializes a new instance of the <see cref="UserMappingController"/> class. /// </summary> /// <param name="appSettings">Application settings DI.</param> /// <param name="graphUtility">Graph utility methods DI.</param> /// <param name="logonActivity">Kronos Logon Activity DI.</param> /// <param name="hyperFindActivity">Kronos Hyper Find Activity DI.</param> /// <param name="telemetryClient">ApplicationInsights DI.</param> /// <param name="userMappingProvider">User Mapping provider DI.</param> /// <param name="teamDepartmentMappingProvider">Team Department Mapping provider DI.</param> /// <param name="configurationProvider">Configuration provider DI.</param> /// <param name="jobAssignmentActivity">Kronos job assignment activity DI.</param> /// <param name="environment">Hosting environment DI.</param> /// <param name="utility">Common utility class DI.</param> public UserMappingController( AppSettings appSettings, IGraphUtility graphUtility, ILogonActivity logonActivity, IHyperFindActivity hyperFindActivity, TelemetryClient telemetryClient, IUserMappingProvider userMappingProvider, ITeamDepartmentMappingProvider teamDepartmentMappingProvider, IConfigurationProvider configurationProvider, IJobAssignmentActivity jobAssignmentActivity, IHostingEnvironment environment, Utility utility) { this.appSettings = appSettings; this.graphUtility = graphUtility; this.logonActivity = logonActivity; this.hyperFindActivity = hyperFindActivity; this.telemetryClient = telemetryClient; this.userMappingProvider = userMappingProvider; this.teamDepartmentMappingProvider = teamDepartmentMappingProvider; this.configurationProvider = configurationProvider; this.jobAssignmentActivity = jobAssignmentActivity; this.hostingEnvironment = environment; this.utility = utility; }
/// <summary> /// Initializes a new instance of the <see cref="TeamDepartmentMappingController"/> class. /// </summary> /// <param name="teamDepartmentMappingProvider">configurationProvider DI.</param> /// <param name="telemetryClient">The logging mechanism through Application Insights.</param> /// <param name="logonActivity">Logon activity.</param> /// <param name="hyperFindLoadAllActivity">IHyperFindLoadAllActivity object.</param> /// <param name="shiftsTeamKronosDepartmentViewModel">ShiftsTeamKronosDepartmentViewModel object.</param> /// <param name="graphUtility">Having the ability to DI the mechanism to get the token from MS Graph.</param> /// <param name="appSettings">Configuration DI.</param> /// <param name="configurationProvider">ConfigurationProvider DI.</param> /// <param name="cache">Distributed cache.</param> /// <param name="userMappingProvider">User To User Mapping Provider.</param> /// <param name="httpClientFactory">httpClientFactory.</param> public TeamDepartmentMappingController( ITeamDepartmentMappingProvider teamDepartmentMappingProvider, TelemetryClient telemetryClient, ILogonActivity logonActivity, IHyperFindLoadAllActivity hyperFindLoadAllActivity, ShiftsTeamKronosDepartmentViewModel shiftsTeamKronosDepartmentViewModel, IGraphUtility graphUtility, AppSettings appSettings, IConfigurationProvider configurationProvider, IDistributedCache cache, IUserMappingProvider userMappingProvider, IHttpClientFactory httpClientFactory) { this.teamDepartmentMappingProvider = teamDepartmentMappingProvider; this.telemetryClient = telemetryClient; this.logonActivity = logonActivity; this.hyperFindLoadAllActivity = hyperFindLoadAllActivity; this.shiftsTeamKronosDepartmentViewModel = shiftsTeamKronosDepartmentViewModel; this.graphUtility = graphUtility; this.appSettings = appSettings; this.configurationProvider = configurationProvider; this.cache = cache; this.userMappingProvider = userMappingProvider; this.httpClientFactory = httpClientFactory; }
/// <summary> /// Initializes a new instance of the <see cref="TimeOffController"/> class. /// </summary> /// <param name="appSettings">Application Settings DI.</param> /// <param name="telemetryClient">ApplicationInsights DI.</param> /// <param name="userMappingProvider">The User Mapping Provider DI.</param> /// <param name="timeOffActivity">Time Off Activity DI.</param> /// <param name="timeOffReasonProvider">Time Off Reason Provider DI.</param> /// <param name="azureTableStorageHelper">Azure Storage Helper DI.</param> /// <param name="timeOffMappingEntityProvider">Time Off Mapping Provider DI.</param> /// <param name="utility">Utility DI.</param> /// <param name="teamDepartmentMappingProvider">Team Department Mapping Provider DI.</param> /// <param name="httpClientFactory">HttpClientFactory DI.</param> /// <param name="taskWrapper">Wrapper class instance for BackgroundTask.</param> public TimeOffController( AppSettings appSettings, TelemetryClient telemetryClient, IUserMappingProvider userMappingProvider, ITimeOffActivity timeOffActivity, ITimeOffReasonProvider timeOffReasonProvider, IAzureTableStorageHelper azureTableStorageHelper, ITimeOffMappingEntityProvider timeOffMappingEntityProvider, Utility utility, ITeamDepartmentMappingProvider teamDepartmentMappingProvider, IHttpClientFactory httpClientFactory, BackgroundTaskWrapper taskWrapper) { this.appSettings = appSettings; this.telemetryClient = telemetryClient; this.userMappingProvider = userMappingProvider; this.timeOffActivity = timeOffActivity; this.timeOffReasonProvider = timeOffReasonProvider; this.azureTableStorageHelper = azureTableStorageHelper; this.timeOffMappingEntityProvider = timeOffMappingEntityProvider ?? throw new ArgumentNullException(nameof(timeOffMappingEntityProvider)); this.utility = utility; this.teamDepartmentMappingProvider = teamDepartmentMappingProvider; this.httpClientFactory = httpClientFactory; this.taskWrapper = taskWrapper; }
/// <summary> /// Initializes a new instance of the <see cref="OpenShiftRequestController"/> class. /// </summary> /// <param name="appSettings">The key/value application settings DI.</param> /// <param name="telemetryClient">ApplicationInsights DI.</param> /// <param name="openShiftActivity">The open shift activity DI.</param> /// <param name="userMappingProvider">The user mapping provider DI.</param> /// <param name="teamDepartmentMappingProvider">The Team Department Mapping DI.</param> /// <param name="openShiftRequestMappingEntityProvider">The Open Shift Request Mapping DI.</param> /// <param name="httpClientFactory">http client.</param> /// <param name="openShiftMappingEntityProvider">The Open Shift Mapping DI.</param> /// <param name="utility">The common utility methods DI.</param> /// <param name="shiftMappingEntityProvider">Shift entity mapping provider DI.</param> /// <param name="taskWrapper">Wrapper class instance for BackgroundTask.</param> public OpenShiftRequestController( AppSettings appSettings, TelemetryClient telemetryClient, IOpenShiftActivity openShiftActivity, IUserMappingProvider userMappingProvider, ITeamDepartmentMappingProvider teamDepartmentMappingProvider, IOpenShiftRequestMappingEntityProvider openShiftRequestMappingEntityProvider, IHttpClientFactory httpClientFactory, IOpenShiftMappingEntityProvider openShiftMappingEntityProvider, Utility utility, IShiftMappingEntityProvider shiftMappingEntityProvider, BackgroundTaskWrapper taskWrapper) { if (appSettings is null) { throw new ArgumentNullException(nameof(appSettings)); } this.appSettings = appSettings; this.telemetryClient = telemetryClient; this.openShiftActivity = openShiftActivity; this.userMappingProvider = userMappingProvider; this.teamDepartmentMappingProvider = teamDepartmentMappingProvider; this.openShiftRequestMappingEntityProvider = openShiftRequestMappingEntityProvider; this.openShiftMappingEntityProvider = openShiftMappingEntityProvider; this.httpClientFactory = httpClientFactory; this.openShiftQueryDateSpan = $"{this.appSettings.ShiftStartDate}-{this.appSettings.ShiftEndDate}"; this.utility = utility; this.shiftMappingEntityProvider = shiftMappingEntityProvider; this.taskWrapper = taskWrapper; }
/// <summary> /// Initializes a new instance of the <see cref="OpenShiftController"/> class. /// </summary> /// <param name="appSettings">Configuration DI.</param> /// <param name="telemetryClient">Telemetry Client.</param> /// <param name="openShiftActivity">OpenShift activity.</param> /// <param name="utility">Unique ID utility DI.</param> /// <param name="openShiftMappingEntityProvider">Open Shift Entity Mapping DI.</param> /// <param name="teamDepartmentMappingProvider">Team Department Mapping Provider DI.</param> /// <param name="httpClientFactory">http client.</param> /// <param name="openShiftRequestMappingEntityProvider">Open Shift Request Entity Mapping DI.</param> /// <param name="taskWrapper">Wrapper class instance for BackgroundTask.</param> public OpenShiftController( AppSettings appSettings, TelemetryClient telemetryClient, IOpenShiftActivity openShiftActivity, Utility utility, IGraphUtility graphUtility, IOpenShiftMappingEntityProvider openShiftMappingEntityProvider, ITeamDepartmentMappingProvider teamDepartmentMappingProvider, IHttpClientFactory httpClientFactory, IOpenShiftRequestMappingEntityProvider openShiftRequestMappingEntityProvider, BackgroundTaskWrapper taskWrapper) { if (appSettings is null) { throw new ArgumentNullException(nameof(appSettings)); } this.appSettings = appSettings; this.telemetryClient = telemetryClient; this.openShiftActivity = openShiftActivity; this.utility = utility; this.graphUtility = graphUtility; this.openShiftMappingEntityProvider = openShiftMappingEntityProvider; this.teamDepartmentMappingProvider = teamDepartmentMappingProvider; this.httpClientFactory = httpClientFactory; this.openShiftRequestMappingEntityProvider = openShiftRequestMappingEntityProvider; this.taskWrapper = taskWrapper; }
/// <summary> /// Initializes a new instance of the <see cref="TimeOffRequestsController"/> class. /// </summary> /// <param name="appSettings">Configuration DI.</param> /// <param name="telemetryClient">Telemetry Client.</param> /// <param name="userMappingProvider">User To User Mapping Provider.</param> /// <param name="createTimeOffActivity">Create time off activity.</param> /// <param name="timeOffReasonProvider">Paycodes to Time Off Reasons Mapping provider.</param> /// <param name="utility">The local Utility DI.</param> /// <param name="azureTableStorageHelper">The Azure table storage helper.</param> /// <param name="timeOffReqMappingEntityProvider">time off entity provider.</param> /// <param name="teamDepartmentMappingProvider">TeamDepartmentMapping provider DI.</param> /// <param name="httpClientFactory">http client.</param> /// <param name="taskWrapper">Wrapper class instance for BackgroundTask.</param> public TimeOffRequestsController( AppSettings appSettings, TelemetryClient telemetryClient, ICreateTimeOffActivity createTimeOffActivity, IUserMappingProvider userMappingProvider, ITimeOffReasonProvider timeOffReasonProvider, IAzureTableStorageHelper azureTableStorageHelper, ITimeOffRequestProvider timeOffReqMappingEntityProvider, ITeamDepartmentMappingProvider teamDepartmentMappingProvider, Utility utility, IHttpClientFactory httpClientFactory, BackgroundTaskWrapper taskWrapper) { this.appSettings = appSettings; this.telemetryClient = telemetryClient; this.createTimeOffActivity = createTimeOffActivity; this.userMappingProvider = userMappingProvider; this.timeOffReasonProvider = timeOffReasonProvider; this.azureTableStorageHelper = azureTableStorageHelper; this.timeOffReqMappingEntityProvider = timeOffReqMappingEntityProvider; this.teamDepartmentMappingProvider = teamDepartmentMappingProvider; this.utility = utility; this.httpClientFactory = httpClientFactory; this.taskWrapper = taskWrapper; }
/// <summary> /// Initializes a new instance of the <see cref="HomeController"/> class. /// </summary> /// <param name="configurationProvider">configurationProvider DI.</param> /// <param name="telemetryClient">The logging mechanism through Application Insights.</param> /// <param name="graphUtility">Having the ability to DI the mechanism to get the token from MS Graph.</param> /// <param name="logonActivity">Logon activity.</param> /// <param name="appSettings">app settings.</param> /// <param name="teamDepartmentMappingProvider">configurationb Provider DI.</param> public HomeController( BusinessLogic.Providers.IConfigurationProvider configurationProvider, TelemetryClient telemetryClient, IGraphUtility graphUtility, ILogonActivity logonActivity, AppSettings appSettings, ITeamDepartmentMappingProvider teamDepartmentMappingProvider) { this.configurationProvider = configurationProvider; this.telemetryClient = telemetryClient; this.graphUtility = graphUtility; this.logonActivity = logonActivity; this.appSettings = appSettings; this.teamDepartmentMappingProvider = teamDepartmentMappingProvider; }
/// <summary> /// Initializes a new instance of the <see cref="TimeOffReasonController"/> class. /// </summary> /// <param name="telemetryClient">ApplicationInsights DI.</param> /// <param name="azureTableStorageHelper">The Azure Table Storage Helper DI.</param> /// <param name="timeOffReasonProvider">The time off reason provider DI.</param> /// <param name="payCodeActivity">The paycode activity DI.</param> /// <param name="appSettings">Application Settings DI.</param> /// <param name="httpClientFactory">Http Client Factory DI.</param> /// <param name="teamDepartmentMappingProvider">Team department mapping provider DI.</param> /// <param name="utility">Utility common methods DI.</param> public TimeOffReasonController( TelemetryClient telemetryClient, IAzureTableStorageHelper azureTableStorageHelper, ITimeOffReasonProvider timeOffReasonProvider, IPayCodeActivity payCodeActivity, AppSettings appSettings, IHttpClientFactory httpClientFactory, ITeamDepartmentMappingProvider teamDepartmentMappingProvider, Utility utility) { this.telemetryClient = telemetryClient; this.azureTableStorageHelper = azureTableStorageHelper; this.appSettings = appSettings; this.payCodeActivity = payCodeActivity; this.timeOffReasonProvider = timeOffReasonProvider; this.tenantId = this.appSettings?.TenantId; this.httpClientFactory = httpClientFactory; this.teamDepartmentMappingProvider = teamDepartmentMappingProvider; this.utility = utility; }
/// <summary> /// Initializes a new instance of the <see cref="ShiftController"/> class. /// </summary> /// <param name="userMappingProvider">user Mapping Provider.</param> /// <param name="upcomingShiftsActivity">upcoming Shifts Activity.</param> /// <param name="telemetryClient">ApplicationInsights DI.</param> /// <param name="utility">UniqueId Utility DI.</param> /// <param name="shiftEntityMappingProvider">ShiftEntityMapper DI.</param> /// <param name="appSettings">app settings.</param> /// <param name="teamDepartmentMappingProvider">Team department mapping provider.</param> /// <param name="httpClientFactory">The HTTP Client DI.</param> /// <param name="taskWrapper">Wrapper class instance for BackgroundTask.</param> public ShiftController( IUserMappingProvider userMappingProvider, IUpcomingShiftsActivity upcomingShiftsActivity, TelemetryClient telemetryClient, Utility utility, IShiftMappingEntityProvider shiftEntityMappingProvider, ITeamDepartmentMappingProvider teamDepartmentMappingProvider, AppSettings appSettings, IHttpClientFactory httpClientFactory, BackgroundTaskWrapper taskWrapper) { this.userMappingProvider = userMappingProvider; this.upcomingShiftsActivity = upcomingShiftsActivity; this.telemetryClient = telemetryClient; this.utility = utility; this.shiftMappingEntityProvider = shiftEntityMappingProvider; this.appSettings = appSettings; this.teamDepartmentMappingProvider = teamDepartmentMappingProvider; this.httpClientFactory = httpClientFactory; this.taskWrapper = taskWrapper; }
/// <summary> /// Get a single mapped user, combining user and teams department mapping data. /// </summary> /// <param name="workForceIntegrationId">The workforce integration to get the users for.</param> /// <param name="userId">The Teams id of the user to retrieve.</param> /// <param name="teamsId">The aadGroup Id.</param> /// <param name="userMappingProvider">The user mapping provider.</param> /// <param name="teamDepartmentMappingProvider">The team department mapping provider.</param> /// <param name="telemetryClient">The telemetry client for logging.</param> /// <returns>The full list of users.</returns> internal static async Task <UserDetailsModel> GetMappedUserDetailsAsync(string workForceIntegrationId, string userId, string teamsId, IUserMappingProvider userMappingProvider, ITeamDepartmentMappingProvider teamDepartmentMappingProvider, TelemetryClient telemetryClient) { var mappedUserResult = await userMappingProvider.GetUserMappingEntityAsyncNew(userId, teamsId).ConfigureAwait(false); var teamMappingEntity = await teamDepartmentMappingProvider.GetTeamMappingForOrgJobPathAsync(workForceIntegrationId, mappedUserResult.PartitionKey).ConfigureAwait(false); if (teamMappingEntity == null) { telemetryClient.TrackTrace($"Team {mappedUserResult.PartitionKey} not mapped."); return(null); } return(new UserDetailsModel { KronosPersonNumber = mappedUserResult.RowKey, ShiftUserId = mappedUserResult.ShiftUserAadObjectId, ShiftTeamId = teamMappingEntity.TeamId, ShiftScheduleGroupId = teamMappingEntity.TeamsScheduleGroupId, OrgJobPath = mappedUserResult.PartitionKey, ShiftUserDisplayName = mappedUserResult.ShiftUserDisplayName, KronosTimeZone = teamMappingEntity.KronosTimeZone, }); }
/// <summary> /// Get All mapped users, combining user and teams department mapping data. /// </summary> /// <param name="workForceIntegrationId">The workforce integration to get the users for.</param> /// <param name="userMappingProvider">The user mapping provider.</param> /// <param name="teamDepartmentMappingProvider">The team department mapping provider.</param> /// <param name="telemetryClient">The telemetry client for logging.</param> /// <returns>The full list of users.</returns> internal static async Task <IEnumerable <UserDetailsModel> > GetAllMappedUserDetailsAsync(string workForceIntegrationId, IUserMappingProvider userMappingProvider, ITeamDepartmentMappingProvider teamDepartmentMappingProvider, TelemetryClient telemetryClient) { Dictionary <string, TeamToDepartmentJobMappingEntity> teamMappingEntities = new Dictionary <string, TeamToDepartmentJobMappingEntity>(); List <UserDetailsModel> kronosUsers = new List <UserDetailsModel>(); List <AllUserMappingEntity> mappedUsersResult = await userMappingProvider.GetAllActiveMappedUserDetailsAsync().ConfigureAwait(false); foreach (var element in mappedUsersResult) { TeamToDepartmentJobMappingEntity teamMappingEntity; var key = $"{workForceIntegrationId}_{element.PartitionKey}"; if (teamMappingEntities.ContainsKey(key)) { teamMappingEntity = teamMappingEntities[key]; } else { teamMappingEntity = await teamDepartmentMappingProvider.GetTeamMappingForOrgJobPathAsync( workForceIntegrationId, element.PartitionKey).ConfigureAwait(false); if (teamMappingEntity == null) { telemetryClient.TrackTrace($"Team {element.PartitionKey} not mapped."); continue; } teamMappingEntities.Add(key, teamMappingEntity); } kronosUsers.Add(new UserDetailsModel { KronosPersonNumber = element.RowKey, ShiftUserId = element.ShiftUserAadObjectId, ShiftTeamId = teamMappingEntity.TeamId, ShiftScheduleGroupId = teamMappingEntity.TeamsScheduleGroupId, OrgJobPath = element.PartitionKey, ShiftUserDisplayName = element.ShiftUserDisplayName, KronosTimeZone = teamMappingEntity.KronosTimeZone, }); } return(kronosUsers); }