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())); } } }
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())); } }
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); } }
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)); }
private string[] GetAllDateFormats(StandardDataType type, VersionNumber version) { return(TsDateFormats.GetAllDateFormats(type, version)); }