Esempio n. 1
0
 public override bool TryParseValue(string Values)
 {
     this.ValueList = new List <SearchParameterDateTimeValue>();
     foreach (string Value in Values.Split(OrDelimiter))
     {
         var DtoSearchParameterDateTimeValue = new SearchParameterDateTimeValue();
         if (this.Modifier.HasValue && this.Modifier == SearchParameter.SearchModifierCode.Missing)
         {
             bool?IsMissing = DtoSearchParameterDateTimeValue.ParseModifierEqualToMissing(Value);
             if (IsMissing.HasValue)
             {
                 DtoSearchParameterDateTimeValue.IsMissing = IsMissing.Value;
                 ValueList.Add(DtoSearchParameterDateTimeValue);
             }
             else
             {
                 this.InvalidMessage = $"Found the {Hl7.Fhir.Model.SearchParameter.SearchModifierCode.Missing.GetPyroLiteral()} Modifier yet is value was expected to be true or false yet found '{Value}'. ";
                 return(false);
             }
         }
         else
         {
             var DateTimeStirng = DtoSearchParameterDateTimeValue.ParsePrefix(Value);
             FhirDateTimeSupport FhirDateTimeSupport = new FhirDateTimeSupport(DateTimeStirng.Trim());
             if (FhirDateTimeSupport.IsValid)
             {
                 if (FhirDateTimeSupport.Value.HasValue)
                 {
                     DtoSearchParameterDateTimeValue.Value     = FhirDateTimeSupport.Value.Value;
                     DtoSearchParameterDateTimeValue.Precision = FhirDateTimeSupport.Precision;
                     ValueList.Add(DtoSearchParameterDateTimeValue);
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 this.InvalidMessage = $"Unable to parse the provided value of {DateTimeStirng.Trim()} as a FHIR DateTime.";
                 return(false);
             }
         }
     }
     if (ValueList.Count > 1)
     {
         this.HasLogicalOrProperties = true;
     }
     if (this.ValueList.Count == 0)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Esempio n. 2
0
 public override bool TryParseValue(string Values)
 {
     this.ValueList = new List <SearchParameterDateTimeValue>();
     foreach (string Value in Values.Split(OrDelimiter))
     {
         var DtoSearchParameterDateTimeValue = new SearchParameterDateTimeValue();
         if (this.Modifier.HasValue && this.Modifier == SearchParameter.SearchModifierCode.Missing)
         {
             bool?IsMissing = DtoSearchParameterDateTimeValue.ParseModifierEqualToMissing(Value);
             if (IsMissing.HasValue)
             {
                 DtoSearchParameterDateTimeValue.IsMissing = IsMissing.Value;
                 ValueList.Add(DtoSearchParameterDateTimeValue);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             var DateTimeStirng = DtoSearchParameterDateTimeValue.ParsePrefix(Value);
             FhirDateTimeSupport FhirDateTimeSupport = new FhirDateTimeSupport(DateTimeStirng.Trim());
             if (FhirDateTimeSupport.IsValid)
             {
                 if (FhirDateTimeSupport.Value.HasValue)
                 {
                     DtoSearchParameterDateTimeValue.Value     = FhirDateTimeSupport.Value.Value;
                     DtoSearchParameterDateTimeValue.Precision = FhirDateTimeSupport.Precision;
                     ValueList.Add(DtoSearchParameterDateTimeValue);
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 return(false);
             }
         }
     }
     if (ValueList.Count > 1)
     {
         this.HasLogicalOrProperties = true;
     }
     if (this.ValueList.Count == 0)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }