/// <summary> /// Validate File /// </summary> /// <param name="validationType">Is batch / Default / custom</param> /// <param name="applicationFiles">Application files</param> /// <param name="transferManager">File transfer manager</param> /// <returns></returns> public IValidationPlugin GetValidationAdptor(ValidationType validationType, ApplicationFile[] applicationFiles, FileTransferManager transferManager) { IValidationPlugin validationAdaptor = null; try { switch (validationType) { case ValidationType.Default: validationAdaptor = new DefaultValidation(transferManager, applicationFiles.Select(T => T.Mask).ToList()); break; case ValidationType.Batch: var validateFileInfos = (from appFile in applicationFiles select new ValidationFileInfo(appFile.IsRequired, appFile.Mask)).ToList(); /// validationAdaptor = new BatchValidation(transferManager, validateFileInfos); break; case ValidationType.Custom: throw new NotSupportedException("Functionality for custom validation not supported."); default: throw new InvalidOperationException("Invalid Validation type found."); } } catch (Exception ex) { throw ex; } return(validationAdaptor); }
public OSU_O51(OMG_O19 message) : base(new CustomModelClassFactory()) { add(typeof(MSH), true, false); add(typeof(PID), true, false); add(typeof(ORC), true, false); AddStructure("MSH"); AddStructure("PID"); AddStructure("ORC"); ValidationContext = new DefaultValidation(); MSH = new MSH(this, new DefaultModelClassFactory()); MSH.SendingFacility.UniversalID.Value = message.MSH.ReceivingFacility.UniversalID.Value; MSH.SendingFacility.NamespaceID.Value = message.MSH.ReceivingFacility.NamespaceID.Value; MSH.SendingFacility.UniversalIDType.Value = message.MSH.ReceivingFacility.UniversalIDType.Value; MSH.ReceivingFacility.UniversalID.Value = message.MSH.SendingFacility.UniversalID.Value; MSH.ReceivingFacility.NamespaceID.Value = message.MSH.SendingFacility.NamespaceID.Value; MSH.ReceivingFacility.UniversalIDType.Value = message.MSH.SendingFacility.UniversalIDType.Value; MSH.FieldSeparator.Value = message.MSH.FieldSeparator.Value; MSH.EncodingCharacters.Value = message.MSH.EncodingCharacters.Value; MSH.MessageType.MessageStructure.Value = "OSU_O51"; MSH.MessageType.MessageCode.Value = "OSU"; MSH.MessageType.TriggerEvent.Value = "O51"; MSH.MessageControlID.Value = Guid.NewGuid().ToString("N"); MSH.ProcessingID.ProcessingID.Value = "P"; MSH.VersionID.VersionID.Value = "2.5.1"; var profileId = MSH.AddMessageProfileIdentifier(); profileId.NamespaceID.Value = "360x"; var result = MSH.GetMessageProfileIdentifier(0); MSH.AcceptAcknowledgmentType.Value = "NE"; MSH.ApplicationAcknowledgmentType.Value = "NE"; PID = message.PATIENT.PID; //PID.AdministrativeSex.Value = message.PATIENT.PID.AdministrativeSex.Value; //PID.BirthOrder.Value = message.PATIENT.PID.BirthOrder.Value; //PID.BirthPlace.Value = message.PATIENT.PID.BirthPlace.Value; ORC = new ORC(this, new DefaultModelClassFactory()); ORC.PlacerOrderNumber.NamespaceID.Value = Guid.NewGuid().ToString(); ORC.PlacerOrderNumber.UniversalIDType.Value = "ISO"; }
/// <param name="theFactory">custom factory to use for model class lookup. /// </param> public ParserBase(IModelClassFactory theFactory) { Factory = theFactory; ValidationContext = new DefaultValidation(); }
public static MethodInfo GetValidationMethod(DefaultValidation validation) { switch (validation) { case DefaultValidation.NONE: return(null); case DefaultValidation.AT_LEAST_ONE_GAME_OBJECT: return(typeof(ValidationUtilities).GetMethod("AtLeastOneGameObject")); case DefaultValidation.AT_LEAST_TWO_GAME_OBJECTS: return(typeof(ValidationUtilities).GetMethod("AtLeastTwoGameObjects")); case DefaultValidation.AT_LEAST_ONE_OBJECT: return(typeof(ValidationUtilities).GetMethod("AtLeastOneObject")); case DefaultValidation.AT_LEAST_TWO_OBJECTS: return(typeof(ValidationUtilities).GetMethod("AtLeastTwoObjects")); case DefaultValidation.AT_LEAST_ONE_TRANSFORM: return(typeof(ValidationUtilities).GetMethod("AtLeastOneTransform")); case DefaultValidation.AT_LEAST_TWO_TRANSFORMS: return(typeof(ValidationUtilities).GetMethod("AtLeastTwoTransforms")); case DefaultValidation.IN_PLAY_MODE: return(typeof(ValidationUtilities).GetMethod("InPlayMode")); case DefaultValidation.IN_EDIT_MODE: return(typeof(ValidationUtilities).GetMethod("InEditMode")); case DefaultValidation.IN_PLAY_MODE_AT_LEAST_ONE_GAME_OBJECT: return(typeof(ValidationUtilities).GetMethod("InPlayModeAtLeastOneGameObject")); case DefaultValidation.IN_PLAY_MODE_AT_LEAST_TWO_GAME_OBJECTS: return(typeof(ValidationUtilities).GetMethod("InPlayModeAtLeastTwoGameObjects")); case DefaultValidation.IN_PLAY_MODE_AT_LEAST_ONE_OBJECT: return(typeof(ValidationUtilities).GetMethod("InPlayModeAtLeastOneObject")); case DefaultValidation.IN_PLAY_MODE_AT_LEAST_TWO_OBJECTS: return(typeof(ValidationUtilities).GetMethod("InPlayModeAtLeastTwoObjects")); case DefaultValidation.IN_PLAY_MODE_AT_LEAST_ONE_TRANSFORM: return(typeof(ValidationUtilities).GetMethod("InPlayModeAtLeastOneTransform")); case DefaultValidation.IN_PLAY_MODE_AT_LEAST_TWO_TRANSFORMS: return(typeof(ValidationUtilities).GetMethod("InPlayModeAtLeastTwoTransforms")); case DefaultValidation.IN_EDIT_MODE_AT_LEAST_ONE_GAME_OBJECT: return(typeof(ValidationUtilities).GetMethod("InEditModeAtLeastOneGameObject")); case DefaultValidation.IN_EDIT_MODE_AT_LEAST_TWO_GAME_OBJECTS: return(typeof(ValidationUtilities).GetMethod("InEditModeAtLeastTwoGameObjects")); case DefaultValidation.IN_EDIT_MODE_AT_LEAST_ONE_OBJECT: return(typeof(ValidationUtilities).GetMethod("InEditModeAtLeastOneObject")); case DefaultValidation.IN_EDIT_MODE_AT_LEAST_TWO_OBJECTS: return(typeof(ValidationUtilities).GetMethod("InEditModeAtLeastTwoObjects")); case DefaultValidation.IN_EDIT_MODE_AT_LEAST_ONE_TRANSFORM: return(typeof(ValidationUtilities).GetMethod("InEditModeAtLeastOneTransform")); case DefaultValidation.IN_EDIT_MODE_AT_LEAST_TWO_TRANSFORMS: return(typeof(ValidationUtilities).GetMethod("InEditModeAtLeastTwoTransforms")); case DefaultValidation.AT_LEAST_ONE_ASSET: return(typeof(ValidationUtilities).GetMethod("AtLeastOneAsset")); case DefaultValidation.AT_LEAST_ONE_SCENE_OBJECT: return(typeof(ValidationUtilities).GetMethod("AtLeastOneSceneObject")); case DefaultValidation.AT_LEAST_ONE_FOLDER: return(typeof(ValidationUtilities).GetMethod("AtLeastOneFolder")); default: throw new ArgumentOutOfRangeException("validation", validation, null); } }