public void SaveProtocolInfo(List <ProtocolElementUI> p) { StringBuilder csv = new StringBuilder(); if (!Directory.Exists(protocolDirectory)) { Directory.CreateDirectory(protocolDirectory); } for (int i = 0; i < p.Count; i++) { csv.AppendLine(string.Format("{0},{1}", p[i].prefab, p[i].reps)); ProtocolElement tempElement = new ProtocolElement(p[i].prefab, p[i].reps); } File.WriteAllText(protocolDirectory + "\\protocol_" + System.DateTime.Now.ToString("yyyy_MM_dd") + ".csv", csv.ToString()); protocolCheck = true; }
private Type GetAppDomainProtocolHandlerType(string protocolId) { Type type = null; try { ProtocolElement element = this.ProtocolsConfig.Protocols[protocolId]; if (element == null) { throw new ArgumentException(System.Web.SR.GetString("Unknown_protocol_id", new object[] { protocolId })); } type = this.ValidateAndGetType(element, element.AppDomainHandlerType, typeof(AppDomainProtocolHandler), "AppDomainHandlerType"); } catch (Exception exception) { using (new ProcessImpersonationContext()) { Misc.ReportUnhandledException(exception, new string[] { System.Web.SR.GetString("Invalid_AppDomain_Prot_Type") }); } } return(type); }
public void StartProcessProtocolListenerChannel(string protocolId, IListenerChannelCallback listenerChannelCallback) { try { if (protocolId == null) { throw new ArgumentNullException("protocolId"); } ProtocolElement element = this.ProtocolsConfig.Protocols[protocolId]; if (element == null) { throw new ArgumentException(System.Web.SR.GetString("Unknown_protocol_id", new object[] { protocolId })); } ProcessProtocolHandler handler = null; Type type = null; type = this.ValidateAndGetType(element, element.ProcessHandlerType, typeof(ProcessProtocolHandler), "ProcessHandlerType"); lock (this) { handler = this._protocolHandlers[protocolId] as ProcessProtocolHandler; if (handler == null) { handler = (ProcessProtocolHandler)Activator.CreateInstance(type); this._protocolHandlers[protocolId] = handler; } } if (handler != null) { handler.StartListenerChannel(listenerChannelCallback, this); } } catch (Exception exception) { using (new ProcessImpersonationContext()) { Misc.ReportUnhandledException(exception, new string[] { System.Web.SR.GetString("Invalid_Process_Prot_Type") }); } throw; } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as ClinicalImpression; if (dest != null) { base.CopyTo(dest); if (Patient != null) { dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy(); } if (Assessor != null) { dest.Assessor = (Hl7.Fhir.Model.ResourceReference)Assessor.DeepCopy(); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus>)StatusElement.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (DescriptionElement != null) { dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy(); } if (Previous != null) { dest.Previous = (Hl7.Fhir.Model.ResourceReference)Previous.DeepCopy(); } if (Problem != null) { dest.Problem = new List <Hl7.Fhir.Model.ResourceReference>(Problem.DeepCopy()); } if (Trigger != null) { dest.Trigger = (Hl7.Fhir.Model.Element)Trigger.DeepCopy(); } if (Investigations != null) { dest.Investigations = new List <Hl7.Fhir.Model.ClinicalImpression.InvestigationsComponent>(Investigations.DeepCopy()); } if (ProtocolElement != null) { dest.ProtocolElement = (Hl7.Fhir.Model.FhirUri)ProtocolElement.DeepCopy(); } if (SummaryElement != null) { dest.SummaryElement = (Hl7.Fhir.Model.FhirString)SummaryElement.DeepCopy(); } if (Finding != null) { dest.Finding = new List <Hl7.Fhir.Model.ClinicalImpression.FindingComponent>(Finding.DeepCopy()); } if (Resolved != null) { dest.Resolved = new List <Hl7.Fhir.Model.CodeableConcept>(Resolved.DeepCopy()); } if (RuledOut != null) { dest.RuledOut = new List <Hl7.Fhir.Model.ClinicalImpression.RuledOutComponent>(RuledOut.DeepCopy()); } if (PrognosisElement != null) { dest.PrognosisElement = (Hl7.Fhir.Model.FhirString)PrognosisElement.DeepCopy(); } if (Plan != null) { dest.Plan = new List <Hl7.Fhir.Model.ResourceReference>(Plan.DeepCopy()); } if (Action != null) { dest.Action = new List <Hl7.Fhir.Model.ResourceReference>(Action.DeepCopy()); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as ClinicalImpression; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus>)StatusElement.DeepCopy(); } if (Code != null) { dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy(); } if (DescriptionElement != null) { dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy(); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (Context != null) { dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopy(); } if (Effective != null) { dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Assessor != null) { dest.Assessor = (Hl7.Fhir.Model.ResourceReference)Assessor.DeepCopy(); } if (Previous != null) { dest.Previous = (Hl7.Fhir.Model.ResourceReference)Previous.DeepCopy(); } if (Problem != null) { dest.Problem = new List <Hl7.Fhir.Model.ResourceReference>(Problem.DeepCopy()); } if (Investigation != null) { dest.Investigation = new List <Hl7.Fhir.Model.ClinicalImpression.InvestigationComponent>(Investigation.DeepCopy()); } if (ProtocolElement != null) { dest.ProtocolElement = new List <Hl7.Fhir.Model.FhirUri>(ProtocolElement.DeepCopy()); } if (SummaryElement != null) { dest.SummaryElement = (Hl7.Fhir.Model.FhirString)SummaryElement.DeepCopy(); } if (Finding != null) { dest.Finding = new List <Hl7.Fhir.Model.ClinicalImpression.FindingComponent>(Finding.DeepCopy()); } if (PrognosisCodeableConcept != null) { dest.PrognosisCodeableConcept = new List <Hl7.Fhir.Model.CodeableConcept>(PrognosisCodeableConcept.DeepCopy()); } if (PrognosisReference != null) { dest.PrognosisReference = new List <Hl7.Fhir.Model.ResourceReference>(PrognosisReference.DeepCopy()); } if (Action != null) { dest.Action = new List <Hl7.Fhir.Model.ResourceReference>(Action.DeepCopy()); } if (Note != null) { dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy()); } return(dest); }
public void CopyTo(ProtocolElement[] array, int index) { }
// Methods public void Add(ProtocolElement element) { }
public void Remove(ProtocolElement element) { }
public int IndexOf(ProtocolElement element) { }
/// <summary> /// Builds the protocol. /// </summary> /// <param name="customerId"></param> /// <param name="request">The request.</param> /// <returns></returns> private async Task <Protocol> BuildProtocol(int customerId, CreateProtocolRequestDto request) { var protocol = new Protocol { CustomerId = customerId, NameLocalizedStrings = new List <ProtocolString>() { new ProtocolString() { Value = request.Name, Language = careElementContext.DefaultLanguage } }, IsPrivate = request.IsPrivate, Tags = await tagsService.BuildTagsList(customerId, request.Tags), ProtocolElements = new List <ProtocolElement>() }; foreach (var protocolElementDto in request.ProtocolElements) { var protocolElement = new ProtocolElement { Id = protocolElementDto.Id, // Temporary storing client id to build up relationships and dump it before saving to the database ElementId = protocolElementDto.ElementId, Sort = protocolElementDto.Sort, Branches = new List <Branch>(), Alerts = new List <Alert>() }; if (protocolElementDto.Branches != null) { foreach (var branchDto in protocolElementDto.Branches) { if (branchDto.Conditions != null) { var branch = new Branch() { NextProtocolElementId = branchDto.NextProtocolElementId, ThresholdAlertSeverityId = branchDto.ThresholdAlertSeverityId, Conditions = new List <Condition>() }; foreach (var conditionDto in branchDto.Conditions) { var condition = new Condition() { Operand = conditionDto.Operand, Operator = conditionDto.Operator, Value = conditionDto.Value }; branch.Conditions.Add(condition); } protocolElement.Branches.Add(branch); } } } if (protocolElementDto.Alerts != null) { foreach (var alertDto in protocolElementDto.Alerts) { if (alertDto.Conditions != null) { var alert = new Alert() { Conditions = new List <Condition>() }; foreach (var conditionDto in alertDto.Conditions) { var condition = new Condition() { Operand = conditionDto.Operand, Operator = conditionDto.Operator, Value = conditionDto.Value }; alert.Conditions.Add(condition); } alert.AlertSeverityId = alertDto.AlertSeverityId; protocolElement.Alerts.Add(alert); } } } protocol.ProtocolElements.Add(protocolElement); } // Assigning FirstProtocolElement var firstProtocolElement = protocol.ProtocolElements.Single(pe => pe.Id == request.FirstProtocolElementId); firstProtocolElement.IsFirstProtocolElement = true; // Assigning NextProtocolElements and removing client Ids foreach (var protocolElement in protocol.ProtocolElements) { var nextProtocolElementIdForProtocolElement = request.ProtocolElements.Single(pe => pe.Id == protocolElement.Id).NextProtocolElementId; if (nextProtocolElementIdForProtocolElement != null) { protocolElement.NextProtocolElement = protocol.ProtocolElements.Single(pe => pe.Id == nextProtocolElementIdForProtocolElement); } foreach (var branch in protocolElement.Branches.Where(b => b.NextProtocolElementId != null)) { branch.NextProtocolElement = protocol.ProtocolElements.Single(pe => pe.Id == branch.NextProtocolElementId); branch.NextProtocolElementId = null; // Removing client Id } } foreach (var protocolElement in protocol.ProtocolElements) { protocolElement.Id = default(Guid); // Removing client Id } return(protocol); }