/// <summary> /// The method to post a SwapShift request in a offered state. /// </summary> /// <param name="jSession">Kronos session.</param> /// <param name="personNumber">The Kronos personNumber.</param> /// <param name="reqId">The reqId of swap shift request.</param> /// <param name="querySpan">The querySpan.</param> /// <param name="comment">The comment for request.</param> /// <param name="endpointUrl">Endpoint Kronos URL.</param> /// <returns>request to send to Kronos.</returns> public async Task <SubmitResponse> SubmitSwapShiftAsync( string jSession, string personNumber, string reqId, string querySpan, string comment, Uri endpointUrl) { var telemetryProps = new Dictionary <string, string>() { { "KronosRequestId", reqId }, { "KronosPersonNumber", personNumber }, { "QueryDateSpan", querySpan }, }; this.telemetryClient.TrackTrace($"SwapShiftActivity - SubmitSwapShiftAsync starts: {DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture)}", telemetryProps); try { string xmlRequest = this.CreateSwapShiftSubmitRequest( personNumber, reqId, querySpan, comment); var tupleResponse = await this.apiHelper.SendSoapPostRequestAsync( endpointUrl, SoapEnvOpen, xmlRequest, SoapEnvClose, jSession).ConfigureAwait(false); SubmitResponse response = tupleResponse.ProcessResponse <SubmitResponse>(this.telemetryClient); this.telemetryClient.TrackTrace($"SwapShiftActivity - SubmitSwapShiftAsync ends: {DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture)}", telemetryProps); return(response); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) #pragma warning restore CA1031 // Do not catch general exception types { this.telemetryClient.TrackException(ex, telemetryProps); return(null); } }
/// <inheritdoc/> public async Task <SubmitResponse> DraftSwapShiftAsync( string jSession, SwapShiftObj obj, string apiEndpoint) { this.telemetryClient.TrackTrace($"SwapShiftActivity - DraftSwapShiftAsync starts at: {DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture)}"); if (obj is null) { throw new ArgumentNullException(nameof(obj)); } try { string xmlRequest = this.CreateSwapShiftDraftRequest(obj); var tupleResponse = await this.apiHelper.SendSoapPostRequestAsync( new Uri(apiEndpoint), SoapEnvOpen, xmlRequest, SoapEnvClose, jSession).ConfigureAwait(false); SubmitResponse response = tupleResponse.ProcessResponse <SubmitResponse>(this.telemetryClient); this.telemetryClient.TrackTrace($"SwapShiftActivity - DraftSwapShiftAsync ends at: {DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture)}"); return(response); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) #pragma warning restore CA1031 // Do not catch general exception types { this.telemetryClient.TrackException(ex); return(null); } }