コード例 #1
0
        /// <summary>
        /// Ctor - organization validator
        /// </summary>
        /// <param name="model">Organization model</param>
        /// <param name="codeService">Code service</param>
        /// <param name="organizationService">Organization service</param>
        /// <param name="commonService">Common service</param>
        /// <param name="newLanguages">Languages that should be validated within lists</param>
        /// <param name="availableLanguages">The languages that are available in main model and therefore need to be validated.</param>
        /// <param name="isCreateOperation">Indicates if organization is beeing inserted or updated.</param>
        /// <param name="versionNumber">Version number.</param>
        public OrganizationValidator(IVmOpenApiOrganizationInVersionBase model, ICodeService codeService, IOrganizationService organizationService, IList <string> newLanguages, IList <string> availableLanguages, ICommonService commonService, int versionNumber, bool isCreateOperation = false)
            : base(model, "Organization")
        {
            this.codeService = codeService;

            if (model == null)
            {
                throw new ArgumentNullException(PropertyName, $"{PropertyName} must be defined.");
            }

            name = new LocalizedListValidator(model.OrganizationNames, "OrganizationNames", newLanguages, new List <string>()
            {
                NameTypeEnum.Name.ToString()
            });
            municipality   = new MunicipalityCodeValidator(model.Municipality, codeService);
            addresses      = new AddressListValidator <V7VmOpenApiAddressWithForeignIn>(model.Addresses, codeService);
            organizationId = new OrganizationIdValidator(model.ParentOrganizationId, commonService, "ParentOrganizationId");
            oid            = new OidValidator(model.Oid, organizationService, isCreateOperation: isCreateOperation, organizationId: model.Id, sourceId: model.SourceId);
            phones         = new PhoneNumberListValidator <V4VmOpenApiPhone>(model.PhoneNumbers, codeService);
            status         = new PublishingStatusValidator(model.PublishingStatus, model.CurrentPublishingStatus);
            description    = new LocalizedListValidator(model.OrganizationDescriptions, "OrganizationDescriptions", newLanguages, new List <string>()
            {
                DescriptionTypeEnum.ShortDescription.ToString()
            }, availableLanguages);
            this.versionNumber = versionNumber;
        }
コード例 #2
0
 /// <summary>
 /// Ctor - service location channel validator
 /// </summary>
 /// <param name="model">service location channel model</param>
 /// <param name="commonService">Common service</param>
 /// <param name="codeService">Code service</param>
 /// <param name="serviceService">Service service</param>
 public ServiceLocationChannelValidator(VmOpenApiServiceLocationChannelInVersionBase model, ICommonService commonService, ICodeService codeService, IServiceService serviceService) :
     base(model, "ServiceLocationChannel", commonService, codeService, serviceService)
 {
     phones     = new PhoneNumberListValidator <V4VmOpenApiPhone>(model.PhoneNumbers, codeService);
     faxNumbers = new PhoneNumberListValidator <V4VmOpenApiPhoneSimple>(model.FaxNumbers, codeService, "FaxNumbers");
     addresses  = new AddressListValidator <V7VmOpenApiAddressWithMovingIn>(model.Addresses, codeService);
 }