public static LogEntry For(HistoryUpdateRequest request) { LogEntry entry = new LogEntry("HistoryUpdateRequest"); entry.Add("RequestHeader", For(request.RequestHeader)); entry.Add("HistoryUpdateDetails", For(request.HistoryUpdateDetails)); return(entry); }
public IActionResult UpdateHistory([FromRoute] int historyId, [FromBody] HistoryUpdateRequest req) { try { _historyRepository.Update(req); return(Ok()); } catch (Exception e) { return(StatusCode(500, e)); } }
public async Task HistoryUpdateAsync() { var response = new HistoryUpdateResponse(); var request = new HistoryUpdateRequest(); var channel = new TestRequestChannel(response); var ret = await channel.HistoryUpdateAsync(request); ret .Should().BeSameAs(response); channel.Request .Should().BeSameAs(request); }
public void Update(HistoryUpdateRequest req) { using (SqlConnection conn = new SqlConnection(ConnString)) { using (SqlCommand cmd = new SqlCommand("TechHistory_Update", conn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Id", req.Id); cmd.Parameters.AddWithValue("@Date", req.Date); cmd.Parameters.AddWithValue("@Title", req.Title); cmd.Parameters.AddWithValue("@Description", req.Description); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); } } }
public void Update(HistoryUpdateRequest req) { _history.Update(req); }
/// <summary> /// Updates historical values or Events of one or more Nodes. /// </summary> /// <param name="client">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="HistoryUpdateRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="HistoryUpdateResponse"/>.</returns> public static async Task <HistoryUpdateResponse> HistoryUpdateAsync(this IRequestChannel client, HistoryUpdateRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((HistoryUpdateResponse)await client.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Begins an asynchronous invocation of the HistoryUpdate service. /// </summary> public IAsyncResult BeginHistoryUpdate( RequestHeader requestHeader, ExtensionObjectCollection historyUpdateDetails, AsyncCallback callback, object asyncState) { HistoryUpdateRequest request = new HistoryUpdateRequest(); request.RequestHeader = requestHeader; request.HistoryUpdateDetails = historyUpdateDetails; UpdateRequestHeader(request, requestHeader == null, "HistoryUpdate"); if (UseTransportChannel) { return TransportChannel.BeginSendRequest(request, callback, asyncState); } return InnerChannel.BeginHistoryUpdate(new HistoryUpdateMessage(request), callback, asyncState); }
/// <summary> /// Invokes the HistoryUpdate service. /// </summary> public virtual ResponseHeader HistoryUpdate( RequestHeader requestHeader, ExtensionObjectCollection historyUpdateDetails, out HistoryUpdateResultCollection results, out DiagnosticInfoCollection diagnosticInfos) { HistoryUpdateRequest request = new HistoryUpdateRequest(); HistoryUpdateResponse response = null; request.RequestHeader = requestHeader; request.HistoryUpdateDetails = historyUpdateDetails; UpdateRequestHeader(request, requestHeader == null, "HistoryUpdate"); try { if (UseTransportChannel) { IServiceResponse genericResponse = TransportChannel.SendRequest(request); if (genericResponse == null) { throw new ServiceResultException(StatusCodes.BadUnknownResponse); } ValidateResponse(genericResponse.ResponseHeader); response = (HistoryUpdateResponse)genericResponse; } else { HistoryUpdateResponseMessage responseMessage = InnerChannel.HistoryUpdate(new HistoryUpdateMessage(request)); if (responseMessage == null || responseMessage.HistoryUpdateResponse == null) { throw new ServiceResultException(StatusCodes.BadUnknownResponse); } response = responseMessage.HistoryUpdateResponse; ValidateResponse(response.ResponseHeader); } results = response.Results; diagnosticInfos = response.DiagnosticInfos; } finally { RequestCompleted(request, response, "HistoryUpdate"); } return response.ResponseHeader; }
/// <summary> /// Initializes the message with the body. /// </summary> public HistoryUpdateMessage(HistoryUpdateRequest HistoryUpdateRequest) { this.HistoryUpdateRequest = HistoryUpdateRequest; }