Ejemplo n.º 1
0
 public MortgageController(IMortgageRepository mortgageRepository, IDataService dataService,
                           IValidationHelper validationHelper)
 {
     _mortgageRepository = mortgageRepository;
     _dataService        = dataService;
     _validationHelper   = validationHelper;
 }
Ejemplo n.º 2
0
        public QueueConsumer(IQueueConfiguration queueConfiguration,
                             IQueueConnectionFactory connectionFactory,
                             IJsonSerializer serializer,
                             IValidationHelper validationHelper,
                             string consumerName)
        {
            _queueConfiguration = queueConfiguration ?? throw new ArgumentNullException(nameof(queueConfiguration));
            _connectionFactory  = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));
            _serializer         = serializer ?? throw new ArgumentNullException(nameof(serializer));
            _validationHelper   = validationHelper ?? throw new ArgumentNullException(nameof(validationHelper));

            if (string.IsNullOrEmpty(consumerName))
            {
                throw new ArgumentNullException(nameof(consumerName));
            }

            _consumerName = consumerName;

            // verify that the queue configuration is valid
            if (!queueConfiguration.IsValid)
            {
                throw new ArgumentException("Queue Configuration is not valid", nameof(queueConfiguration));
            }

            // retrieve the specific queues configuration
            _consumerConfig = queueConfiguration.Consumers?.FirstOrDefault(c => c.Name == _consumerName);

            if (_consumerConfig == null)
            {
                throw new ArgumentNullException(nameof(_consumerConfig));
            }

            this._performanceLoggingMethodName = $"{consumerName}.Run";
        }
Ejemplo n.º 3
0
 public BankAccountController(IBankAccountRepository accountRepository, IDataService dataService,
                              IValidationHelper validationHelper)
 {
     _accountRepository = accountRepository;
     _dataService       = dataService;
     _validationHelper  = validationHelper;
 }
Ejemplo n.º 4
0
 public BaseDomainService(IPrincipal principal)
 {
     this._principal        = principal;
     this._dataHelper       = this.CreateDataHelper();
     this._validationHelper = this.CreateValidationHelper();
     this._queryHelper      = this.CreateQueryHelper();
 }
Ejemplo n.º 5
0
 public CreditAccountsController(ICreditCardRepository accountRepository, IDataService dataService,
                                 IValidationHelper validationHelper)
 {
     _accountRepository = accountRepository;
     _dataService       = dataService;
     _validationHelper  = validationHelper;
 }
Ejemplo n.º 6
0
 public ContactController(IMessageRepository messageRepository, IValidationHelper validationHelper,
                          IEmailHelper emailHelper)
 {
     _messageRepository = messageRepository;
     _validationHelper  = validationHelper;
     _emailHelper       = emailHelper;
 }
Ejemplo n.º 7
0
        public QueuePublisher(IQueueConfiguration queueConfiguration,
                              IQueueConnectionFactory connectionFactory,
                              IJsonSerializer serializer,
                              IValidationHelper validationHelper,
                              string publisherName,
                              CancellationToken cancellationToken)
        {
            if (queueConfiguration == null)
            {
                throw new ArgumentNullException(nameof(queueConfiguration));
            }

            _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));
            _publisherName     = publisherName ?? throw new ArgumentNullException(nameof(publisherName));
            _serializer        = serializer ?? throw new ArgumentNullException(nameof(serializer));
            _validationHelper  = validationHelper ?? throw new ArgumentNullException(nameof(validationHelper));
            _cancellationToken = cancellationToken;

            // verify that the queue configuration is valid
            if (!queueConfiguration.IsValid)
            {
                throw new ArgumentException("Queue Configuration is not valid", nameof(queueConfiguration));
            }

            // retrieve the specific queues configuration
            _publisherConfig = queueConfiguration.Publishers?.FirstOrDefault(c => c.Name == _publisherName);

            if (_publisherConfig == null)
            {
                throw new ArgumentNullException(nameof(_publisherConfig));
            }
        }
        public ChangeArtistViewModel(IMvxNavigationService navigationService, IUserDialogs userDialogs, IValidator validator, IArtistService artistService, IBottomNavigationViewModelService bottomNavigationViewModelService, ITopNavigationViewModelService topNavigationViewModelService)
        {
            _navigationService                = navigationService;
            _topNavigationViewModelService    = topNavigationViewModelService;
            _bottomNavigationViewModelService = bottomNavigationViewModelService;

            _userDialogs = userDialogs;

            _validationHelper = new ValidationHelper(validator, this, Errors.Value, (propertyName) => { FocusName.Value = propertyName; });

            _artistService = artistService;

            ValidateNameCommand = new MvxCommand(() => _validationHelper.Validate(() => Name));

            InitValidationCommand = new MvxCommand(() => {
                _validationHelper.ResetValidation();
            });

            ChangeCommand = new MvxCommand(() =>
            {
                if (!IsTaskExecutedValueConverter.Convert(ChangeTask.Value))
                {
                    ChangeTask.Value = NotifyTaskCompletion.Create(AttemptChangeAsync);
                }
            });
        }
 public void Init()
 {
     _helper = this.GetFixture().Create<IValidationHelper>();
     _localization = TestHelper.CreateStubLocalization();
     _sut = new TierFormFieldSheetShouldHaveCorrectFieldFormMapping(_helper, _localization);
     _loader = this.GetFixture().Create<IExcelLoader>();
 }
Ejemplo n.º 10
0
 public void Dispose()
 {
     validation     = null;
     mockApiCalls   = null;
     mockValidation = null;
     consoleActions = null;
 }
Ejemplo n.º 11
0
        public LoginViewModel(IMvxNavigationService navigationService, IAuthService authService, IUserDialogs userDialogs, IValidator validator, IBottomNavigationViewModelService bottomNavigationViewModelService, ITopNavigationViewModelService topNavigationViewModelService)
        {
            _navigationService                = navigationService;
            _topNavigationViewModelService    = topNavigationViewModelService;
            _bottomNavigationViewModelService = bottomNavigationViewModelService;

            _authService = authService;
            _userDialogs = userDialogs;

            _validationHelper = new ValidationHelper(validator, this, Errors.Value, (propertyName) => { FocusName.Value = propertyName; });

            ValidateEmailCommand    = new MvxCommand(() => _validationHelper.Validate(() => Email));
            ValidatePasswordCommand = new MvxCommand(() => _validationHelper.Validate(() => Password));

            InitValidationCommand = new MvxCommand(() => {
                _validationHelper.ResetValidation();
            });

            LogInCommand = new MvxCommand(() =>
            {
                if (!IsTaskExecutedValueConverter.Convert(LogInTask.Value))
                {
                    LogInTask.Value = NotifyTaskCompletion.Create(AttemptLogInAsync);
                }
            });

            ShowRegistrationViewModelCommand = new MvxAsyncCommand(async() =>
            {
                await _navigationService.Navigate <RegistrationViewModel>();
            });
        }
Ejemplo n.º 12
0
 public OverviewController(IBankAccountRepository bankAccountRepository, ICreditCardRepository creditAccountRepository,
                           IValidationHelper validationHelper)
 {
     _bankAccountRepository   = bankAccountRepository;
     _creditAccountRepository = creditAccountRepository;
     _validationHelper        = validationHelper;
 }
Ejemplo n.º 13
0
 public void Setup()
 {
     validation     = new ValidationHelper();
     mockValidation = new Mock <IValidationHelper>();
     mockApiCalls   = new Mock <IAPICalls>();
     consoleActions = new ConsoleActions(mockValidation.Object, mockApiCalls.Object);
 }
Ejemplo n.º 14
0
        public FhirValidationTests()
        {
            var mock = new Mock <IValidationHelper>();

            mock.Setup(op => op.ValidateResource(It.IsAny <Resource>(), It.IsAny <string>())).Returns(OperationOutcomes.Ok);
            //mock.Setup(op => op.ValidReference(It.Is<ResourceReference>(r => r.Reference == "https://directory.spineservices.nhs.uk/STU3/Organization/"), It.IsAny<string>())).Returns(false);
            mock.Setup(op => op.ValidReference(It.IsAny <ResourceReference>(), It.IsAny <string>())).Returns(true);
            mock.Setup(op => op.ValidReferenceParameter(It.IsAny <string>(), It.IsAny <string>())).Returns(true);
            mock.Setup(op => op.ValidCodableConcept(It.Is <CodeableConcept>(q => q.Coding != null && q.Coding.FirstOrDefault() != null && q.Coding.FirstOrDefault().Code == null), It.IsAny <int>(), It.IsAny <string>(), false, true, true, true, It.IsAny <string>())).Returns(false);
            mock.Setup(op => op.ValidCodableConcept(It.Is <CodeableConcept>(q => q.Coding != null && q.Coding.FirstOrDefault() != null && q.Coding.FirstOrDefault().Code != null), It.IsAny <int>(), It.IsAny <string>(), false, true, true, true, It.IsAny <string>())).Returns(true);
            mock.Setup(op => op.ValidCodableConcept(It.Is <CodeableConcept>(q => q.Coding != null && q.Coding.FirstOrDefault() != null && q.Coding.FirstOrDefault().Code != null), It.IsAny <int>(), It.IsAny <string>(), true, true, true, true, It.IsAny <string>())).Returns(true);

            mock.Setup(op => op.ValidNhsNumber(It.Is <string>(q => string.IsNullOrEmpty(q)))).Returns(false);
            mock.Setup(op => op.ValidNhsNumber(It.Is <string>(q => !string.IsNullOrEmpty(q)))).Returns(true);

            mock.Setup(op => op.ValidTokenParameter(It.Is <string>(q => q == "valid|valid"), null, false)).Returns(true);
            mock.Setup(op => op.ValidTokenParameter(It.Is <string>(q => q == "invalid|invalid"), null, false)).Returns(false);
            mock.Setup(op => op.ValidTokenParameter(It.Is <string>(q => q == "https://fhir.nhs.uk/Id/ods-organization-code|test"), It.Is <string>(q => q == "https://fhir.nhs.uk/Id/ods-organization-code"), false)).Returns(true);

            mock.Setup(op => op.ValidIdentifier(It.IsAny <Identifier>(), It.IsAny <string>())).Returns((true, null));
            mock.Setup(op => op.ValidIdentifier(It.Is <Identifier>(i => string.IsNullOrEmpty(i.System)), It.IsAny <string>())).Returns((false, "test"));
            mock.Setup(op => op.ValidIdentifier(It.Is <Identifier>(i => string.IsNullOrEmpty(i.Value)), It.IsAny <string>())).Returns((false, "test"));

            mock.Setup(op => op.GetResourceReferenceId(It.IsAny <ResourceReference>(), It.IsAny <string>())).Returns("resourceRefId");
            mock.Setup(op => op.GetResourceReferenceId(It.Is <ResourceReference>(r => r.Reference == "InvalidAuthorhttps://directory.spineservices.nhs.uk/STU3/Organization/"), It.IsAny <string>())).Returns(delegate { return(null); });
            mock.Setup(op => op.GetResourceReferenceId(It.Is <ResourceReference>(r => r.Reference == "InvalidCustodianhttps://directory.spineservices.nhs.uk/STU3/Organization/"), It.IsAny <string>())).Returns(delegate { return(null); });

            mock.Setup(op => op.GetOrganisationParameterIdentifierId(It.Is <string>(q => q == "https://fhir.nhs.uk/Id/ods-organization-code|test"))).Returns("test");

            mock.Setup(op => op.GetOrganisationParameterId(It.Is <string>(q => q == "https://directory.spineservices.nhs.uk/STU3/Organization/test"))).Returns("test");

            _iValidationHelper = mock.Object;
        }
 public void Init()
 {
     _helper = this.GetFixture().Create<IValidationHelper>();
     _localization = TestHelper.CreateStubLocalization();
     _sut = new TierFormFolderSheetShouldHaveAllFoldersExisting(_helper, _localization);
     _loader = this.GetFixture().Create<IExcelLoader>();
 }
Ejemplo n.º 16
0
 public EditTodoItemViewModel(IMvxNavigationService navigationService, IDialogsHelper dialogsHelper,
                              ICancelDialogService cancelDialogService, IValidationHelper validationHelper, ITodoItemRepository todoItemRepository, ITodoItemService webService)
     : base(navigationService, validationHelper, cancelDialogService, todoItemRepository, dialogsHelper, webService)
 {
     UpdateTodoItemCommand = new MvxAsyncCommand(HandleEntity);
     DeleteTodoItemCommand = new MvxAsyncCommand(DeleteTodoItem);
 }
Ejemplo n.º 17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="httpService"></param>
        /// <param name="deviceRepository"></param>
        public DeviceService(ILogger <DeviceService> logger,
                             IHttpService httpService,
                             IDeviceRepository deviceRepository,
                             IValidationHelper validationHelper,
                             IHubContext <WebHubService> webHubContext,
                             IDeviceHistoryRepository deviceHistoryRepository,
                             INotificationSender notificationSenderExtention)
        {
            _logger = logger ??
                      throw new ArgumentNullException(nameof(logger));
            _httpService = httpService ??
                           throw new ArgumentNullException(nameof(httpService));
            _deviceRepository = deviceRepository ??
                                throw new ArgumentNullException(nameof(deviceRepository));
            _validationHelper = validationHelper ??
                                throw new ArgumentNullException(nameof(validationHelper));
            _webHubContext = webHubContext ??
                             throw new ArgumentNullException(nameof(webHubContext));
            _deviceHistoryRepository = deviceHistoryRepository ??
                                       throw new ArgumentNullException(nameof(deviceHistoryRepository));

            _notificationSenderExtention = notificationSenderExtention ??
                                           throw new ArgumentNullException(nameof(notificationSenderExtention));

            FillSortingRules();
        }
 public TodoItemViewModel(IMvxNavigationService navigationService, IUserStorageHelper storage, ICancelDialogService cancelDialogService,
                          IValidationHelper validationHelper, ITodoItemRepository todoItemRepository, IDialogsHelper dialogsHelper, ITodoItemService todoItemService)
     : base(navigationService, storage, dialogsHelper, cancelDialogService)
 {
     _validationHelper   = validationHelper;
     _todoItemRepository = todoItemRepository;
     _todoItemService    = todoItemService;
 }
Ejemplo n.º 19
0
 public TransactionController(IBankAccountRepository bankAccountRepository, ICreditCardRepository creditAccountRepository,
                              IDataService dataService, IValidationHelper validationHelper)
 {
     _bankAccountRepository   = bankAccountRepository;
     _creditAccountRepository = creditAccountRepository;
     _dataService             = dataService;
     _validationHelper        = validationHelper;
 }
Ejemplo n.º 20
0
 public Uploader(IWebDriver driver, ILoginInfo loginInfo, IErrorHelper errorHelper, IValidationHelper validationHelper, ILogger logger)
 {
     _driver           = driver;
     _loginInfo        = loginInfo;
     _wait             = new WebDriverWait(_driver, TimeSpan.FromSeconds(10));
     _errorHelper      = errorHelper;
     _validationHelper = validationHelper;
     _logger           = logger;
 }
 public BusinessManager(IDataAccess dataAccess, IUserManagement userManagement, IAuthenticationManagement authenticationManagement,
     IValidationHelper validationHelper, IRoleManagement roleManagement)//,IModelFactory modelFactory)
 {
     _dataAccess = dataAccess;
     _userManagement = userManagement;
     _authenticationManagement = authenticationManagement;
     _roleManagement = roleManagement;
     _validationHelper = validationHelper;
 }
Ejemplo n.º 22
0
        public ValidationHelperTests(BaseTest baseTest)
        {
            _baseTest = baseTest ?? throw new ArgumentNullException(nameof(baseTest));
            _baseTest.DbContext.ClearContext();

            _loggerMock          = Mock.Of <ILogger <ValidationHelper> >();
            _httpServiceMock     = new Mock <IHttpService>();
            _identityManagerMock = new Mock <IIdentityManager>();
            _validationHelper    = new ValidationHelper(_loggerMock, _httpServiceMock.Object, _identityManagerMock.Object);
        }
Ejemplo n.º 23
0
 public CustomerController(UserManager <Customer> userManager, IConfiguration configuration,
                           RoleManager <IdentityRole> roleManager, ICustomerService customerService, IOrderService orderService, IValidationHelper validationHelper)
 {
     _userManager      = userManager;
     _configuration    = configuration;
     _roleManager      = roleManager;
     _customerService  = customerService;
     _orderService     = orderService;
     _validationHelper = validationHelper;
 }
Ejemplo n.º 24
0
        //private IModelFactory _modelFactory;

        public BusinessManager(IDataAccess dataAccess, IUserManagement userManagement, IAuthenticationManagement authenticationManagement,
                               IValidationHelper validationHelper, IRoleManagement roleManagement)//,IModelFactory modelFactory)
        {
            _dataAccess               = dataAccess;
            _userManagement           = userManagement;
            _authenticationManagement = authenticationManagement;
            _roleManagement           = roleManagement;
            _validationHelper         = validationHelper;
            //_modelFactory = modelFactory;
        }
Ejemplo n.º 25
0
 public UserService(IValidationHelper validationHelper, IDialogsHelper dialogsHelper,
                    IUserRepository userRepository, IUserStorageHelper storage, IPhotoEditHelper photoEditHelper)
 {
     _url = "http://10.10.3.215:3000/api/userapi";
     _validationHelper = validationHelper;
     _userRepository   = userRepository;
     _storage          = storage;
     _dialogsHelper    = dialogsHelper;
     _photoEditHelper  = photoEditHelper;
 }
 public bool HasValidationHelper(BaseDO domainObject, out IValidationHelper validationHelper)
 {
     //Check Direct Types
     Type type = domainObject.GetType();
     validationHelper = null;
     if (this.ValidationHelpers.ContainsKey(type))
     {
         validationHelper = this.ValidationHelpers[type];
     }
     return validationHelper != null;
 }
Ejemplo n.º 27
0
 public AssetSettingsTargets(ITransactions transactions, IWeeklyAssetSettingsRepository targetsRepo, IAssetSettingsTypeHandler <AssetSettingsBase> handler, AssetSettingsOverlapTemplate assetSettingsOverlap, IValidationHelper validationHelper, ILoggingService loggingService, IAssetSettingsPublisher assetSettingsPublisher) : base(transactions, loggingService)
 {
     _weekRepo               = targetsRepo;
     _Converter              = handler;
     _assetSettingsOverlap   = assetSettingsOverlap;
     _validationHelper       = validationHelper;
     _groupType              = Enums.GroupType.AssetTargets;
     _assetSettingsPublisher = assetSettingsPublisher;
     _loggingService         = loggingService;
     _loggingService.CreateLogger(typeof(AssetSettingsTargets));
 }
Ejemplo n.º 28
0
        public string CreateMessageInvalidity(IValidationHelper validationHelper, object tag)
        {
            if (IsValid || validationHelper == null)
            {
                return(DefaultMessageInvalidity);
            }

            return(_errorEnumValue == null
                ? validationHelper.CreateMessageInvalidity(_errorValue, null)
                : validationHelper.CreateMessageInvalidity(_errorEnumValue, tag));
        }
Ejemplo n.º 29
0
        public ChangeAlbumViewModel(IMvxNavigationService navigationService, IUserDialogs userDialogs, IValidator validator, ISongService songService, IGenreService genreService, IArtistService artistService, IAlbumService albumService, IBottomNavigationViewModelService bottomNavigationViewModelService, ITopNavigationViewModelService topNavigationViewModelService)
        {
            _navigationService                = navigationService;
            _topNavigationViewModelService    = topNavigationViewModelService;
            _bottomNavigationViewModelService = bottomNavigationViewModelService;

            _userDialogs = userDialogs;

            _validationHelper = new ValidationHelper(validator, this, Errors.Value, (propertyName) => { FocusName.Value = propertyName; });

            _songService   = songService;
            _genreService  = genreService;
            _artistService = artistService;
            _albumService  = albumService;

            ValidateNameCommand = new MvxCommand(() => _validationHelper.Validate(() => Name));

            ValidateGenresCommand = new MvxCommand(() => _validationHelper.Validate(() => Genres));

            ValidateArtistsCommand = new MvxCommand(() => _validationHelper.Validate(() => Artists));

            ValidateSongsCommand = new MvxCommand(() => _validationHelper.Validate(() => Songs));

            InitValidationCommand = new MvxCommand(() => {
                _validationHelper.ResetValidation();
            });

            ChangeCommand = new MvxCommand(() =>
            {
                if (!IsTaskExecutedValueConverter.Convert(ChangeTask.Value))
                {
                    ChangeTask.Value = NotifyTaskCompletion.Create(AttemptChangeAsync);
                }
            });

            _genresTokenParentObject = new TokenParentHelper(new MvxCommand <TokenViewModel>((_) =>
            {
                Genres.Value?.Remove(_ as TokenViewModel <GenreModel>);
                ValidateGenresCommand.Execute(null);
            }));

            _artistsTokenParentObject = new TokenParentHelper(new MvxCommand <TokenViewModel>((_) =>
            {
                Artists.Value?.Remove(_ as TokenViewModel <ArtistModel>);
                ValidateArtistsCommand.Execute(null);
            }));

            _songsTokenParentObject = new TokenParentHelper(new MvxCommand <TokenViewModel>((_) =>
            {
                Songs.Value?.Remove(_ as TokenViewModel <SongModel>);
                ValidateSongsCommand.Execute(null);
            }));
        }
Ejemplo n.º 30
0
 public ServiceOperationsHelper(TService domainService,
                                IDataHelper <TService> dataHelper,
                                IValidationHelper <TService> validationHelper,
                                IDataManagerContainer <TService> dataManagerContainer,
                                IValidatorContainer <TService> validatorsContainer)
 {
     _domainService        = domainService ?? throw new ArgumentNullException(nameof(domainService));
     _dataHelper           = dataHelper ?? throw new ArgumentNullException(nameof(dataHelper));
     _validationHelper     = validationHelper ?? throw new ArgumentNullException(nameof(validationHelper));
     _dataManagerContainer = dataManagerContainer ?? throw new ArgumentNullException(nameof(dataManagerContainer));
     _validatorsContainer  = validatorsContainer ?? throw new ArgumentNullException(nameof(validatorsContainer));
     _dataManagers         = new ConcurrentDictionary <Type, object>();
 }
Ejemplo n.º 31
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="httpService"></param>
 /// <param name="deviceRepository"></param>
 public DeviceHistoryService(ILogger <DeviceHistoryService> logger,
                             IDeviceRepository deviceRepository,
                             IValidationHelper validationHelper,
                             IDeviceHistoryRepository deviceHistoryRepository)
 {
     _logger = logger ??
               throw new ArgumentNullException(nameof(logger));
     _deviceRepository = deviceRepository ??
                         throw new ArgumentNullException(nameof(deviceRepository));
     _validationHelper = validationHelper ??
                         throw new ArgumentNullException(nameof(validationHelper));
     _deviceHistoryRepository = deviceHistoryRepository ??
                                throw new ArgumentNullException(nameof(deviceHistoryRepository));
 }
Ejemplo n.º 32
0
        public RegistrationViewModel(IMvxNavigationService navigationService, IAuthService authService, IUserDialogs userDialogs, IValidator validator /*, ILocationService locationService*/, MvvmCross.Plugins.Validation.IMvxToastService toastService, IBottomNavigationViewModelService bottomNavigationViewModelService, ITopNavigationViewModelService topNavigationViewModelService)
        {
            _navigationService                = navigationService;
            _topNavigationViewModelService    = topNavigationViewModelService;
            _bottomNavigationViewModelService = bottomNavigationViewModelService;

            _authService  = authService;
            _userDialogs  = userDialogs;
            _toastService = toastService;

            _validationHelper = new ValidationHelper(validator, this, Errors.Value, (propertyName) => { FocusName.Value = propertyName; });

            //_locationService = locationService;

            ValidateEmailCommand     = new MvxCommand(() => _validationHelper.Validate(() => Email));
            ValidateFirstNameCommand = new MvxCommand(() => _validationHelper.Validate(() => FirstName));
            ValidateLastNameCommand  = new MvxCommand(() => _validationHelper.Validate(() => LastName));
            ValidatePasswordCommand  = new MvxCommand(() => _validationHelper.Validate(() => Password));
            ValidateBirthDateCommand = new MvxCommand(() => _validationHelper.Validate(() => BirthDate));

            RegisterCommand = new MvxCommand(() =>
            {
                if (!IsTaskExecutedValueConverter.Convert(RegisterTask.Value))
                {
                    RegisterTask.Value = NotifyTaskCompletion.Create(AttemptRegisterAsync);
                }
            });

            ChangeBirthDateCommand = new MvxAsyncCommand(async() => {
                var datePromptResult = await _userDialogs.DatePromptAsync(new DatePromptConfig()
                {
                    MinimumDate = new DateTime(1900, 1, 1), MaximumDate = DateTime.Now, SelectedDate = BirthDate.Value ?? new DateTime?(new DateTime(1990, 1, 1)), OkText = "OK", CancelText = "Cancel"
                });
                if (datePromptResult.Ok)
                {
                    BirthDate.Value = new DateTime?(datePromptResult.SelectedDate);
                }
                else
                {
                    BirthDate.Value = null;
                }
                ValidateBirthDateCommand.Execute(null);
            });

            InitValidationCommand = new MvxCommand(() => {
                _validationHelper.ResetValidation();
            });
        }
Ejemplo n.º 33
0
        public GeneralInformationValidator()
        {
            validationHelper = new ValidationHelper();

            RuleFor(x => x.Content).NotEmpty();
            //RuleFor(x => x.ShortDescription).NotEmpty();
            RuleFor(x => x.UploadImage)
            .NotEmpty()
            .When(x => x.DefaultImageFilelName == null)
            .WithMessage("General Information requires an informative Photo to be uploaded")
            .Must(validationHelper.ValidateIsPhoto)
            .When(x => x.UploadImage != null)
            .WithMessage("The Required File Is Not a Photo or Image")
            .Must(validationHelper.ValidateFileUploadSize)
            .When(x => x.UploadImage != null)
            .WithMessage("The Required File is less than 0 bytes or greater than 4MB");
        }
Ejemplo n.º 34
0
 public EditPersonValidator()
 {
     ValidationHelper = new ValidationHelper();
     RuleFor(x => x.Title).NotEmpty().NotEqual("empty").WithMessage("Title is required");
     RuleFor(x => x.MaritalStatus).NotEmpty().WithMessage("Marital Status is required");
     RuleFor(x => x.EmailAddress).EmailAddress().WithMessage("The Email Address is not valid").NotEmpty().WithMessage("Email address is required");
     RuleFor(x => x.AltEmailAddress).EmailAddress().WithMessage("The Alternative Email Address is not valid");
     RuleFor(x => x.Religion).NotEmpty().WithMessage("Religion is required");
     RuleFor(x => x.NationalityId).GreaterThan(0).WithMessage("Nationality is required");
     RuleFor(x => x.DateOfBirth).NotNull().WithMessage("Please provide the date of birth");
     RuleFor(x => x.TelephoneContact).NotEmpty().WithMessage("Telephone Contact is required");
     RuleFor(x => x.ProfilePhotoFile)
     .Must(ValidationHelper.ValidateIsPhoto)
     .WithMessage("The Uploaded File is not an image.").When(x => (x.ProfilePhotoFile != null && x.ProfilePhotoFile.ContentLength > 0));
     RuleFor(x => x.NextOfKinName).NotEmpty().WithMessage("NOK Name is required");
     RuleFor(x => x.NextOfKinContact).NotEmpty().WithMessage("NOK Contact is required");
     RuleFor(x => x.NextOfKinRelationship).NotEmpty().WithMessage("NOK Relationship is required");
 }
 public TierFormFolderSheetShouldHaveAllFoldersExisting(IValidationHelper helper, ILocalization localization)
     : base(localization)
 {
     if (helper == null) throw new ArgumentNullException("helper");
     _helper = helper;
 }
 public TierFormFieldSheetShouldHaveCorrectFieldFormMapping(IValidationHelper helper, ILocalization localization)
     : base(localization)
 {
     if (helper == null) throw new ArgumentNullException("helper");
     _helper = helper;
 }