/// <summary> /// Method to create an Open Shift Mapping Entity to store in Azure Table storage. /// </summary> /// <param name="openShiftId">The Graph Open Shift ID.</param> /// <param name="shiftRequestId">The incoming Shift Request ID.</param> /// <param name="teamsUserAadObjectId">The User AAD Object ID that made the Open Shift Request.</param> /// <param name="kronosPersonNumber">The Kronos Person Number.</param> /// <param name="kronosRequestId">The Kronos Request ID.</param> /// <param name="kronosRequestStatus">The Kronos Request status.</param> /// <param name="kronosUniqueId">The system generated ID.</param> /// <param name="monthPartitionKey">The month partition key of the requested Open Shift.</param> /// <param name="openShiftRequestStatus">The Open Shift Request status from the incoming request.</param> /// <returns>An object of type <see cref="AllOpenShiftRequestMappingEntity"/>.</returns> private static AllOpenShiftRequestMappingEntity CreateOpenShiftRequestMapping( string openShiftId, string shiftRequestId, string teamsUserAadObjectId, string kronosPersonNumber, string kronosRequestId, string kronosRequestStatus, string kronosUniqueId, string monthPartitionKey, string openShiftRequestStatus) { // Forming the open shift request mapping entity with the parameters defined, // and using the month partition key of the open shift entity as the month // partition key of the open shift request entity. var openShiftRequestMappingEntity = new AllOpenShiftRequestMappingEntity() { TeamsOpenShiftId = openShiftId, RowKey = shiftRequestId, AadUserId = teamsUserAadObjectId, KronosPersonNumber = kronosPersonNumber, KronosOpenShiftRequestId = kronosRequestId, KronosStatus = kronosRequestStatus, KronosOpenShiftUniqueId = kronosUniqueId, ShiftsStatus = openShiftRequestStatus, PartitionKey = monthPartitionKey, }; return(openShiftRequestMappingEntity); }
/// <summary> /// Saves or updates an open shift request mapping to Azure table storage. /// </summary> /// <param name="entity">The open shift request mapping entity.</param> /// <returns>A unit of execution.</returns> public Task SaveOrUpdateOpenShiftRequestMappingEntityAsync( AllOpenShiftRequestMappingEntity entity) { if (entity is null) { throw new ArgumentNullException(nameof(entity)); } var saveOrUpdateOpenShiftRequestMappingProps = new Dictionary <string, string>() { { "IncomingShiftRequestId", entity?.RowKey }, { "IncomingKronosRequestId", entity.KronosOpenShiftRequestId }, { "CallingAssembly", Assembly.GetCallingAssembly().GetName().Name }, }; this.telemetryClient.TrackTrace( MethodBase.GetCurrentMethod().Name, saveOrUpdateOpenShiftRequestMappingProps); return(this.StoreOrUpdateEntityAsync(entity)); }
private async Task <TableResult> StoreOrUpdateEntityAsync(AllOpenShiftRequestMappingEntity entity) { if (entity is null) { throw new ArgumentNullException(nameof(entity)); } await this.EnsureInitializedAsync().ConfigureAwait(false); var storeOrUpdateEntityProps = new Dictionary <string, string>() { { "CallingAssembly", Assembly.GetCallingAssembly().GetName().Name }, }; this.telemetryClient.TrackEvent("StoreOrUpdateEntityAsync", storeOrUpdateEntityProps); TableOperation addOrUpdateOperation = TableOperation.InsertOrReplace(entity); return(await this.openShiftRequestMappingCloudTable.ExecuteAsync(addOrUpdateOperation).ConfigureAwait(false)); }