예제 #1
0
        private void ValidateDatePattern(string datePattern, FormatContext context)
        {
            StandardDataType standardDataType = StandardDataType.GetByTypeName(context);
            VersionNumber    version          = (context == null ? null : context.GetVersion());

            string[] allowedDateFormats = TsDateFormats.GetAllDateFormats(standardDataType, version);
            if (ArrayContains(allowedDateFormats, datePattern))
            {
                // check if this pattern is missing a timezone
                if (!IsCerx(standardDataType, version) && TsDateFormats.datetimeFormatsRequiringWarning.Contains(datePattern))
                {
                    context.GetModelToXmlResult().AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, System.String.Format("Date format {0} supplied for value of type {1} should also have a timezone (ZZZZZ)"
                                                                                                                              , datePattern, context == null ? "TS" : context.Type), context.GetPropertyPath()));
                }
            }
            else
            {
                // MBR-368: a temporary work-around for producing AB PIN compliant date time renderings
                // with out error messages -- required until the runtime's knowledge of datatypes has been
                // corrected to distinguish between CeRx v3 (ie., V01R03) and CeRx v4 (ie., V01R04)
                if (!SpecificationVersion.IsExactVersion(SpecificationVersion.V01R04_1_AB, version))
                {
                    context.GetModelToXmlResult().AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, System.String.Format("Invalid date format {0} supplied for value of type {1}"
                                                                                                                              , datePattern, context == null ? "TS" : context.Type), context.GetPropertyPath()));
                }
            }
        }
예제 #2
0
 private void ValidateDatePattern(string datePattern, FormatContext context)
 {
     string[] allowedDateFormats = TsDateFormats.GetAllDateFormats(StandardDataType.TS_DATETIME, context.GetVersion());
     if (!ArrayContains(allowedDateFormats, datePattern))
     {
         context.GetModelToXmlResult().AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, System.String.Format("Unknown date format {0} supplied for value of type {1}"
                                                                                                                   , datePattern, context == null ? "TS" : context.Type), context.GetPropertyPath()));
     }
 }
예제 #3
0
        private void ValidateDatePattern(string datePattern, FormatContext context)
        {
            StandardDataType standardDataType = StandardDataType.GetByTypeName(context);
            VersionNumber    version          = (context == null ? null : context.GetVersion());

            string[] allowedDateFormats = TsDateFormats.GetAllDateFormats(standardDataType, version);
            if (!ArrayContains(allowedDateFormats, datePattern))
            {
                Hl7Error hl7Error = new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, System.String.Format("Invalid date format {0} supplied for value of type {1}"
                                                                                                    , datePattern, context == null ? "TS" : context.Type), context.GetPropertyPath());
                context.GetModelToXmlResult().AddHl7Error(hl7Error);
            }
        }
예제 #4
0
 private string[] GetAllDateFormats(ParseContext context)
 {
     // use R020403 as it has no restrictions (and for R2, the acceptable date formats appear to be wide open)
     return(TsDateFormats.GetAllDateFormats(StandardDataType.TS_DATETIME, SpecificationVersion.R02_04_03));
 }
예제 #5
0
 private string[] GetAllDateFormats(StandardDataType type, VersionNumber version)
 {
     return(TsDateFormats.GetAllDateFormats(type, version));
 }