public async Task UpdateWorkOrderDetails(int workOrderId) { _logger.LogInformation($"UpdateWorkOrderDetails for workOrderId: {workOrderId}"); var order = await SelectOrder(workOrderId); if (order.theBookings.IsNullOrEmpty()) { return; } var theBooking = ExtractBooking(order);; var theResources = theBooking.theResources; if (theResources.IsNullOrEmpty()) { return; } var operativePayrollIds = theResources.Select(r => r.externalResourceCode); var operatives = (await Task.WhenAll(operativePayrollIds.Select(i => _operativesGateway.GetAsync(i)))) .Where(o => o != null) .ToArray(); await CheckAndAssignOperatives(workOrderId, operativePayrollIds, operatives); await _appointmentsGateway.SetTimedBooking( workOrderId, DrsHelpers.ConvertToDrsTimeZone(theBooking.planningWindowStart), DrsHelpers.ConvertToDrsTimeZone(theBooking.planningWindowEnd), theBooking.bookingReason ); _logger.LogInformation($"WorkOrder {workOrderId}: successfully set timed booking - start: {theBooking.planningWindowStart} end: {theBooking.planningWindowEnd}"); await _repairsGateway.UpdateWorkOrderAttributes(workOrderId, theBooking.GetPlannerComments()); }
public async Task <OperativeResponse> ExecuteAsync(string operativePrn) { var gatewayResponse = await _operativesGateway.GetAsync(operativePrn); return(gatewayResponse.ToResponse()); }