本文整理汇总了C#中Hl7.Fhir.Model.List.Add方法的典型用法代码示例。如果您正苦于以下问题:C# List.Add方法的具体用法?C# List.Add怎么用?C# List.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hl7.Fhir.Model.List
的用法示例。
在下文中一共展示了List.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessEncounters
private static void ProcessEncounters(List<TimelineEntry> timeline, Bundle matchingEncounters)
{
foreach (var encounter in matchingEncounters.Entries.Select(x => (ResourceEntry<Encounter>)x))
{
DateTimeOffset? startTime;
DateTimeOffset? endTime;
if (encounter.Resource.Hospitalization != null)
{
startTime = DateTimeOffset.Parse(encounter.Resource.Hospitalization.Period.Start);
endTime = DateTimeOffset.Parse(encounter.Resource.Hospitalization.Period.End);
}
else
{
startTime = encounter.Published;
endTime = encounter.Published;
}
timeline.Add(new TimelineEntry
{
StartTime = startTime,
EndTime = endTime,
TypeOfEntry = TimelineEntryType.Encounter,
Summary = encounter.Resource.Reason.ToString()
});
}
}
示例2: ResourceFilter
internal static IMongoQuery ResourceFilter(string resourceType)
{
var queries = new List<IMongoQuery>();
queries.Add(M.Query.EQ(InternalField.LEVEL, 0));
queries.Add(M.Query.EQ(InternalField.RESOURCE, resourceType));
return M.Query.And(queries);
}
示例3: SetBundleType
public static void SetBundleType(this Bundle bundle, BundleType type)
{
List<Tag> result = new List<Tag>(bundle.Tags.Exclude(new Tag[] { MESSAGE_TAG, DOCUMENT_TAG }));
if (type == BundleType.Document)
result.Add(DOCUMENT_TAG);
else if (type == BundleType.Message)
result.Add(MESSAGE_TAG);
bundle.Tags = result;
}
示例4: Validate
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var result = new List<ValidationResult>();
result.AddRange(base.Validate(validationContext));
if (When == null)
result.Add(new ValidationResult("A DeletedEntry must have a non-null deletion time (When)"));
if (!result.Any()) result.Add(ValidationResult.Success);
return result;
}
示例5: ToExpression
public static Expression ToExpression(this Quantity quantity)
{
quantity = System.Canonical(quantity);
string searchable = quantity.LeftSearchableString();
var values = new List<ValueExpression>();
values.Add(new IndexValue("system", new StringValue(UCUM.Uri.ToString())));
values.Add(new IndexValue("value", new NumberValue(quantity.Value.ToDecimal())));
values.Add(new IndexValue("decimals", new StringValue(searchable)));
values.Add(new IndexValue("unit", new StringValue(quantity.Metric.ToString())));
return new CompositeValue(values);
}
示例6: Validate
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var result = new List<ValidationResult>();
result.AddRange(base.Validate(validationContext));
if (Content == null)
result.Add(new ValidationResult("Entry must contain (possibly 0-length) data in Content element"));
if (ContentType == null)
result.Add(new ValidationResult("Entry must contain a ContentType"));
return result;
}
示例7: Validate
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var result = new List<ValidationResult>(base.Validate(validationContext));
if (this.Contained != null)
{
if (!Contained.OfType<DomainResource>().All(dr => dr.Text == null))
result.Add(new ValidationResult("Resource has contained resources with narrative"));
if(!Contained.OfType<DomainResource>().All(cr => cr.Contained == null || !cr.Contained.Any()))
result.Add(new ValidationResult("Resource has contained resources with nested contained resources"));
}
return result;
}
示例8: GetAllPatients
public IEnumerable<Patient> GetAllPatients()
{
var patients = new List<Patient>();
var patientsExist = true;
var i = 1;
while (patientsExist)
{
try
{
var patient = _client.Read<Patient>(i.ToString());
patients.Add(patient.Resource);
i++;
}
catch (FhirOperationException)
{
patientsExist = false;
}
}
return patients;
}
示例9: ParseCategoryHeader
public static ICollection<Tag> ParseCategoryHeader(string value)
{
if (String.IsNullOrEmpty(value)) return new List<Tag>();
var result = new List<Tag>();
var categories = value.SplitNotInQuotes(',').Where(s => !String.IsNullOrEmpty(s));
foreach (var category in categories)
{
var values = category.SplitNotInQuotes(';').Where(s => !String.IsNullOrEmpty(s));
if (values.Count() >= 1)
{
var term = values.First();
var pars = values.Skip(1).Select( v =>
{
var vsplit = v.Split('=');
var item1 = vsplit[0].Trim();
var item2 = vsplit.Length > 1 ? vsplit[1].Trim() : null;
return new Tuple<string,string>(item1,item2);
});
var scheme = new Uri(pars.Where(t => t.Item1 == "scheme").Select(t => t.Item2.Trim('\"')).FirstOrDefault(), UriKind.RelativeOrAbsolute);
var label = pars.Where(t => t.Item1 == "label").Select(t => t.Item2.Trim('\"')).FirstOrDefault();
result.Add(new Tag(term,scheme,label));
}
}
return result;
}
示例10: Validate
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var result = new List<ValidationResult>();
if (String.IsNullOrWhiteSpace(Title))
result.Add(new ValidationResult("Feed must contain a title"));
if (!UriHasValue(Id))
result.Add(new ValidationResult("Feed must have an id"));
else
if (!Id.IsAbsoluteUri)
result.Add(new ValidationResult("Feed id must be an absolute URI"));
if (LastUpdated == null)
result.Add(new ValidationResult("Feed must have a updated date"));
if (Links.SearchLink != null)
result.Add(new ValidationResult("Links with rel='search' can only be used on feed entries"));
bool feedHasAuthor = !String.IsNullOrEmpty(this.AuthorName);
if (Entries != null)
{
foreach (var entry in Entries.Where(e => e != null))
{
if (!feedHasAuthor && entry is ResourceEntry && String.IsNullOrEmpty(((ResourceEntry)entry).AuthorName))
result.Add(new ValidationResult("Bundle's author and Entry author cannot both be empty"));
Validator.TryValidateObject(entry, ValidationContextFactory.Create(entry, null), result, true);
}
}
return result;
}
示例11: NonUcumIndexedExpression
public static Expression NonUcumIndexedExpression(this FM.Quantity quantity)
{
var values = new List<ValueExpression>();
if (quantity.System != null)
values.Add(new IndexValue("system", new StringValue(quantity.System)));
if (quantity.Unit != null)
values.Add(new IndexValue("unit", new StringValue(quantity.Unit)));
if (quantity.Value.HasValue)
values.Add(new IndexValue("value", new NumberValue(quantity.Value.Value)));
if (values.Any())
return new CompositeValue(values);
return null;
}
示例12: ParametersToQuery
private IMongoQuery ParametersToQuery(IEnumerable<IParameter> parameters)
{
List<IMongoQuery> queries = new List<IMongoQuery>();
queries.Add(M.Query.EQ(InternalField.LEVEL, 0)); // geindexeerde contained documents overslaan
IEnumerable<IMongoQuery> q = parameters.Select(p => ParameterToQuery(p));
queries.AddRange(q);
return M.Query.And(queries);
}
示例13: genProfile
private void genProfile(List<Row> rows, Profile profile, bool extensionsOnly)
{
if (!extensionsOnly)
{
var r = new Row();
rows.Add(r);
r.setIcon("icon_profile.png");
r.getCells().Add(new Cell(null, null, profile.Name, null, null));
r.getCells().Add(new Cell());
r.getCells().Add(new Cell(null, null, "Profile", null, null));
r.getCells().Add(new Cell(null, null, profile.Description, null, null));
foreach (var s in profile.Structure)
{
var re = new Row();
r.getSubRows().Add(re);
re.setIcon("icon_resource.png");
re.getCells().Add(new Cell(null, null, s.Name, null, null));
re.getCells().Add(new Cell(null, null, "", null, null));
re.getCells().Add(new Cell(null, null, s.Type, null, null));
re.getCells().Add(new Cell(null, null, s.Element[0].Definition.Short, null, null)); // DSTU1
//re.getCells().Add(new Cell(null, null, s.Base, null, null)); // DSTU2
}
}
if (profile.ExtensionDefn.Any() || extensionsOnly)
{
var re = new Row();
rows.Add(re);
re.setIcon("icon_profile.png");
re.getCells().Add(new Cell(null, null, "Extensions", null, null));
re.getCells().Add(new Cell());
re.getCells().Add(new Cell());
re.getCells().Add(new Cell(null, null, "Extensions defined by this profile", null, null)); // DSTU1
//re.getCells().Add(new Cell(null, null, "Extensions defined by the URL \"" + profile.Url + "\"", null, null)); // DSTU2
foreach (var ext in profile.ExtensionDefn)
{
genExtension(re.getSubRows(), ext, true);
}
}
}
示例14: Validate
public virtual IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var result = new List<ValidationResult>();
if (Id != null && !Id.IsAbsoluteUri)
result.Add(FhirValidator.BuildResult(validationContext, "Entry id must be an absolute URI"));
if (Bundle.UriHasValue(SelfLink) && !SelfLink.IsAbsoluteUri)
result.Add(FhirValidator.BuildResult(validationContext, "Entry selflink must be an absolute URI"));
if (Links.FirstLink != null || Links.LastLink != null || Links.PreviousLink != null || Links.NextLink != null)
result.Add(FhirValidator.BuildResult(validationContext, "Paging links can only be used on feeds, not entries"));
if (Tags != null && validationContext.ValidateRecursively())
FhirValidator.TryValidate(Tags,result,true);
return result;
}
示例15: GetMembers
public IEnumerable<Tuple<string, IFhirReader>> GetMembers()
{
if (_current is XElement)
{
var rootElem = (XElement)_current;
var result = new List<Tuple<string, IFhirReader>>();
// First, any attributes
foreach(var attr in rootElem.Attributes()) //.Where(xattr => xattr.Name.LocalName != "xmlns"))
{
if (attr.Name == XName.Get("xmlns", "")) continue; // skip xmlns declarations
if (attr.Name == XName.Get("{http://www.w3.org/2000/xmlns/}xsi") && !SerializationConfig.EnforceNoXsiAttributesOnRoot ) continue; // skip xmlns:xsi declaration
if (attr.Name == XName.Get("{http://www.w3.org/2001/XMLSchema-instance}schemaLocation") && !SerializationConfig.EnforceNoXsiAttributesOnRoot) continue; // skip schemaLocation
if (attr.Name.NamespaceName == "")
result.Add(Tuple.Create(attr.Name.LocalName, (IFhirReader)new XmlDomFhirReader(attr)));
else
throw Error.Format("Encountered unsupported attribute {0}", this, attr.Name);
}
foreach(var node in rootElem.Nodes())
{
if(node is XText)
{
// A nested text node (the content attribute of a Binary)
result.Add(Tuple.Create(SerializationConfig.BINARY_CONTENT_MEMBER_NAME, (IFhirReader)new XmlDomFhirReader(node)));
}
else if(node is XElement)
{
var elem = (XElement)node;
// All normal elements
if(elem.Name.NamespaceName == SerializationUtil.FHIRNS)
result.Add(Tuple.Create(elem.Name.LocalName, (IFhirReader)new XmlDomFhirReader(elem)));
// The special xhtml div element
else if(elem.Name == XHTMLDIV)
result.Add(Tuple.Create(XHTMLDIV.LocalName,
(IFhirReader)new XmlDomFhirReader(buildDivXText(elem))));
else
throw Error.Format("Encountered element '{0}' from unsupported namespace '{1}'", this, elem.Name.LocalName, elem.Name.NamespaceName);
}
else if(node is XComment)
{
// nothing
}
else
throw Error.Format("Encountered unexpected element member of type {0}", this, node.GetType().Name);
}
return result;
}
else
throw Error.Format("Cannot get members: reader not at an element", this);
}