public void EndRequest(ushort requestID, int appStatus, ProtocolStatus protocolStatus) { var body = new EndRequestBody(appStatus, protocolStatus); try { if (IsConnected) { byte[] bodyData = body.GetData(); CompatArraySegment <byte> bodyBuffer = send_buffers.EnforceBodyLength(bodyData.Length); Array.Copy(bodyData, 0, bodyBuffer.Array, bodyBuffer.Offset, bodyData.Length); var record = new NRecord(1, RecordType.EndRequest, requestID, bodyData.Length, send_buffers); record.Send(socket); } } catch (System.Net.Sockets.SocketException) { } RemoveRequest(requestID); lock (connection_teardown_lock) { if (requests.Count == 0 && (!keep_alive || stop)) { CloseSocket(); if (!stop) { server.EndConnection(this); } receive_buffers.Return(); send_buffers.Return(); } } }
public void EndRequest(ushort requestID, int appStatus, ProtocolStatus protocolStatus) { EndRequestBody body = new EndRequestBody(appStatus, protocolStatus); if (IsConnected) { new Record(1, RecordType.EndRequest, requestID, body.GetData()).Send(socket); } int index = GetRequestIndex(requestID); if (index >= 0) { lock (request_lock) { requests.RemoveAt(index); } } if (requests.Count == 0 && (!keep_alive || stop)) { socket.Close(); server.EndConnection(this); server.ReleaseBuffers(receive_buffer, send_buffer); } }
public void InvokeProtocollApplication(ProtocolStatus status) { if (OnProtocolApplication != null) { OnProtocolApplication.Invoke(ref this, status); } }
public static bool TryParse(string value, out ProtocolStatus result) { result = default(ProtocolStatus); if (value == "draft") { result = ProtocolStatus.Draft; } else if (value == "testing") { result = ProtocolStatus.Testing; } else if (value == "review") { result = ProtocolStatus.Review; } else if (value == "production") { result = ProtocolStatus.Production; } else if (value == "withdrawn") { result = ProtocolStatus.Withdrawn; } else if (value == "superseded") { result = ProtocolStatus.Superseded; } else { return(false); } return(true); }
public static string ToString(ProtocolStatus value) { if (value == ProtocolStatus.Draft) { return("draft"); } else if (value == ProtocolStatus.Testing) { return("testing"); } else if (value == ProtocolStatus.Review) { return("review"); } else if (value == ProtocolStatus.Production) { return("production"); } else if (value == ProtocolStatus.Withdrawn) { return("withdrawn"); } else if (value == ProtocolStatus.Superseded) { return("superseded"); } else { throw new ArgumentException("Unrecognized ProtocolStatus value: " + value.ToString()); } }
public void SetProtocolStatus(short year, int number, string statusCode) { try { ValidateWindowsSecurity(); if (!DocSuiteContext.Current.ProtocolEnv.IsStatusEnabled) { throw new ArgumentException("Attenzione, gestione dello stato di Protocollo non abilitata."); } Protocol protocol = Facade.ProtocolFacade.GetById(year, number); if (protocol == null) { throw new Exception("Attenzione protocollo non presente per gli identificativi passati"); } ProtocolStatus status = Facade.ProtocolStatusFacade.GetById(statusCode); if (status == null) { throw new ArgumentException("Attenzione, nessun ProtocolStatus trovato per il codice passato", "statusCode"); } //Eseguo la modifica dello stato protocol.Status = status; Facade.ProtocolFacade.Update(ref protocol); } finally { NHibernateSessionManager.Instance.CloseTransactionAndSessions(); } }
//public long StartUniqueLinkedObject(DateTime p_DateTimeNow, string p_Login, string p_HeaderName, LinkedObject p_LinkedObject) //{ // using (var conn = new SqlConnection(_ConnectionString)) // { // conn.Open(); // //Posibility 1 : By T-SQL // var found = conn.Query<long>("SELECT HeaderId FROM SimpleProtocol.LinkedObject WHERE Name=@Name AND Id=@Id", // new { Name = p_LinkedObject.ObjectName, Id = p_LinkedObject.ObjectId }).ToList(); // //Posibility 2 : By Linq (by nuget package 'MicroOrm.Dapper.Repositories') // //var repo = new DapperRepository<LinkedObjectRow>(conn); // //var found = repo.FindAll(i => i.Name == p_LinkedObject.ObjectName && i.Id == p_LinkedObject.ObjectId.ToString()).ToList(); // if (found.Count > 1) // { // throw new Exception($"More HeaderId found in LinkedObject with Name={p_LinkedObject.ObjectName} AND Id={p_LinkedObject.ObjectId}"); // } // if (found.Count == 1) // { // return found.FirstOrDefault(); // } // //create new with linked object // var result = conn.Insert(new HeaderRow { CreatedDate = p_DateTimeNow, CreatedLogin = p_Login, Name = p_HeaderName }); // conn.Insert(new LinkedObjectRow() { HeaderId = result, Name = p_LinkedObject.ObjectName, Id = p_LinkedObject.ObjectId.ToString() }); // return result; // } //} public long AddDetail(long p_HeaderId, DateTime p_DateTimeNow, ProtocolStatus p_Status, string p_Text) { if (_UseInMemoryCacheDetailAndBulkInsert) { if (_CacheDetail.ExceptionProcessing == null) { _CacheDetail.ExceptionProcessing = ConsumerThreadExceptionProcessing; } _CacheDetail.AddItem(new QueueItemDetail() { ConnectionString = _ConnectionString, DateTimeNow = p_DateTimeNow, HeaderId = p_HeaderId, Status = p_Status, Text = p_Text }); return(0); } using (var conn = new SqlConnection(_ConnectionString)) { conn.Open(); return(conn.Insert(new DetailRow { HeaderId = p_HeaderId, CreatedDate = p_DateTimeNow, StatusId = (int)p_Status, Text = p_Text })); } }
public ProtocolStatusDto MappingFromEntity(ProtocolStatus entity) { ProtocolStatusDto dto = new ProtocolStatusDto { Incremental = entity.Incremental.HasValue ? entity.Incremental.Value : 0, StatusCode = entity.Id, StatusDescription = entity.Description }; return(dto); }
public void EndRequest(ushort requestID, int appStatus, ProtocolStatus protocolStatus) { EndRequestBody body = new EndRequestBody(appStatus, protocolStatus); try { if (IsConnected) { new Record(1, RecordType.EndRequest, requestID, body.GetData()).Send(socket); } } catch (System.Net.Sockets.SocketException) { } int index = GetRequestIndex(requestID); if (index >= 0) { lock (request_lock) { requests.RemoveAt(index); } } lock (connection_teardown_lock) { if (requests.Count == 0 && (!keep_alive || stop)) { if (socket != null) { try { socket.Close(); } finally { socket = null; } } if (!stop) { server.EndConnection(this); } if (receive_buffer != null && send_buffer != null) { server.ReleaseBuffers(receive_buffer, send_buffer); receive_buffer = null; send_buffer = null; } } } }
//public THeaderId StartUniqueLinkedObject(string p_HeaderName, LinkedObject p_LinkedObject) //{ // if (InnerState == ProtocolWriteHeaderInnerState.Started) // throw new ProtocolWriteHeaderInnerStateException( // $"InnerState is {InnerState}, but must be {ProtocolWriteHeaderInnerState.Created} / {ProtocolWriteHeaderInnerState.Stopped}"); // InnerState = ProtocolWriteHeaderInnerState.Started; // HeaderId = _ProtocolWriteRepository.StartUniqueLinkedObject(_DateTime.Now, _Login.Login, p_HeaderName, p_LinkedObject); // return HeaderId; //} public TDetailId AddDetail(ProtocolStatus p_Status, string p_Text) { if (InnerState != ProtocolWriteHeaderInnerState.Started) { throw new ProtocolWriteHeaderInnerStateException($"InnerState is {InnerState}, but must be {ProtocolWriteHeaderInnerState.Started}"); } var result = _ProtocolWriteRepository.AddDetail(HeaderId, _DateTime.Now, p_Status, p_Text); if (p_Status != ProtocolStatus.EndProcess && (WorstAddedDetailStatus == null || ProtocolStatusExtensions.StatusWorstIndex[WorstAddedDetailStatus.Value] < ProtocolStatusExtensions.StatusWorstIndex[p_Status])) { WorstAddedDetailStatus = p_Status; } return(result); }
public ProtocolStatus?WorstStatusOfChilds() { if (Details == null) { return(null); } ProtocolStatus result = ProtocolStatus.Ok; foreach (ProtocolDetail <TDetailId> detail in Details) { result = result.Worst(detail.Status); } return(result); }
public List <Data.ProtocolStatus> GetWorkflowStatus(string ProtocolCKey) { List <Data.ProtocolStatus> statuses = new Workflow().GetWorkflowProtocolStatus(decimal.Parse(ProtocolCKey)); if (statuses.Count == 0) //work has not started yet { Data.ProtocolStatus s = new ProtocolStatus(); s.DraftVersion = ""; s.EditorCKey = 0; s.ProtocolCKey = decimal.Parse(ProtocolCKey); s.Status = ""; statuses.Add(s); } return(statuses); }
/// <summary> /// After writing to the output Streams, you have to end the request with a Status Code and a protocol status. /// Use this method to do that before disposing this object. /// </summary> /// <param name="appStatus">The Application status. Use 0 for success and anything else for error.</param> public void SendEndRequest(int appStatus, ProtocolStatus protocolStatus) { // Flush stuff before doing this! Data.Dispose(); Params.Dispose(); Stdin.Dispose(); Stdout.Dispose(); Stderr.Dispose(); var rec = new EndRequestRecord(RequestId); rec.AppStatus = appStatus; rec.ProtocolStatus = protocolStatus; Send(rec); }
// When a request is completed, the output and error streams // must be completed and the final farewell must be send so // the HTTP server can finish its response. public void CompleteRequest (int appStatus, ProtocolStatus protocolStatus) { // Data is no longer needed. DataNeeded = false; // Close the standard output if it was opened. if (stdout_sent) SendStreamData (RecordType.StandardOutput, new byte [0], 0); // Close the standard error if it was opened. if (stderr_sent) SendStreamData (RecordType.StandardError, new byte [0], 0); connection.EndRequest (RequestID, appStatus, protocolStatus); }
public void SetAndGetProtocolStatus() { var rec = new EndRequestRecord(1); ProtocolStatus status = ProtocolStatus.CantMpxConn; rec.ProtocolStatus = status; Assert.AreEqual(status, rec.ProtocolStatus); status = ProtocolStatus.Overloaded; rec.ProtocolStatus = status; Assert.AreEqual(status, rec.ProtocolStatus); status = ProtocolStatus.RequestComplete; rec.ProtocolStatus = status; Assert.AreEqual(status, rec.ProtocolStatus); status = ProtocolStatus.UnknownRole; rec.ProtocolStatus = status; Assert.AreEqual(status, rec.ProtocolStatus); }
/// <summary> /// Gets the protocol status of the protocol with the given id /// </summary> /// <param name="id">The id of the protocol</param> /// <returns>The protocol status</returns> public async Task <ProtocolStatus> GetProtocolStatusAsync(string id) { try { HttpResponseMessage response = await HttpMessageHelper.RequestApiAsync(client, HttpMethod.Get, "get-protocol-status", new Dictionary <string, object>() { { "id", id } }); ProtocolStatus protocolStatus = await HttpMessageHelper.DeserializeResponse <ProtocolStatus>(response); return(protocolStatus); } catch (MobileServiceInvalidOperationException ex) { if (ex.Response.StatusCode == HttpStatusCode.NotFound) { throw new ServerRessourceNotFoundException(nameof(GetProtocolStatusAsync), id); } else { throw new ServerAccessException(ex.Response.StatusCode); } } }
public void WorstExtension() { ProtocolStatus status = ProtocolStatus.Ok; Assert.AreEqual(ProtocolStatus.Ok, status.Worst(ProtocolStatus.Ok)); Assert.AreEqual(ProtocolStatus.Warning, status.Worst(ProtocolStatus.Warning)); Assert.AreEqual(ProtocolStatus.Error, status.Worst(ProtocolStatus.Error)); Assert.AreEqual(ProtocolStatus.Failed, status.Worst(ProtocolStatus.Failed)); Assert.AreEqual(ProtocolStatus.Ok, status.Worst(ProtocolStatus.Info)); status = ProtocolStatus.Warning; Assert.AreEqual(ProtocolStatus.Warning, status.Worst(ProtocolStatus.Ok)); Assert.AreEqual(ProtocolStatus.Warning, status.Worst(ProtocolStatus.Warning)); Assert.AreEqual(ProtocolStatus.Error, status.Worst(ProtocolStatus.Error)); Assert.AreEqual(ProtocolStatus.Failed, status.Worst(ProtocolStatus.Failed)); Assert.AreEqual(ProtocolStatus.Warning, status.Worst(ProtocolStatus.Info)); status = ProtocolStatus.Error; Assert.AreEqual(ProtocolStatus.Error, status.Worst(ProtocolStatus.Ok)); Assert.AreEqual(ProtocolStatus.Error, status.Worst(ProtocolStatus.Warning)); Assert.AreEqual(ProtocolStatus.Error, status.Worst(ProtocolStatus.Error)); Assert.AreEqual(ProtocolStatus.Failed, status.Worst(ProtocolStatus.Failed)); Assert.AreEqual(ProtocolStatus.Error, status.Worst(ProtocolStatus.Info)); status = ProtocolStatus.Failed; Assert.AreEqual(ProtocolStatus.Failed, status.Worst(ProtocolStatus.Ok)); Assert.AreEqual(ProtocolStatus.Failed, status.Worst(ProtocolStatus.Error)); Assert.AreEqual(ProtocolStatus.Failed, status.Worst(ProtocolStatus.Warning)); Assert.AreEqual(ProtocolStatus.Failed, status.Worst(ProtocolStatus.Failed)); Assert.AreEqual(ProtocolStatus.Failed, status.Worst(ProtocolStatus.Info)); status = ProtocolStatus.Info; Assert.AreEqual(ProtocolStatus.Ok, status.Worst(ProtocolStatus.Ok)); Assert.AreEqual(ProtocolStatus.Error, status.Worst(ProtocolStatus.Error)); Assert.AreEqual(ProtocolStatus.Warning, status.Worst(ProtocolStatus.Warning)); Assert.AreEqual(ProtocolStatus.Failed, status.Worst(ProtocolStatus.Failed)); Assert.AreEqual(ProtocolStatus.Info, status.Worst(ProtocolStatus.Info)); }
// When a request is completed, the output and error streams // must be completed and the final farewell must be send so // the HTTP server can finish its response. public void CompleteRequest(int appStatus, ProtocolStatus protocolStatus) { // Data is no longer needed. DataNeeded = false; // Close the standard output if it was opened. if (stdout_sent) { SendStreamData(RecordType.StandardOutput, new byte [0], 0); } // Close the standard error if it was opened. if (stderr_sent) { SendStreamData(RecordType.StandardError, new byte [0], 0); } connection.EndRequest(RequestID, appStatus, protocolStatus); }
public EndRequestBody(int appStatus, ProtocolStatus protocolStatus) { app_status = appStatus; protocol_status = protocolStatus; }
public static string ToString(ProtocolStatus value) { if( value==ProtocolStatus.Draft ) return "draft"; else if( value==ProtocolStatus.Testing ) return "testing"; else if( value==ProtocolStatus.Review ) return "review"; else if( value==ProtocolStatus.Production ) return "production"; else if( value==ProtocolStatus.Withdrawn ) return "withdrawn"; else if( value==ProtocolStatus.Superseded ) return "superseded"; else throw new ArgumentException("Unrecognized ProtocolStatus value: " + value.ToString()); }
protected void ddlVersions_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddlVersions = (DropDownList)sender; GridViewRow row = (GridViewRow)ddlVersions.Parent.Parent; Label lbl = (Label)row.FindControl("lblProtocoCKey"); string protocolversionckey = lbl.Text; // Convert.ToString(DataBinder.Eval(row.DataItem, "ProtocolVersionCKey")); List <Author> authors = new Author().getAuthors(decimal.Parse(protocolversionckey), 0, 999); //get the work version List <ReviewStatus> reviewstatuses = new Workflow().GetWorkflowProtocolReviewStatus(decimal.Parse(protocolversionckey), decimal.Parse(ddlVersions.SelectedValue.ToString())); if (reviewstatuses.Count > 0) { foreach (Author reviewer in authors) { ReviewStatus status = reviewstatuses.Where(x => x.ReviewerCKey == reviewer.AuthorCKey && reviewer.RoleCKey == (decimal)3.100004300).FirstOrDefault(); if (status != null) { if (status.Status != "3.100004300") { reviewer.Name = reviewer.Name + " - Pending"; } else { reviewer.Name = reviewer.Name + " - Done"; } } else { //must have been addeded after draft was released //reviewer.Name = reviewer.Name + " - Pending"; //new Workflow().AddProtocolReviewer(decimal.Parse(protocolversionckey), ((SSPUser)Session["user"]).CKey); //if ((int)reviewer.RoleCKey == 3) //{ // reviewer.Name = reviewer.Name + " - Pending"; //} } } } else { } DropDownList ddlReviewStatus = (DropDownList)row.FindControl("ddlReviewStatus"); var reviewers = authors.Where(x => x.RoleCKey == (decimal)3.100004300).OrderBy(x => x.Name); ddlReviewStatus.DataSource = reviewers; ddlReviewStatus.DataTextField = "Name"; ddlReviewStatus.DataValueField = "AuthorCKey"; ddlReviewStatus.DataBind(); DropDownList ddlEditStatus = (DropDownList)row.FindControl("ddlEditStatus"); List <ProtocolStatus> editstatuses = new Workflow().GetWorkflowProtocolEditStatus(decimal.Parse(protocolversionckey), decimal.Parse(ddlVersions.SelectedValue.ToString())); if (editstatuses.Count > 0) { foreach (Author editor in authors) { ProtocolStatus status = editstatuses.Where((x => x.EditorCKey == editor.AuthorCKey && ((int)editor.RoleCKey == 1 || (int)editor.RoleCKey == 2))).FirstOrDefault(); //ProtocolStatus status = editstatuses.Where(x => x.EditorCKey == editor.AuthorCKey).FirstOrDefault(); if (status != null) { if (status.Status != "4.100004300") { editor.Name = editor.Name + " - Pending review"; } else { editor.Name = editor.Name + " - Done"; } } else //author has not submitted draft yet { // if ((int)editor.RoleCKey == 1 || (int)editor.RoleCKey == 2) // editor.Name = editor.Name + " - Pending"; //new Workflow().AddProtocolAuthor(decimal.Parse(protocolversionckey), ((SSPUser)Session["user"]).CKey); } } } else { /* * foreach (Author editor in authors) * { * editor.Name = editor.Name + " - Pending"; * }*/ } var editors = authors.Where(x => x.RoleCKey == (decimal)1.100004300 || x.RoleCKey == (decimal)2.100004300 || x.RoleCKey == (decimal)9.100004300).OrderBy(x => x.Name); ddlEditStatus.DataSource = editors; ddlEditStatus.DataTextField = "Name"; ddlEditStatus.DataValueField = "AuthorCKey"; ddlEditStatus.DataBind(); }
protected void grdDashboard_RowDataBound(object sender, GridViewRowEventArgs e) { //if ((e.Row.RowState & DataControlRowState.Edit) > 0) { string protocolversionckey = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "ProtocolVersionCKey")); if (protocolversionckey != "") { DropDownList ddlReviewStatus = (DropDownList)e.Row.FindControl("ddlReviewStatus"); DropDownList ddlVersions = (DropDownList)e.Row.FindControl("ddlVersions"); DataTable dt = ProtocolsData.GetDraftVersions(decimal.Parse(protocolversionckey)); ddlVersions.DataSource = dt; ddlVersions.DataTextField = "DraftVersion"; ddlVersions.DataValueField = "DraftVersion"; ddlVersions.DataBind(); ddlVersions.SelectedIndex = 0; string DraftVersion = ddlVersions.SelectedValue.ToString(); List <ReviewStatus> reviewstatuses = new List <ReviewStatus>(); if (DraftVersion != "") { reviewstatuses = new Workflow().GetWorkflowProtocolReviewStatus(decimal.Parse(protocolversionckey), decimal.Parse(ddlVersions.SelectedValue.ToString())); } //ddlReviewStatus.ForeColor = System.Drawing.Color.Black; List <Author> authors = new Author().getAuthors(decimal.Parse(protocolversionckey), 0, 999); //get the work version if (reviewstatuses.Count > 0) { foreach (Author reviewer in authors) { ReviewStatus status = reviewstatuses.Where(x => x.ReviewerCKey == reviewer.AuthorCKey && reviewer.RoleCKey == (decimal)3.100004300).FirstOrDefault(); if (status != null) { if (status.Status != "3.100004300") { reviewer.Name = reviewer.Name + " - Pending"; } else { reviewer.Name = reviewer.Name + " - Done"; } } else { //must have been addeded after draft was released //reviewer.Name = reviewer.Name + " - Pending"; //new Workflow().AddProtocolReviewer(decimal.Parse(protocolversionckey), ((SSPUser)Session["user"]).CKey); //if ((int)reviewer.RoleCKey == 3) //{ // reviewer.Name = reviewer.Name + " - Pending"; //} } } } else { } var reviewers = authors.Where(x => x.RoleCKey == (decimal)3.100004300).OrderBy(x => x.Name); ddlReviewStatus.DataSource = reviewers; ddlReviewStatus.DataTextField = "Name"; ddlReviewStatus.DataValueField = "AuthorCKey"; ddlReviewStatus.DataBind(); DropDownList ddlEditStatus = (DropDownList)e.Row.FindControl("ddlEditStatus"); List <ProtocolStatus> editstatuses = new List <ProtocolStatus>(); if (DraftVersion != "") { editstatuses = new Workflow().GetWorkflowProtocolEditStatus(decimal.Parse(protocolversionckey), decimal.Parse(ddlVersions.SelectedValue.ToString())); } if (editstatuses.Count > 0) { foreach (Author editor in authors) { ProtocolStatus status = editstatuses.Where((x => x.EditorCKey == editor.AuthorCKey && ((int)editor.RoleCKey == 1 || (int)editor.RoleCKey == 2))).FirstOrDefault(); //ProtocolStatus status = editstatuses.Where(x => x.EditorCKey == editor.AuthorCKey).FirstOrDefault(); if (status != null) { if (status.Status != "4.100004300") { editor.Name = editor.Name + " - Pending review"; } else { editor.Name = editor.Name + " - Done"; } } else //author has not submitted draft yet { // if ((int)editor.RoleCKey == 1 || (int)editor.RoleCKey == 2) // editor.Name = editor.Name + " - Pending"; //new Workflow().AddProtocolAuthor(decimal.Parse(protocolversionckey), ((SSPUser)Session["user"]).CKey); } } } else { /* * foreach (Author editor in authors) * { * editor.Name = editor.Name + " - Pending"; * }*/ } var editors = authors.Where(x => x.RoleCKey == (decimal)1.100004300 || x.RoleCKey == (decimal)2.100004300).OrderBy(x => x.Name); ddlEditStatus.DataSource = editors; ddlEditStatus.DataTextField = "Name"; ddlEditStatus.DataValueField = "AuthorCKey"; ddlEditStatus.DataBind(); DropDownList ddleCCStatus = (DropDownList)e.Row.FindControl("ddleCCStatus"); DropDownList ddlPublicationStatus = (DropDownList)e.Row.FindControl("ddlPublicationStatus"); ddleCCStatus.Items.Add("Not Available"); ddlPublicationStatus.Items.Add("Not Available"); } } }
/// <summary> /// Sends an EndRequest record with a specified request ID, /// application status, and protocol status, and releases the /// associated resources. /// </summary> /// <param name="requestID"> /// A <see cref="ushort" /> containing the ID of the request /// to end. /// </param> /// <param name="appStatus"> /// <para>A <see cref="int" /> containing the application /// status the request ended with.</para> /// <para>This is the same value as would be returned by a /// program on termination. On successful termination, this /// would be zero.</para> /// </param> /// <param name="protocolStatus"> /// A <see cref="ProtocolStatus" /> containing the FastCGI /// protocol status with which the request is being ended. /// </param> public void EndRequest(ushort requestID, int appStatus, ProtocolStatus protocolStatus) { EndRequestBody body = new EndRequestBody (appStatus, protocolStatus); if (IsConnected) new Record (1, RecordType.EndRequest, requestID, body.GetData ()).Send (socket); int index = GetRequestIndex (requestID); if (index >= 0) { lock (request_lock) { requests.RemoveAt (index); } } if (requests.Count == 0 && (!keep_alive || stop)) { socket.Close (); server.EndConnection (this); server.ReleaseBuffers (receive_buffer, send_buffer); } }
//public long StartUniqueLinkedObject(DateTime p_DateTimeNow, string p_Login, string p_HeaderName, LinkedObject p_LinkedObject) //{ // throw new NotImplementedException(); //} public long AddDetail(long p_HeaderId, DateTime p_DateTimeNow, ProtocolStatus p_Status, string p_Text) { SaveLineWithDateTimePrefix(p_HeaderId, $"Detail [{p_Status}]: {p_Text}", p_DateTimeNow); return(0); }
public EndRequestMessageBody(int appStatus, ProtocolStatus protocolStatus) { ApplicationStatus = appStatus; ProtocolStatus = protocolStatus; Reserved = new byte[3]; }
public static bool TryParse(string value, out ProtocolStatus result) { result = default(ProtocolStatus); if( value=="draft") result = ProtocolStatus.Draft; else if( value=="testing") result = ProtocolStatus.Testing; else if( value=="review") result = ProtocolStatus.Review; else if( value=="production") result = ProtocolStatus.Production; else if( value=="withdrawn") result = ProtocolStatus.Withdrawn; else if( value=="superseded") result = ProtocolStatus.Superseded; else return false; return true; }
public void EndRequest(ushort requestID, int appStatus, ProtocolStatus protocolStatus) { var body = new EndRequestBody (appStatus, protocolStatus); try { if (IsConnected) { byte[] bodyData = body.GetData (); send_buffers.EnforceBodyLength(bodyData.Length); Array.Copy(bodyData, 0, send_buffers.Body.Value.Array, send_buffers.Body.Value.Offset, bodyData.Length); var record = new Record (1, RecordType.EndRequest, requestID, send_buffers, bodyData.Length); record.Send (socket); } } catch (System.Net.Sockets.SocketException) { } int index = GetRequestIndex (requestID); if (index >= 0) { lock (request_lock) { requests.RemoveAt (index); } } lock (connection_teardown_lock) { if (requests.Count == 0 && (!keep_alive || stop)) { CloseSocket (); if (!stop) server.EndConnection (this); receive_buffers.Return (); send_buffers.Return (); } } }
public EndRequestBody (int appStatus, ProtocolStatus protocolStatus) { app_status = appStatus; protocol_status = protocolStatus; }
public void EndRequest(ushort requestID, int appStatus, ProtocolStatus protocolStatus) { var body = new EndRequestBody (appStatus, protocolStatus); try { if (IsConnected) new Record (1, RecordType.EndRequest, requestID, body.GetData ()).Send (socket); } catch (System.Net.Sockets.SocketException) { } int index = GetRequestIndex (requestID); if (index >= 0) { lock (request_lock) { requests.RemoveAt (index); } } lock (connection_teardown_lock) { if (requests.Count == 0 && (!keep_alive || stop)) { if (socket != null) { try { socket.Close (); } finally { socket = null; } } if (!stop) server.EndConnection (this); if (receive_buffer != null && send_buffer != null) { server.ReleaseBuffers (receive_buffer, send_buffer); receive_buffer = null; send_buffer = null; } } } }
public void EndRequest (ushort requestID, int appStatus, ProtocolStatus protocolStatus) { var body = new EndRequestBody (appStatus, protocolStatus); try { if (IsConnected) { byte[] bodyData = body.GetData (); CompatArraySegment<byte> bodyBuffer = send_buffers.EnforceBodyLength(bodyData.Length); Array.Copy(bodyData, 0, bodyBuffer.Array, bodyBuffer.Offset, bodyData.Length); var record = new NRecord (1, RecordType.EndRequest, requestID, bodyData.Length, send_buffers); record.Send (socket); } } catch (System.Net.Sockets.SocketException) { } RemoveRequest(requestID); lock (connection_teardown_lock) { if (requests.Count == 0 && (!keep_alive || stop)) { CloseSocket (); if (!stop) server.EndConnection (this); receive_buffers.Return (); send_buffers.Return (); } } }
public static ProtocolStatus Worst(this ProtocolStatus p_ProtocolStatus, ProtocolStatus p_ProtocolStatus2) { return(StatusWorstIndex[p_ProtocolStatus] > StatusWorstIndex[p_ProtocolStatus2] ? p_ProtocolStatus : p_ProtocolStatus2); }