Exemplo n.º 1
0
 private void ValidateEvent(Validator <CustomerViewmodel> sender, CustomerViewmodel viewmodel, ValidateEventArgs <CustomerViewmodel> e)
 {
     if (e.IsProperty(vm => vm.CountryCode))
     {
         CountryCodeHelper.Validate(e, viewmodel.CountryCode);
     }
 }
        private void ValidateEvent(Validator <OrderViewmodel> sender, OrderViewmodel viewmodel, ValidateEventArgs <OrderViewmodel> e)
        {
            if (e.IsProperty(vm => vm.CustomerID))
            {
                CustomerIdHelper.Validate(e, viewmodel.CustomerID);
            }
            else if (e.IsProperty(vm => vm.ShippedDate))
            {
                if (viewmodel.ShippedDate != null && viewmodel.ShippedDate.Value.Year < 2019)
                {
                    e.Remark = "The date is not correct.";
                    return;
                }

                e.IsValid = true;
            }
            else if (e.IsProperty(vm => vm.ShipCountryCode))
            {
                CountryCodeHelper.Validate(e, viewmodel.ShipCountryCode);
            }
        }