public CDSInput() { this.cdsContextField = new CDSContext(); this.vmrInputField = new VMR(); this.cdsResourceField = new List <CDSResource>(); this.templateIdField = new List <CodedIdentifier>(); }
//Searches and returns VMR with given id parameter public VMR GetVMR(int id) { VMR vmrToReturn = null; foreach (var vmr in _vmrs) { if (vmr.id == id) { vmrToReturn = vmr; break; } } return(vmrToReturn); }
public void CreateSingleVMR() { string Company; string Incident = "#case="; string Mail = "#mail="; string AMMail = "#am="; string Locale = "#locale="; string Owner = "#owner="; string Demo = "#demo="; string DateCreated = "#created="; string CustID = "#cust_id=?"; string StopDate = "#stop_date="; string Source = "#source=CSharpConsoleProgram"; string Tag; VMRGetRequests VMRGet = new VMRGetRequests(); ServicePointManager.ServerCertificateValidationCallback = (s, cert, chain, ssl) => true; //Ignores self signed SSL certificate string Resource = "/api/admin/configuration/v1/conference/"; var client = new RestClient("https://nor-pxmn1.atea-gcs.net" + Resource); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("authorization", "Basic " + credentials); //Initializing VMR vmr = new VMR(); vmr.aliases = new List <Alias>(); vmr.service_type = "conference"; //Asking user for input to create a VMR while (true) { Console.WriteLine("\nCompany: "); Company = Console.ReadLine(); Console.WriteLine("\nName of Room: "); vmr.name = Console.ReadLine() + " (" + Company + ")"; Console.WriteLine("\nURI Adress: "); vmr.aliases.Add(new Alias() { alias = Console.ReadLine(), description = "Meeting URI" }); Console.WriteLine("\nCustomer Alias: "); vmr.aliases.Add(new Alias() { alias = VMRGet.FindFreeAlias(), description = "Meeting ID" }); //NB: Have to make some extra logic around entering PIN codes while (true) { Console.WriteLine("\nHost PIN: "); vmr.pin = Console.ReadLine(); if (VerifyNumber(vmr.pin) == true) { break; } else { Console.WriteLine("Invalid PIN !"); } } Console.WriteLine("\nGuest PIN: "); vmr.guest_pin = Console.ReadLine(); vmr.allow_guests = true; break; } //Serializing VMR to json and ignoring null values string JsonVMR = JsonConvert.SerializeObject(vmr, Newtonsoft.Json.Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); request.AddParameter("application/json", JsonVMR, ParameterType.RequestBody); IRestResponse response = client.Execute(request); Console.WriteLine(""); Console.WriteLine("Status Code: " + response.StatusCode); Console.WriteLine("Status Description: " + response.StatusDescription); }
private static void callServiceWithObject() { string clientSystemPatientId = "1234567890"; CDSInput cdsInput = new CDSInput(); II templateId = new II(); templateId.root = "2.16.840.1.113883.3.795.11.1.1"; cdsInput.templateId = new II[] { templateId }; CDSContext cdsContext = new CDSContext(); CD preferredLanguage = new CD(); preferredLanguage.code = "en"; preferredLanguage.codeSystem = "1.2.3"; preferredLanguage.displayName = "English"; cdsContext.cdsInformationRecipientPreferredLanguage = preferredLanguage; cdsInput.cdsContext = cdsContext; VMR vmr = new VMR(); cdsInput.vmrInput = vmr; II vmrTemplateId = new II(); vmrTemplateId.root = "2.16.840.1.113883.3.795.11.1.1"; vmr.templateId = new II[] { vmrTemplateId }; EvaluatedPerson patient = new EvaluatedPerson(); II personTemplateId = new II(); personTemplateId.root = "2.16.840.1.113883.3.795.11.2.1.1"; patient.templateId = new II[] { personTemplateId }; II id = new II(); id.root = "2.16.840.1.113883.3.795.12.100.11"; id.extension = clientSystemPatientId; patient.id = id; EvaluatedPersonDemographics demographics = new EvaluatedPersonDemographics(); TS birthTime = new TS(); birthTime.value = "20110401"; demographics.birthTime = birthTime; CD gender = new CD(); gender.code = "F"; gender.codeSystem = "2.16.840.1.113883.5.1"; demographics.gender = gender; patient.demographics = demographics; vmr.patient = patient; EvaluatedPersonClinicalStatements statements = new EvaluatedPersonClinicalStatements(); patient.clinicalStatements = statements; SubstanceAdministrationEvent statement1 = getSubstanceAdministrationEvent("185", "20110430"); SubstanceAdministrationEvent statement2 = getSubstanceAdministrationEvent("184", "20110523"); SubstanceAdministrationEvent statement3 = getSubstanceAdministrationEvent("183", "20110721"); SubstanceAdministrationEvent statement4 = getSubstanceAdministrationEvent("182", "20110911"); SubstanceAdministrationEvent statement5 = getSubstanceAdministrationEvent("181", "20110912"); statements.substanceAdministrationEvents = new SubstanceAdministrationEvent[] { statement1, statement2, statement3, statement4, statement5 }; CDSOutput response = getResponse(cdsInput); processResponse(response); }
private static void processResponse(CDSOutput response) { XmlSerializer serializer = new XmlSerializer(typeof(CDSOutput)); MemoryStream ms = new MemoryStream(); XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = Encoding.UTF8; settings.Indent = true; settings.IndentChars = " "; settings.ConformanceLevel = ConformanceLevel.Document; XmlWriter writer = XmlTextWriter.Create(ms, settings); serializer.Serialize(writer, response); Console.WriteLine("Raw Output:"); Console.WriteLine(Encoding.UTF8.GetString(ms.ToArray())); ms.Close(); VMR vmr = response.vmrOutput; if (vmr == null) { throw new Exception("vmr was null!"); } EvaluatedPerson patient = vmr.patient; if (patient == null) { throw new Exception("patient wasd null!"); } EvaluatedPersonClinicalStatements statements = patient.clinicalStatements; if (statements == null) { throw new Exception("statments was null!"); } SubstanceAdministrationProposal[] proposals = statements.substanceAdministrationProposals; if (proposals == null || proposals.Length == 0) { throw new Exception("proposals was null or empty!"); } for (int i = 0; i < proposals.Length; i++) { SubstanceAdministrationProposal proposal = proposals[i]; if (proposal == null) { throw new Exception("proposal was null!"); } Console.WriteLine("Substance administration proposal:"); AdministrableSubstance substance = proposal.substance; if (substance == null) { throw new Exception("substance was null!"); } CD substanceCode = substance.substanceCode; if (substanceCode != null) { Console.WriteLine(" proposed substance code: " + substanceCode.code); } IVL_TS proposedTimeInterval = proposal.proposedAdministrationTimeInterval; if (proposedTimeInterval != null) { Console.WriteLine(" proposed administration time: " + proposedTimeInterval.low); } RelatedClinicalStatement[] reasons = proposal.relatedClinicalStatement; if (reasons != null) { for (int c = 0; c < reasons.Length; c++) { RelatedClinicalStatement reason = reasons[c]; ObservationResult result = (ObservationResult)reason.Item; if (result != null) { Console.WriteLine(" proposed reason - focus: " + result.observationFocus.displayName); Console.WriteLine(" proposed reason - value: " + ((CD)result.observationValue.Item).code); Console.WriteLine(" proposed reason - interpretation: " + result.interpretation[0].code); } } } } }
/// <summary> /// Erzeugt eine neue Beschreibung. /// </summary> /// <param name="vmr9">Der zu verwendende Darstellungsfilter.</param> internal PictureParameters( VMR vmr9 ) { // Unmap using (var vmr = vmr9.MarshalToManaged()) { // Attach to interface var mixer = (IVMRMixerControl) vmr.Object; // Current values var values = VMRProcAmpControl.Create( VMRProcAmpControlFlags.Brightness | VMRProcAmpControlFlags.Contrast | VMRProcAmpControlFlags.Hue | VMRProcAmpControlFlags.Saturation ); // Load mixer.GetProcAmpControl( 0, ref values ); // Create Saturation = new ParameterSet( values.Saturation, mixer, VMRProcAmpControlFlags.Saturation ); Brightness = new ParameterSet( values.Brightness, mixer, VMRProcAmpControlFlags.Brightness ); Contrast = new ParameterSet( values.Contrast, mixer, VMRProcAmpControlFlags.Contrast ); Hue = new ParameterSet( values.Hue, mixer, VMRProcAmpControlFlags.Hue ); } }
/// <summary> /// Aktualisiert die Einstellungen. /// </summary> /// <param name="vmr9">Der zu verwendende Darstellungsfilter.</param> internal void Update( VMR vmr9 ) { // Be safe try { // Unmap using (var vmr = vmr9.MarshalToManaged()) { // Attach to interface var mixer = (IVMRMixerControl) vmr.Object; // Current values var values = VMRProcAmpControl.Create( VMRProcAmpControlFlags.Brightness | VMRProcAmpControlFlags.Contrast | VMRProcAmpControlFlags.Hue | VMRProcAmpControlFlags.Saturation ); // Fill values.Brightness = Brightness.Value; values.Saturation = Saturation.Value; values.Contrast = Contrast.Value; values.Hue = Hue.Value; // Send update mixer.SetProcAmpControl( 0, ref values ); } } catch { // Ignore any error } }