Esempio n. 1
0
        public CoinModel(Coin coin,
                         IDirtySerializableCacheService serializableCacheService,
                         IDialogService dialogService,
                         IImageReaderService imageReaderService,
                         IImageCacheService imageCacheService)
            : base(serializableCacheService)
        {
            _dialogService      = dialogService;
            _imageReaderService = imageReaderService;
            _imageCacheService  = imageCacheService;

            _coin = coin;

            Images        = new ObservableCollection <Image>(coin.Images ?? new List <Image>());
            SelectedImage = Images.FirstOrDefault();

            AddCoinImageCommand    = new RelayCommand <WindowCommandContext>(AddCoinImage);
            RemoveCoinImageCommand = new RelayCommand <WindowCommandContext>(RemoveCoinImage);

            Validator.AddRule(() => Title, () => RuleResult.Assert(!string.IsNullOrWhiteSpace(Title), Resources.ErrorBlankField));
            Validator.AddRule(() => Country, () => RuleResult.Assert(Country != null, Resources.ErrorBlankField));
            Validator.AddRule(() => Currency, () => RuleResult.Assert(Currency != null, Resources.ErrorBlankField));

            Validator.ValidateAll();
        }
Esempio n. 2
0
        private void SetupValidation()
        {
            var validationRules = new ValidationHelper();

            // Simple properties
            validationRules.AddRule(nameof(StringProperty),
                                    () =>
                                    RuleResult.Assert(!string.IsNullOrEmpty(StringProperty),
                                                      "StringProperty cannot be null or empty string"));

            validationRules.AddRule(nameof(IntProperty),
                                    () => RuleResult.Assert(IntProperty > 0, "IntProperty should be greater than zero."));

            // Dependant properties
            validationRules.AddRule(nameof(RangeStart),
                                    nameof(RangeEnd),
                                    () => RuleResult.Assert(RangeEnd > RangeStart, "RangeEnd must be grater than RangeStart"));

            // Long-running validation (simulates call to a web service or something)
            validationRules.AddRule(
                nameof(StringProperty2),
                () =>
            {
                SyncValidationRuleExecutedAsyncroniouslyDelegate?.Invoke();

                return(RuleResult.Assert(!string.IsNullOrEmpty(StringProperty2),
                                         "StringProperty2 cannot be null or empty string"));
            });

            Validation = validationRules;
            DataErrorInfoValidationAdapter = new NotifyDataErrorInfoAdapter(Validation);
        }
        private void AddRules()
        {
            Validator.AddRule(nameof(Amount),
                              () => RuleResult.Assert(_amount > 0, "Betrag muss grösser als 0 sein"));

            Validator.AddRequiredRule(() => InvoiceNumber, "Es muss eine Rechnungsnummer eingegeben werden");
        }
Esempio n. 4
0
        public void CombineRuleResults_ResultContainsErrorsFromAllCombinedResults()
        {
            // Arrange
            var validation = new ValidationHelper();

            validation.AddRule(() =>
            {
                //var r1 = RuleResult.Invalid("Error1");
                //var r2 = RuleResult.Valid();
                //var r3 = RuleResult.Invalid("Error2");

                return
                (RuleResult.Assert(false, "Error1").Combine(
                     RuleResult.Assert(true, "Error0")).Combine(
                     RuleResult.Assert(false, "Error2")));

                //return r1.Combine(r2).Combine(r3);
            });

            // Act
            var result = validation.ValidateAll();

            // Assert
            Assert.False(result.IsValid, "The validation must fail");
            Assert.Equal(2, result.ErrorList.Count);
            Assert.True(result.ErrorList.Any(e => e.ErrorText == "Error1"));
            Assert.True(result.ErrorList.Any(e => e.ErrorText == "Error2"));
        }
Esempio n. 5
0
        public bool Validate()
        {
            ErrorSummary = string.Empty;

            Validator.RemoveAllRules();

            Validator.AddRule(
                nameof(Mode),
                () => RuleResult.Assert(
                    !Mode.IsNullOrEmpty(),
                    $"{nameof(Mode)} is required"
                    )
                );


            Validator.AddRule(
                nameof(Outcome),
                () => RuleResult.Assert(
                    !Outcome.IsNullOrEmpty(),
                    $"{nameof(Outcome)} is required"
                    )
                );


            Validator.AddRule(
                nameof(Date),
                () => RuleResult.Assert(
                    Date <= DateTime.Today,
                    $"{nameof(Date)} should be a valid date"
                    )
                );

            if (EnableConsent)
            {
                Validator.AddRule(
                    nameof(Consent),
                    () => RuleResult.Assert(
                        !Consent.IsNullOrEmpty(),
                        $"{nameof(Consent)} is required"
                        )
                    );
                Validator.AddRule(
                    nameof(BookingDate),
                    () => RuleResult.Assert(
                        BookingDate >= DateTime.Today,
                        $"{nameof(BookingDate)} should be a valid date"
                        )
                    );
            }


            var result = Validator.ValidateAll();

            Errors = result.AsObservableDictionary();
            if (null != Errors && Errors.Count > 0)
            {
                ErrorSummary = Errors.First().Value;
            }
            return(result.IsValid);
        }
        private void ConfigureValidationRules()
        {
            Validator.AddRequiredRule(() => FirstName, "First Name is required");

            Validator.AddRequiredRule(() => LastName, "Last Name is required");

            Validator.AddRequiredRule(() => MiddleName, "Middle Name is required");

            Validator.AddRequiredRule(() => Gender, "Gender is required");

            Validator.AddRequiredRule(() => Contact, "Contact is required");

            Validator.AddRequiredRule(() => Birthdate, "Birthdate is required");


            Validator.AddRequiredRule(() => Address, "Address is required");

            Validator.AddRule(nameof(FirstName),
                              () =>
            {
                //var _context = new MorenoContext();
                string name      = $"{LastName}, {FirstName} {MiddleName}";
                var result       = _context.Teachers.FirstOrDefault(e => e.FullName == name);
                bool isAvailable = result == null;
                return(RuleResult.Assert(isAvailable,
                                         "Existing Name has found!"));
            });
        }
        public override bool Validate()
        {
            Validator.AddRule(
                nameof(Identifier),
                () => RuleResult.Assert(
                    !string.IsNullOrWhiteSpace(Identifier),
                    $"{nameof(Identifier)} is required"
                    )
                );

            Validator.AddRule(
                nameof(RegistrationDate),
                () => RuleResult.Assert(
                    RegistrationDate <= DateTime.Today,
                    $"{nameof(RegistrationDate)} should not be future date"));

            try
            {
                var clientRegistrationDTO = new ClientRegistrationDTO(_settings);

                if (null != clientRegistrationDTO)
                {
                    Validator.AddRule(
                        nameof(RegistrationDate),
                        () => RuleResult.Assert(
                            RegistrationDate > clientRegistrationDTO.ClientDemographic.BirthDate,
                            $"{nameof(RegistrationDate)} should be after Birth Date"));
                }
            }
            catch (Exception e)
            {
            }

            return(base.Validate());
        }
Esempio n. 8
0
        private void ConfigureValidationRules()
        {
            Validator.AddRule(nameof(ReturnedQuantity), () =>
            {
                int num;
                var result = int.TryParse(ReturnedQuantity, out num);
                return(RuleResult.Assert(!(num > SelectedBorrow.QuantityBorrowed),
                                         $"Quantity is greater than borrowed book. {SelectedBorrow.QuantityBorrowed} borrowed books."));
            });

            Validator.AddRule(nameof(ReturnedQuantity), () =>
            {
                int num;
                var result = int.TryParse(ReturnedQuantity, out num);
                return(RuleResult.Assert(result,
                                         $"Quantity must be a number."));
            });

            Validator.AddRule(nameof(ReturnedQuantity), () =>
            {
                int num;
                var result = int.TryParse(ReturnedQuantity, out num);
                if (result)
                {
                    if (num < 1)
                    {
                        result = false;
                    }
                }
                return(RuleResult.Assert(result,
                                         $"Minimum quantity is 1."));
            });
            Validator.AddRequiredRule(() => ReturnedQuantity, "Quantity is required");
        }
        private void ConfigureValidationRules()
        {
            Validator.AddRequiredRule(() => Title, "Title is required");

            Validator.AddRequiredRule(() => Author, "Author is required");

            Validator.AddRequiredRule(() => Publisher, "Publisher is required");

            Validator.AddRequiredRule(() => Category, "Category is required");

            Validator.AddRequiredRule(() => PublisedYear, "PublisedYear is required : example (2017)");

            //Validator.AddRequiredRule(() => AvailableQuantity, "Available Quantity is required");


            Validator.AddRequiredRule(() => Quantity, "Quantity is required");

            Validator.AddRule(nameof(Title),
                              () =>
            {
                //var _context = new MorenoContext();
                //string name = $"{LastName}, {FirstName} {MiddleName}";
                using (var context = new MorenoContext())
                {
                    var result       = context.Books.FirstOrDefault(e => e.Title == Title);
                    bool isAvailable = result == null;
                    return(RuleResult.Assert(isAvailable,
                                             "Book Title already exisists"));
                }
            });
        }
        /// <summary>
        /// The ConfigureValidationRules
        /// </summary>
        private void ConfigureValidationRules()
        {
            //            Validator.AddAsyncRule(nameof(LRN),
            //                async () =>
            //                {
            //                    var _context = new MorenoContext();
            //                    var result = await _context.Students.FirstOrDefaultAsync(e => e.LRN == LRN);
            //                    bool isAvailable = result == null;
            //                    return RuleResult.Assert(isAvailable,
            //                        string.Format("LRN {0} is taken. Please choose a different one.", LRN));
            //                });

            Validator.AddRule(nameof(CustomerName),
                              () =>
            {
                var count  = _context.Customers.Count(c => c.Name.ToLower().Equals(CustomerName.Trim().ToLower()));
                var result = count == 0;
                return(RuleResult.Assert(result,
                                         $"Customer already exists"));
            });

            Validator.AddRequiredRule(() => CustomerName, "Name is Required");

            Validator.AddRequiredRule(() => CustomerMobile, "Mobile Number is Required");

            Validator.AddRequiredRule(() => CustomerAddress, "Address is Required");
        }
Esempio n. 11
0
        public ValidationViewModel()
        {
            Linhas = new ObservableCollection <ClasseTeste> ();

            Validator.AddRule(() => Codigo, () => RuleResult.Assert(ValidaNumeros(Codigo), "Código deve ser um número maior do que 0."));
            Validator.AddRule(() => Valor, () => RuleResult.Assert(ValidaNumeros(Valor), "Valor deve ser um número maior do que 0."));
        }
        private void ConfigureValidationRules()
        {
            Validator.AddRequiredRule(() => LRN, "LRN is required");

            Validator.AddAsyncRule(nameof(LRN),
                                   async() =>
            {
                var _context     = new MorenoContext();
                var result       = await _context.Students.FirstOrDefaultAsync(e => e.LRN == LRN);
                bool isAvailable = result == null;
                return(RuleResult.Assert(isAvailable,
                                         string.Format("LRN {0} is taken. Please choose a different one.", LRN)));
            });

            Validator.AddRequiredRule(() => FirstName, "First Name is required");

            Validator.AddRequiredRule(() => LastName, "Last Name is required");

            Validator.AddRequiredRule(() => MiddleName, "Middle Name is required");

            Validator.AddRequiredRule(() => Gender, "Gender is required");

            Validator.AddRequiredRule(() => Contact, "Contact is required");

            Validator.AddRequiredRule(() => Birthdate, "Birthdate is required");


            Validator.AddRequiredRule(() => Address, "Address is required");

            Validator.AddRequiredRule(() => SchoolYear, "School Year is required");

            Validator.AddRequiredRule(() => SelectedSection, "Section is required");

            Validator.AddRequiredRule(() => SelectedYearLevel, "Year Level is required");
        }
Esempio n. 13
0
        public void AsyncValidation_DependantProperties_IfOneInvalidSecondIsInvalidToo()
        {
            TestUtils.ExecuteWithDispatcher((dispatcher, testCompleted) =>
            {
                var vm = new DummyViewModel
                {
                    Foo = "abc",
                    Bar = "abc"
                };

                Func <bool> validCondition = () => vm.Foo != vm.Bar;

                var validation = new ValidationHelper();

                validation.AddAsyncRule(
                    () => vm.Foo,
                    () => vm.Bar,
                    setResult =>
                {
                    ThreadPool.QueueUserWorkItem(_ =>
                    {
                        setResult(RuleResult.Assert(validCondition(), "Foo must be different than bar"));
                    });
                });

                validation.ValidateAsync(() => vm.Bar).ContinueWith(r =>
                {
                    Assert.False(r.Result.IsValid, "Validation must fail");
                    Assert.True(r.Result.ErrorList.Count == 2, "There must be 2 errors: one for each dependant property");

                    testCompleted();
                });
            });
        }
Esempio n. 14
0
        public override void ViewAppeared()
        {
            var clientJson          = _settings.GetValue("client.dto", "");
            var clientEncounterJson = _settings.GetValue("client.encounter", "");
            var encounterTypeId     = _settings.GetValue("encounterTypeId", "");

            if (null == Client && !string.IsNullOrWhiteSpace(clientJson))
            {
                Client = JsonConvert.DeserializeObject <Client>(clientJson);
            }

            if (EncounterTypeId.IsNullOrEmpty() && !string.IsNullOrWhiteSpace(encounterTypeId))
            {
                EncounterTypeId = new Guid(encounterTypeId);
            }

            if (null == Encounter && !string.IsNullOrWhiteSpace(clientEncounterJson))
            {
                Encounter = JsonConvert.DeserializeObject <Encounter>(clientEncounterJson);
            }

            if (null != Client && !Client.CanBeLinked())
            {
                LinkedToCareViewModel.ErrorSummary = "Client Cannot be linked to Care !";
                LinkedToCareViewModel.Validator.AddRule(
                    () => RuleResult.Assert(
                        Client.CanBeLinked(),
                        $"Client Cannot be linked to Care !"
                        )
                    );
            }
        }
Esempio n. 15
0
        private bool ValidateTokenAddress()
        {
            var validator = new ValidationHelper();

            validator.AddRequiredRule(() => ContractAddress, "Token address is required.");
            var resultOne = validator.ValidateAll();

            if (!resultOne.IsValid)
            {
                Errors = resultOne.ErrorList;

                return(resultOne.IsValid);
            }

            bool isValidAddress;

            try
            {
                isValidAddress = new Regex("^(?=.{42}$)0x[a-fA-F0-9]*").IsMatch(ContractAddress);
            }
            catch (Exception e)
            {
                isValidAddress = false;
            }
            validator.AddRule(ContractAddress, () => RuleResult.Assert(isValidAddress, "Token address is not valid Ethereum smart contract address."));

            var result = validator.ValidateAll();

            Errors = result.ErrorList;

            return(result.IsValid);
        }
Esempio n. 16
0
        public bool Validate()
        {
            ErrorSummary = string.Empty;

            Validator.AddRule(
                nameof(ReferredTo),
                () => RuleResult.Assert(
                    !string.IsNullOrWhiteSpace(ReferredTo),
                    $"{nameof(ReferredTo)} is required"
                    )
                );


            //Validator.AddRule(
            //    nameof(DatePromised),
            //    () => RuleResult.Assert(
            //        DatePromised >= DateTime.Today,
            //        $"{nameof(DatePromised)} should be a valid date"
            //    )
            //);

            var result = Validator.ValidateAll();

            Errors = result.AsObservableDictionary();
            if (null != Errors && Errors.Count > 0)
            {
                ErrorSummary = Errors.First().Value;
            }
            return(result.IsValid);
        }
 private void ConfigureValidationRules()
 {
     Validator.AddRequiredRule(() => Username, "Username is required");
     //due to passwordbox restrictions, this won't show on the UI
     Validator.AddRequiredRule(() => Password, "Password is required");
     Validator.AddAsyncRule(nameof(Username),
                            async() => RuleResult.Assert(await IsValidLogin(), "Bad Username or Password"));
 }
        private void SetupValidationRules()
        {
            this.Validator.AddRequiredRule(() => this.KeyVaultUrl, "Azure KeyVaultUrl is required");
            this.Validator.AddRequiredRule(() => this.ADApplicationId, "AD ApplicationId is required");
            this.Validator.AddRequiredRule(() => this.ADApplicationSecret, "AD ApplicationSecret is required");

            this.Validator.AddRule(() => this.KeyVaultUrl, () => RuleResult.Assert(this.CheckIfVaultUrlMatchesFormat(), @"Key Vault Url does not match format eg. https://www.<vaultname>.vault.azure.net/ "));
            this.Validator.AddRule(() => this.KeyVaultUrl, () => RuleResult.Assert(this.keyVaultConfigurationRepository.Get(this.vaultName) == null, @"Key Vault Url configuration already exists"));
        }
Esempio n. 19
0
 private void AddValidationRules()
 {
     this.Validator.AddRequiredRule(() => this.Price, "Price is required");
     this.Validator.AddRule(() => this.Price, () => RuleResult.Assert(this.Price.HasValue && this.Price <= int.MaxValue, "Price is too high"));
     this.Validator.AddRule(() => this.Price, () => RuleResult.Assert(this.Price.HasValue && this.Price >= int.MinValue, "Price is too low"));
     this.Validator.AddRequiredRule(() => this.Quantity, "Quantity is required");
     this.Validator.AddRule(() => this.Quantity, () => RuleResult.Assert(this.Quantity.HasValue && this.Quantity <= int.MaxValue, "Quantity is too high"));
     this.Validator.AddRule(() => this.Quantity, () => RuleResult.Assert(this.Quantity.HasValue && this.Quantity >= int.MinValue, "Quantity is too low"));
 }
 private void ConfigureValidationRules()
 {
     Validator.AddRule(() => CurrentCallResult,
                       () =>
     {
         var result = !(CurrentCallResult == null || String.IsNullOrEmpty(CurrentCallResult.Code));
         return(RuleResult.Assert(result, string.Format("Call Result is required")));
     });
 }
Esempio n. 21
0
        public bool Validate()
        {
            ErrorSummary = string.Empty;

            Validator.AddRule(
                nameof(Kit),
                () => RuleResult.Assert(
                    !Kit.IsNullOrEmpty(),
                    $"{nameof(Kit)} is required"
                    )
                );

            Validator.AddRule(
                nameof(Result),
                () => RuleResult.Assert(
                    !Result.IsNullOrEmpty(),
                    $"{nameof(Result)} is required"
                    )
                );

            if (ShowKitOther)
            {
                Validator.AddRule(
                    nameof(KitOther),
                    () => RuleResult.Assert(
                        !string.IsNullOrWhiteSpace(KitOther),
                        $"Specify Other Kit"
                        )
                    );
            }

            Validator.AddRule(
                nameof(LotNumber),
                () => RuleResult.Assert(
                    !string.IsNullOrWhiteSpace(LotNumber),
                    $"{nameof(LotNumber)} is required"
                    )
                );

            Validator.AddRule(
                nameof(Expiry),
                () => RuleResult.Assert(
                    Expiry >= DateTime.Today,
                    $"{nameof(Expiry)} should be a valid date"
                    )
                );

            var result = Validator.ValidateAll();

            Errors = result.AsObservableDictionary();
            if (null != Errors && Errors.Count > 0)
            {
                ErrorSummary = Errors.First().Value;
            }
            return(result.IsValid);
        }
Esempio n. 22
0
 private void AddRules()
 {
     Validator.AddRequiredRule(() => Name, "Name ist notwendig");
     Validator.AddRequiredRule(() => RelativePath, "Dateiname ist notwendig");
     Validator.AddRule(nameof(RelativePath),
                       () => RuleResult.Assert(
                           File.Exists(_relativePath) || File.Exists(Path.Combine(FileType.Document.ToString(), _relativePath)),
                           "File does not exist anymore"));
     Validator.AddRequiredRule(() => IssueDate, "Das Ausstellungsdatum muss angegeben sein");
 }
Esempio n. 23
0
 private void Initialize()
 {
     this.Validator.AddRule(() => this.KeyName, () => RuleResult.Assert(!string.IsNullOrWhiteSpace(this.KeyName), "Key Name is required"));
     this.Validator.AddRule(
         () => this.KeyName,
         () =>
         RuleResult.Assert(
             this.keyMatcher.Match(this.KeyName).Success,
             "Key name should have minimum 1 and a maximum of 63 characters and can contain only alphabhets, numbers and '-'"));
 }
Esempio n. 24
0
 private void SetValidationRules()
 {
     Validator.AddRule(nameof(VotelistVote),
                       () =>
     {
         //matches 10 or 1-9, or 1.1 up to 9.9
         Regex regex = new Regex(@"^(10|[1-9]{1,2}){1}(\.[0-9]{1,2})?$");
         return(RuleResult.Assert(regex.IsMatch(VotelistVote), "Not a valid vote"));
     });
 }
Esempio n. 25
0
 public EntityObservable(IEntityService service)
 {
     _service = service;
     Validator.AddRequiredRule(() => Name, Resource.Strings.Message_IsRequired);
     Validator.AddAsyncRule(() => Name, async() =>
     {
         bool nameDuplicacy = await Task.Run(() => _service.NameDuplicateAsync(_id, Name));
         return(RuleResult.Assert(!nameDuplicacy, Resource.Strings.Message_AlreadyInUse));
     });
 }
 private bool ValidateCol5()
 {
     if (!ValidateOneItem(Col5))
     {
         Validator.AddRule(() => ArtistCol5, () => RuleResult.Assert(false, "Cannot play twice"));
         Validator.Validate(() => ArtistCol5);
         RaisePropertyChangedEvent("ArtistCol5");
         return(false);
     }
     return(true);
 }
Esempio n. 27
0
        public BbqItemViewModel()
        {
            this.Validator.AddRule(nameof(this.Name), () => RuleResult.Assert(!string.IsNullOrEmpty(this.Name), "Name must be set"));

            this.Validator.AddRule(nameof(this.Definition), () =>
                                   RuleResult.Assert(this.Definition != null, "Item type must be selected!"));

            this.Validator.AddRule(nameof(this.ThermometerIndex), () =>
                                   RuleResult.Assert(this.ThermometerIndex > 0 && this.ThermometerIndex < 8, "Select a thermometer"));

            this.Validator.ResultChanged += (s, args) => this.RaisePropertyChanged(nameof(this.HasErrors));
        }
        private void ConfigureValidationRules()
        {
            Validator.AddRule(() => ActiveRanking,
                              () =>
            {
                var result = !(Activity.ContactMethod == "In-Person" && (ActiveRanking == null || String.IsNullOrEmpty(ActiveRanking.Code)));
                return(RuleResult.Assert(result, string.Format("Category is required")));
            });

            Validator.AddRule(nameof(Note),
                              () => RuleResult.Assert(_noteEntered && Note.Length <= 1999, "Note is required and cannot be more than 1999 characters"));
        }
Esempio n. 29
0
 private void AddRules()
 {
     Validator.AddRule(nameof(Year), () => RuleResult.Assert(_year != null && _year > 1900, "Das Jahr muss grösser sein als 1900"));
     Validator.AddRule(nameof(Year), () => RuleResult.Assert(_year <= 9999, "Das Jahr muss kleiner sein als 10'000"));
     Validator.AddRule(nameof(Revenue),
                       () => RuleResult.Assert(_revenue != null && _revenue >= 0, "Die Einnahmen müssen positiv sein"));
     Validator.AddRule(nameof(Expenses),
                       () => RuleResult.Assert(_expenses != null && _expenses >= 0, "Die Ausgaben müssen positiv sein"));
     Validator.AddRule(nameof(Year),
                       () => RuleResult.Assert(!IsNewBudget || UnitOfWork.Budgets.GetBudgetByYear(new DateTime(_year.GetValueOrDefault(), 1, 1)) == null,
                                               "Zu dem ausgewählten Jahr existiert bereits ein Budget"));
 }
Esempio n. 30
0
        public bool Validate()
        {
            ErrorSummary = string.Empty;

            Validator.AddRule(
                nameof(FacilityHandedTo),
                () => RuleResult.Assert(
                    !string.IsNullOrWhiteSpace(FacilityHandedTo),
                    $"{nameof(FacilityHandedTo)} is required"
                    )
                );

            Validator.AddRule(
                nameof(HandedTo),
                () => RuleResult.Assert(
                    !string.IsNullOrWhiteSpace(HandedTo),
                    $"{nameof(HandedTo)} is required"
                    )
                );

            Validator.AddRule(
                nameof(EnrollmentId),
                () => RuleResult.Assert(
                    !string.IsNullOrWhiteSpace(EnrollmentId),
                    $"CCC {nameof(EnrollmentId)} is required"
                    )
                );

            //Validator.AddRule(
            //    nameof(DateEnrolled),
            //    () => RuleResult.Assert(
            //        DateEnrolled >= DateTime.Today,
            //        $"{nameof(DateEnrolled)} should be a valid date"
            //    )
            //);

            //Validator.AddRule(
            //    nameof(ARTStartDate),
            //    () => RuleResult.Assert(
            //        ARTStartDate >= DateTime.Today,
            //        $"{nameof(ARTStartDate)} should be a valid date"
            //    )
            //);

            var result = Validator.ValidateAll();

            Errors = result.AsObservableDictionary();
            if (null != Errors && Errors.Count > 0)
            {
                ErrorSummary = Errors.First().Value;
            }
            return(result.IsValid);
        }