public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as EntryComponent; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Flag != null) { dest.Flag = (Hl7.Fhir.Model.CodeableConcept)Flag.DeepCopy(); } if (DeletedElement != null) { dest.DeletedElement = (Hl7.Fhir.Model.FhirBoolean)DeletedElement.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Item != null) { dest.Item = (Hl7.Fhir.Model.ResourceReference)Item.DeepCopy(); } return(dest); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as ImmunizationRecommendation; 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 (Patient != null) { dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Authority != null) { dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopy(); } if (Recommendation != null) { dest.Recommendation = new List <Hl7.Fhir.Model.ImmunizationRecommendation.RecommendationComponent>(Recommendation.DeepCopy()); } return(dest); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as FamilyMemberHistory; 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(InstantiatesCanonicalElement != null) dest.InstantiatesCanonicalElement = new List<Hl7.Fhir.Model.Canonical>(InstantiatesCanonicalElement.DeepCopy()); if(InstantiatesUriElement != null) dest.InstantiatesUriElement = new List<Hl7.Fhir.Model.FhirUri>(InstantiatesUriElement.DeepCopy()); if(StatusElement != null) dest.StatusElement = (Code<Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus>)StatusElement.DeepCopy(); if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopy(); if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy(); if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy(); if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopy(); if(Sex != null) dest.Sex = (Hl7.Fhir.Model.CodeableConcept)Sex.DeepCopy(); if(Born != null) dest.Born = (Hl7.Fhir.Model.Element)Born.DeepCopy(); if(Age != null) dest.Age = (Hl7.Fhir.Model.Element)Age.DeepCopy(); if(EstimatedAgeElement != null) dest.EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)EstimatedAgeElement.DeepCopy(); if(Deceased != null) dest.Deceased = (Hl7.Fhir.Model.Element)Deceased.DeepCopy(); if(ReasonCode != null) dest.ReasonCode = new List<Hl7.Fhir.Model.CodeableConcept>(ReasonCode.DeepCopy()); if(ReasonReference != null) dest.ReasonReference = new List<Hl7.Fhir.Model.ResourceReference>(ReasonReference.DeepCopy()); if(Note != null) dest.Note = new List<Hl7.Fhir.Model.Annotation>(Note.DeepCopy()); if(Condition != null) dest.Condition = new List<Hl7.Fhir.Model.FamilyMemberHistory.ConditionComponent>(Condition.DeepCopy()); return dest; }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as MitigationComponent; if (dest != null) { base.CopyTo(dest); if (Action != null) { dest.Action = (Hl7.Fhir.Model.CodeableConcept)Action.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Author != null) { dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopy(); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
void ConfigureView() { if (Check == null) { Root = null; return; } Root = new RootElement("Details") { new Section() { new StyledStringElement("Check #", Check.Number.ToString()) { TextColor = UIColor.LightGray }, (datePicker = new DateElement("Date", Check.Date)), (payeePicker = new EntryElement("Payee", "", Check.Payee)), (amountPicker = new EntryElement("Amount", "", Check.Amount.ToString()) { KeyboardType = UIKeyboardType.DecimalPad }), (memoPicker = new EntryElement("Memo", "", Check.Memo)), (clearedPicker = new BooleanElement("Cleared?", Check.Cleared)), } }; datePicker.DateSelected += dt => Check.Date = dt.DateValue; payeePicker.EntryEnded = (s, e) => Check.Payee = payeePicker.Value; amountPicker.EntryEnded = (s, e) => Check.Amount = Double.Parse(amountPicker.Value); memoPicker.EntryEnded = (s, e) => Check.Memo = memoPicker.Value; clearedPicker.ValueChanged += (sender, e) => Check.Cleared = clearedPicker.Value; }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as FamilyMemberHistory; if (dest != null) { base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (Patient != null) { dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (NameElement != null) { dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy(); } if (Relationship != null) { dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopy(); } if (GenderElement != null) { dest.GenderElement = (Code <Hl7.Fhir.Model.AdministrativeGender>)GenderElement.DeepCopy(); } if (Born != null) { dest.Born = (Hl7.Fhir.Model.Element)Born.DeepCopy(); } if (Age != null) { dest.Age = (Hl7.Fhir.Model.Element)Age.DeepCopy(); } if (Deceased != null) { dest.Deceased = (Hl7.Fhir.Model.Element)Deceased.DeepCopy(); } if (NoteElement != null) { dest.NoteElement = (Hl7.Fhir.Model.FhirString)NoteElement.DeepCopy(); } if (Condition != null) { dest.Condition = new List <Hl7.Fhir.Model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent>(Condition.DeepCopy()); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public override void ViewDidLoad() { base.ViewDidLoad(); NavigationController.NavigationBar.BarStyle = UIBarStyle.Black; var title = expense == null ? "New Expense" : "Edit Expense"; this.Root = new RootElement(title) { new Section("Expense Details") { (name = new EntryElement("Name", "Expense Name", string.Empty)), (total = new EntryElement("Total", "1.00", string.Empty) { KeyboardType = UIKeyboardType.DecimalPad }), (billable = new CheckboxElement("Billable", true)), new RootElement("Category", categories = new RadioGroup("category", 0)) { new Section() { from category in viewModel.Categories select(Element) new RadioElement(category) } }, (due = new DateElement("Due Date", DateTime.Now)) }, new Section("Notes") { (notes = new EntryElement(string.Empty, "Enter expense notes.", string.Empty)) } }; billable.Value = viewModel.Billable; name.Value = viewModel.Name; total.Value = viewModel.Total; notes.Caption = viewModel.Notes; categories.Selected = viewModel.Categories.IndexOf(viewModel.Category); due.DateValue = viewModel.Due; this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Save, async delegate { viewModel.Category = viewModel.Categories[categories.Selected]; viewModel.Name = name.Value; viewModel.Billable = billable.Value; viewModel.Due = due.DateValue; viewModel.Notes = notes.Caption; viewModel.Total = total.Value; await viewModel.ExecuteSaveExpenseCommand(); if (!viewModel.CanNavigate) { return; } NavigationController.PopToRootViewController(true); }); }
static void Main(string[] args) { Ticket tick1 = new Ticket(1, "09-04-2020", 1, "A", 15); Ticket tick2 = new Ticket(1, "09-04-2020", 1, "A", 16); Ticket tick3 = new Ticket(1, "09-04-2020", 1, "A", 17); JsonSerializerOptions options = new JsonSerializerOptions { WriteIndented = true, IgnoreNullValues = true, IgnoreReadOnlyProperties = true }; //STORE JSON OBJECT var jsonString = JsonSerializer.Serialize(new Ticket[] { tick1, tick2, tick3 }, options); Console.WriteLine(jsonString); File.WriteAllText("data.json", jsonString); //READ AND UPDATE JSON OBJECT string jsonText = File.ReadAllText("data.json"); List <Ticket> tickets = new List <Ticket>(); using (JsonDocument document = JsonDocument.Parse(jsonString)) { JsonElement root = document.RootElement; JsonElement ticketsArrayElement = root; foreach (JsonElement ticket in ticketsArrayElement.EnumerateArray()) { //Make .NET object is values are present in JSON if (ticket.TryGetProperty("Price", out JsonElement PriceElement) && ticket.TryGetProperty("Date", out JsonElement DateElement) && ticket.TryGetProperty("TheaterNumber", out JsonElement TheaterElement) && ticket.TryGetProperty("SeatNumber", out JsonElement SeatElement) && SeatElement.TryGetProperty("Row", out var RowElement) && SeatElement.TryGetProperty("Seat", out var SeatNumElement) ) { int price = PriceElement.GetInt32(); string date = DateElement.GetString(); int theaterNumber = TheaterElement.GetInt32(); string row = RowElement.GetString(); int seat = SeatNumElement.GetInt32(); tickets.Add(new Ticket(price, date, theaterNumber, row, seat)); } } } tickets[0].Date = "DATE HAS BEEN MODIFIED"; jsonText = JsonSerializer.Serialize(tickets, options); File.WriteAllText("data.json", jsonText); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as DetectedIssue; 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 = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopy(); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.ObservationStatus>)StatusElement.DeepCopy(); } if (Category != null) { dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopy(); } if (SeverityElement != null) { dest.SeverityElement = (Code <Hl7.Fhir.Model.DetectedIssue.DetectedIssueSeverity>)SeverityElement.DeepCopy(); } if (Patient != null) { dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Author != null) { dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopy(); } if (Implicated != null) { dest.Implicated = new List <Hl7.Fhir.Model.ResourceReference>(Implicated.DeepCopy()); } if (DetailElement != null) { dest.DetailElement = (Hl7.Fhir.Model.FhirString)DetailElement.DeepCopy(); } if (ReferenceElement != null) { dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)ReferenceElement.DeepCopy(); } if (Mitigation != null) { dest.Mitigation = new List <Hl7.Fhir.Model.DetectedIssue.MitigationComponent>(Mitigation.DeepCopy()); } return(dest); }
void UpdateDatePreference() { if (DateElement.GetSelectedItem() != null) { FilterPreferences.Date = (DateTime)DateElement.GetSelectedItem(); } else { FilterPreferences.Date = null; } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as RiskAssessment; if (dest != null) { base.CopyTo(dest); if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Condition != null) { dest.Condition = (Hl7.Fhir.Model.ResourceReference)Condition.DeepCopy(); } if (Encounter != null) { dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy(); } if (Performer != null) { dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopy(); } if (Identifier != null) { dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopy(); } if (Method != null) { dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopy(); } if (Basis != null) { dest.Basis = new List <Hl7.Fhir.Model.ResourceReference>(Basis.DeepCopy()); } if (Prediction != null) { dest.Prediction = new List <Hl7.Fhir.Model.RiskAssessment.PredictionComponent>(Prediction.DeepCopy()); } if (MitigationElement != null) { dest.MitigationElement = (Hl7.Fhir.Model.FhirString)MitigationElement.DeepCopy(); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
private MetaData GenerateMetaData() { CreatorElement creator = new CreatorElement(); creator.Text = "Charles Petzold"; IdentifierElement identifier = new IdentifierElement(); identifier.Identifier = "urn:isbn:9780735656680"; TitleElement title = new TitleElement(); //title.Text = "Microsoft XNA Framework Edition: Programming Windows Phone 7"; title.Text = doc.Name; RightsElement rights = new RightsElement(); rights.Text = "Copyright © 2010"; PublisherElement publisher = new PublisherElement(); publisher.Text = "Microsoft Press"; SubjectElement subject = new SubjectElement(); subject.Text = "COMPUTERS / Programming / Microsoft Programming"; DateElement date = new DateElement(); date.Text = "2010-12-15"; DescriptionElement description = new DescriptionElement(); description.Text = "<p>Focusing on XNA and the C# language, you&#8217;ll learn how to extend your existing skills to the Windows Phone 7 platform&#8212;mastering the core tools and techniques for creating your own games for the phone.</p>"; LanguageElement language = new LanguageElement(); language.Text = "en"; MetaData meta = new MetaData() { Identifier = identifier, Title = title, Rights = rights, Publisher = publisher, Subject = subject, Date = date, Description = description, Creator = creator, Language = language }; return(meta); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as SupplyRequest; if (dest != null) { base.CopyTo(dest); if (Patient != null) { dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy(); } if (Source != null) { dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Identifier != null) { dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopy(); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.SupplyRequest.SupplyRequestStatus>)StatusElement.DeepCopy(); } if (Kind != null) { dest.Kind = (Hl7.Fhir.Model.CodeableConcept)Kind.DeepCopy(); } if (OrderedItem != null) { dest.OrderedItem = (Hl7.Fhir.Model.ResourceReference)OrderedItem.DeepCopy(); } if (Supplier != null) { dest.Supplier = new List <Hl7.Fhir.Model.ResourceReference>(Supplier.DeepCopy()); } if (Reason != null) { dest.Reason = (Hl7.Fhir.Model.Element)Reason.DeepCopy(); } if (When != null) { dest.When = (Hl7.Fhir.Model.SupplyRequest.WhenComponent)When.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 DetailsComponent; 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 = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopy(); } if (Predecessor != null) { dest.Predecessor = (Hl7.Fhir.Model.Identifier)Predecessor.DeepCopy(); } if (Type != null) { dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy(); } if (Request != null) { dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopy(); } if (Submitter != null) { dest.Submitter = (Hl7.Fhir.Model.ResourceReference)Submitter.DeepCopy(); } if (Response != null) { dest.Response = (Hl7.Fhir.Model.ResourceReference)Response.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopy(); } if (Responsible != null) { dest.Responsible = (Hl7.Fhir.Model.ResourceReference)Responsible.DeepCopy(); } if (Payee != null) { dest.Payee = (Hl7.Fhir.Model.ResourceReference)Payee.DeepCopy(); } if (Amount != null) { dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopy(); } return(dest); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as List; if (dest != null) { base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (Code != null) { dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy(); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (Source != null) { dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (OrderedElement != null) { dest.OrderedElement = (Hl7.Fhir.Model.FhirBoolean)OrderedElement.DeepCopy(); } if (ModeElement != null) { dest.ModeElement = (Code <Hl7.Fhir.Model.List.ListMode>)ModeElement.DeepCopy(); } if (Entry != null) { dest.Entry = new List <Hl7.Fhir.Model.List.ListEntryComponent>(Entry.DeepCopy()); } if (EmptyReason != null) { dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.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 Order; if (dest != null) { base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (Source != null) { dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopy(); } if (Target != null) { dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopy(); } if (Reason != null) { dest.Reason = (Hl7.Fhir.Model.Element)Reason.DeepCopy(); } if (Authority != null) { dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopy(); } if (When != null) { dest.When = (Hl7.Fhir.Model.Order.OrderWhenComponent)When.DeepCopy(); } if (Detail != null) { dest.Detail = new List <Hl7.Fhir.Model.ResourceReference>(Detail.DeepCopy()); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
void InitialiseDatePicker() { Dictionary <string, object> DateItems = new Dictionary <string, object>() { { "All time", null }, { "Today", DateTime.Now }, { "Yesterday", DateTime.Now.AddDays(-1) }, { "2 day ago", DateTime.Now.AddDays(-2) }, { "3 days ago", DateTime.Now.AddDays(-3) }, { "4 days ago", DateTime.Now.AddDays(-4) } }; DateElement.InitialisePicker(DateItems); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as RecommendationComponent; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (VaccineCode != null) { dest.VaccineCode = (Hl7.Fhir.Model.CodeableConcept)VaccineCode.DeepCopy(); } if (TargetDisease != null) { dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)TargetDisease.DeepCopy(); } if (DoseNumberElement != null) { dest.DoseNumberElement = (Hl7.Fhir.Model.PositiveInt)DoseNumberElement.DeepCopy(); } if (ForecastStatus != null) { dest.ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)ForecastStatus.DeepCopy(); } if (DateCriterion != null) { dest.DateCriterion = new List <Hl7.Fhir.Model.ImmunizationRecommendation.DateCriterionComponent>(DateCriterion.DeepCopy()); } if (Protocol != null) { dest.Protocol = (Hl7.Fhir.Model.ImmunizationRecommendation.ProtocolComponent)Protocol.DeepCopy(); } if (SupportingImmunization != null) { dest.SupportingImmunization = new List <Hl7.Fhir.Model.ResourceReference>(SupportingImmunization.DeepCopy()); } if (SupportingPatientInformation != null) { dest.SupportingPatientInformation = new List <Hl7.Fhir.Model.ResourceReference>(SupportingPatientInformation.DeepCopy()); } return(dest); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as OrderResponse; if (dest != null) { base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (Request != null) { dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Who != null) { dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopy(); } if (Authority != null) { dest.Authority = (Hl7.Fhir.Model.Element)Authority.DeepCopy(); } if (OrderStatus_Element != null) { dest.OrderStatus_Element = (Code <Hl7.Fhir.Model.OrderResponse.OrderStatus>)OrderStatus_Element.DeepCopy(); } if (DescriptionElement != null) { dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy(); } if (Fulfillment != null) { dest.Fulfillment = new List <Hl7.Fhir.Model.ResourceReference>(Fulfillment.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 Questionnaire; if (dest != null) { base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (VersionElement != null) { dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopy(); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.Questionnaire.QuestionnaireStatus>)StatusElement.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (PublisherElement != null) { dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopy(); } if (Telecom != null) { dest.Telecom = new List <Hl7.Fhir.Model.ContactPoint>(Telecom.DeepCopy()); } if (SubjectTypeElement != null) { dest.SubjectTypeElement = new List <Code <Hl7.Fhir.Model.ResourceType> >(SubjectTypeElement.DeepCopy()); } if (Group != null) { dest.Group = (Hl7.Fhir.Model.Questionnaire.GroupComponent)Group.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 AdverseReaction; if (dest != null) { base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (DidNotOccurFlagElement != null) { dest.DidNotOccurFlagElement = (Hl7.Fhir.Model.FhirBoolean)DidNotOccurFlagElement.DeepCopy(); } if (Recorder != null) { dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopy(); } if (Symptom != null) { dest.Symptom = new List <Hl7.Fhir.Model.AdverseReaction.AdverseReactionSymptomComponent>(Symptom.DeepCopy()); } if (Exposure != null) { dest.Exposure = new List <Hl7.Fhir.Model.AdverseReaction.AdverseReactionExposureComponent>(Exposure.DeepCopy()); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (Request != null) { result.AddRange(Request.Validate()); } if (DateElement != null) { result.AddRange(DateElement.Validate()); } if (Who != null) { result.AddRange(Who.Validate()); } if (Authority != null) { result.AddRange(Authority.Validate()); } if (Cost != null) { result.AddRange(Cost.Validate()); } if (CodeElement != null) { result.AddRange(CodeElement.Validate()); } if (DescriptionElement != null) { result.AddRange(DescriptionElement.Validate()); } if (Fulfillment != null) { Fulfillment.ForEach(elem => result.AddRange(elem.Validate())); } return(result); }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (DateElement != null) { result.AddRange(DateElement.Validate()); } if (Subject != null) { result.AddRange(Subject.Validate()); } if (Source != null) { result.AddRange(Source.Validate()); } if (Target != null) { result.AddRange(Target.Validate()); } if (ReasonElement != null) { result.AddRange(ReasonElement.Validate()); } if (Authority != null) { result.AddRange(Authority.Validate()); } if (When != null) { result.AddRange(When.Validate()); } if (Detail != null) { Detail.ForEach(elem => result.AddRange(elem.Validate())); } return(result); }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (DateElement != null) { result.AddRange(DateElement.Validate()); } if (Detail != null) { result.AddRange(Detail.Validate()); } if (ReportedElement != null) { result.AddRange(ReportedElement.Validate()); } return(result); }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (StatusElement != null) { result.AddRange(StatusElement.Validate()); } if (DateElement != null) { result.AddRange(DateElement.Validate()); } if (Actor != null) { result.AddRange(Actor.Validate()); } return(result); }
private void CreateRoot() { _firstName = new EntryElement("First Name", "First Name", ""); _lastName = _firstName = new EntryElement("First Name", "First Name", ""); _email = new EntryElement("Email", "Email", "") { KeyboardType = UIKeyboardType.EmailAddress }; _date = new DateElement("Event Date", DateTime.Now); _typeOfShoot = new RootElement("Type of Shoot", new RadioGroup(0)) { new Section() { new RadioElement("Wedding"), new RadioElement("Portrait"), new RadioElement("Boudoir"), new RadioElement("Other") } }; _message = new EntryElement("Message", "Message", ""); _root = new RootElement("Book a Session") { new Section() { _firstName, _lastName, _email, _date, _typeOfShoot, _message }, new Section() { new StringElement("Message", delegate { //BookASession.SendMessage(_firstName.Value, _lastName.Value, ...) }) } }; }
public long WriteElement(FileStream writer) { MasterElement segmentInfoElement = MatroskaDocTypes.Info.GetInstance(); StringElement writingAppElement = MatroskaDocTypes.WritingApp.GetInstance(); writingAppElement.Value = "Matroska File Writer v1.0 C#"; StringElement muxingAppElement = MatroskaDocTypes.MuxingApp.GetInstance(); muxingAppElement.Value = ".NET EBML v1.0"; DateElement dateElement = MatroskaDocTypes.DateUTC.GetInstance(); dateElement.Date = SegmentDate; UnsignedIntegerElement timecodeScaleElement = MatroskaDocTypes.TimecodeScale.GetInstance(); timecodeScaleElement.Value = TimecodeScale; segmentInfoElement.AddChildElement(dateElement); segmentInfoElement.AddChildElement(timecodeScaleElement); if (Duration != null) { FloatElement durationElement = MatroskaDocTypes.Duration.GetInstance(); durationElement.Value = (double)Duration; segmentInfoElement.AddChildElement(durationElement); } segmentInfoElement.AddChildElement(writingAppElement); segmentInfoElement.AddChildElement(muxingAppElement); ulong len = segmentInfoElement.WriteElement(writer); VoidElement spacer = new VoidElement((ulong)BLOCK_SIZE - len); spacer.WriteElement(writer); return(1); }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (Code != null) { result.AddRange(Code.Validate()); } if (Source != null) { result.AddRange(Source.Validate()); } if (DateElement != null) { result.AddRange(DateElement.Validate()); } if (OrderedElement != null) { result.AddRange(OrderedElement.Validate()); } if (ModeElement != null) { result.AddRange(ModeElement.Validate()); } if (Entry != null) { Entry.ForEach(elem => result.AddRange(elem.Validate())); } if (EmptyReason != null) { result.AddRange(EmptyReason.Validate()); } return(result); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as List; 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.List.ListStatus>)StatusElement.DeepCopy(); } if (ModeElement != null) { dest.ModeElement = (Code <Hl7.Fhir.Model.ListMode>)ModeElement.DeepCopy(); } if (TitleElement != null) { dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopy(); } if (Code != null) { dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy(); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (Encounter != null) { dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Source != null) { dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopy(); } if (OrderedBy != null) { dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopy(); } if (Note != null) { dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy()); } if (Entry != null) { dest.Entry = new List <Hl7.Fhir.Model.List.EntryComponent>(Entry.DeepCopy()); } if (EmptyReason != null) { dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopy(); } return(dest); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as ReferralRequest; if (dest != null) { base.CopyTo(dest); if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.ReferralRequest.ReferralStatus>)StatusElement.DeepCopy(); } if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Type != null) { dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy(); } if (Specialty != null) { dest.Specialty = (Hl7.Fhir.Model.CodeableConcept)Specialty.DeepCopy(); } if (Priority != null) { dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopy(); } if (Patient != null) { dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy(); } if (Requester != null) { dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopy(); } if (Recipient != null) { dest.Recipient = new List <Hl7.Fhir.Model.ResourceReference>(Recipient.DeepCopy()); } if (Encounter != null) { dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy(); } if (DateSentElement != null) { dest.DateSentElement = (Hl7.Fhir.Model.FhirDateTime)DateSentElement.DeepCopy(); } if (Reason != null) { dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopy(); } if (DescriptionElement != null) { dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy(); } if (ServiceRequested != null) { dest.ServiceRequested = new List <Hl7.Fhir.Model.CodeableConcept>(ServiceRequested.DeepCopy()); } if (SupportingInformation != null) { dest.SupportingInformation = new List <Hl7.Fhir.Model.ResourceReference>(SupportingInformation.DeepCopy()); } if (FulfillmentTime != null) { dest.FulfillmentTime = (Hl7.Fhir.Model.Period)FulfillmentTime.DeepCopy(); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
private static int CompareElementsByTop( DateElement a, DateElement b ) { return a.PlacementRectangle.Top.CompareTo( b.PlacementRectangle.Top ); }
private static int CompareElementsByLeft( DateElement a, DateElement b ) { return a.PlacementRectangle.Left.CompareTo( b.PlacementRectangle.Left ); }
void Populate(object callbacks, object o, RootElement root) { MemberInfo last_radio_index = null; var members = o.GetType().GetMembers(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); Section section = null; foreach (var mi in members) { Type mType = GetTypeForMember(mi); if (mType == null) continue; string caption = null; object[] attrs = mi.GetCustomAttributes(false); bool skip = false; foreach (var attr in attrs) { if (attr is SkipAttribute) skip = true; if (attr is CaptionAttribute) caption = ((CaptionAttribute)attr).Caption; else if (attr is SectionAttribute) { if (section != null) root.Add(section); var sa = attr as SectionAttribute; section = new Section(sa.Caption, sa.Footer); } } if (skip) continue; if (caption == null) caption = MakeCaption(mi.Name); if (section == null) section = new Section(); Element element = null; if (mType == typeof(string)) { PasswordAttribute pa = null; AlignmentAttribute align = null; EntryAttribute ea = null; object html = null; EventHandler invoke = null; bool multi = false; foreach (object attr in attrs) { if (attr is PasswordAttribute) pa = attr as PasswordAttribute; else if (attr is EntryAttribute) ea = attr as EntryAttribute; else if (attr is MultilineAttribute) multi = true; else if (attr is HtmlAttribute) html = attr; else if (attr is AlignmentAttribute) align = attr as AlignmentAttribute; if (attr is OnTapAttribute) { string mname = ((OnTapAttribute)attr).Method; if (callbacks == null) { throw new Exception("Your class contains [OnTap] attributes, but you passed a null object for `context' in the constructor"); } var method = callbacks.GetType().GetMethod(mname); if (method == null) throw new Exception("Did not find method " + mname); invoke = delegate { method.Invoke(method.IsStatic ? null : callbacks, new object[0]); }; } } string value = (string)GetValue(mi, o); if (pa != null) element = new EntryElement(caption, value) { Hint = pa.Placeholder, Password = true }; else if (ea != null) element = new EntryElement(caption, value) { Hint = ea.Placeholder }; else if (multi) element = new MultilineEntryElement(caption, value); else if (html != null) element = new HtmlElement(caption, value); else { var selement = new StringElement(caption, value); element = selement; if (align != null) selement.Alignment = align.Alignment; } if (invoke != null) ((StringElement)element).Click = invoke; } else if (mType == typeof(float)) { var floatElement = new FloatElement(null, null, (int)GetValue(mi, o)); floatElement.Caption = caption; element = floatElement; foreach (object attr in attrs) { if (attr is RangeAttribute) { var ra = attr as RangeAttribute; floatElement.MinValue = ra.Low; floatElement.MaxValue = ra.High; floatElement.ShowCaption = ra.ShowCaption; } } } else if (mType == typeof(bool)) { bool checkbox = false; foreach (object attr in attrs) { if (attr is CheckboxAttribute) checkbox = true; } if (checkbox) element = new CheckboxElement(caption, value: (bool)GetValue(mi, o)); else element = new BooleanElement(caption, (bool)GetValue(mi, o)); } else if (mType == typeof(DateTime)) { var dateTime = (DateTime)GetValue(mi, o); bool asDate = false, asTime = false; foreach (object attr in attrs) { if (attr is DateAttribute) asDate = true; else if (attr is TimeAttribute) asTime = true; } if (asDate) element = new DateElement(caption, dateTime); else if (asTime) element = new TimeElement(caption, dateTime); else element = new DateTimeElement(caption, dateTime); } else if (mType.IsEnum) { var csection = new Section(); ulong evalue = Convert.ToUInt64(GetValue(mi, o), null); int idx = 0; int selected = 0; foreach (var fi in mType.GetFields(BindingFlags.Public | BindingFlags.Static)) { ulong v = Convert.ToUInt64(GetValue(fi, null)); if (v == evalue) selected = idx; csection.Add(new RadioElement(MakeCaption(fi.Name))); idx++; } element = new RootElement(caption, new RadioGroup(null, selected)) { csection }; } else if (mType == typeof(ImageView)) { element = new ImageElement((ImageView)GetValue(mi, o)); } else if (typeof(System.Collections.IEnumerable).IsAssignableFrom(mType)) { var csection = new Section(); int count = 0; if (last_radio_index == null) throw new Exception("IEnumerable found, but no previous int found"); foreach (var e in (IEnumerable)GetValue(mi, o)) { csection.Add(new RadioElement(e.ToString())); count++; } int selected = (int)GetValue(last_radio_index, o); if (selected >= count || selected < 0) selected = 0; element = new RootElement(caption, new MemberRadioGroup(null, selected, last_radio_index)) { csection }; last_radio_index = null; } else if (typeof(int) == mType) { foreach (object attr in attrs) { if (attr is RadioSelectionAttribute) { last_radio_index = mi; break; } } } else { var nested = GetValue(mi, o); if (nested != null) { var newRoot = new RootElement(caption); Populate(callbacks, nested, newRoot); element = newRoot; } } if (element == null) continue; section.Add(element); mappings[element] = new MemberAndInstance(mi, o); } root.Add(section); }