} // ExecuteOk /// <summary> /// /// </summary> /// <remarks> /// Sin comentarios adicionales /// </remarks> /// <param name="validation"></param> protected override void SetupValidation(MvvmValidation.ValidationHelper validation) { base.SetupValidation(validation); validation.AddRequiredRule(() => this.Login, "Usuario requerido"); validation.AddRequiredRule(() => this.Password, "Password requerida"); } // SetupValidation
} // OnSaveRecord //private void LoadSoportes() //{ // var svc = ServiceLocator.Current.GetInstance<IQueryServiceFactory>(); // ISoporteQueryService queryService = svc.GetInstance<ISoporteQueryService>(); // this.Soportes = new ObservableCollection<IKeyValueItem>(queryService.GetKeyValueItems()); // this.Rebind(); //} //private void LoadAmbitos() //{ // var svc = ServiceLocator.Current.GetInstance<IQueryServiceFactory>(); // IAmbitoQueryService queryService = svc.GetInstance<IAmbitoQueryService>(); // this.Ambitos = new ObservableCollection<IKeyValueItem>(queryService.GetKeyValueItems()); // this.Rebind(); //} //private void LoadGrupoProductoes() //{ // var svc = ServiceLocator.Current.GetInstance<IQueryServiceFactory>(); // IGrupoProductoQueryService queryService = svc.GetInstance<IGrupoProductoQueryService>(); // this.GrupoProductoes = new ObservableCollection<IKeyValueItem>(queryService.GetKeyValueItems()); // this.Rebind(); //} #endregion #region Protected Methods protected override void SetupValidation(MvvmValidation.ValidationHelper validation) { //// Validación de hora de Inicio //validation.AddRule( // () => this.HoraInicioEmision, // () => RuleResult.Assert( // this.HoraInicioEmision != null, // "La hora de inicio de emisión es requerida")); //// Validación de hora de Fin //validation.AddRule( // () => this.HoraFinEmision, // () => RuleResult.Assert( // this.HoraFinEmision != null, // "La hora de fin de emisión es requerida")); //// Hora Fin mayor que Hora Inicio //validation.AddRule( // () => this.HoraInicioEmision, // () => this.HoraFinEmision, // () => RuleResult.Assert( // (this.HoraInicioEmision != null && this.HoraFinEmision != null) // && ((DateComparisonResult)this.HoraFinEmision.Value.CompareTo24(this.HoraInicioEmision.Value) == DateComparisonResult.Later), // "La hora de Fin de emisión debe ser mayor que la hora de Inicio de emisión")); }
protected ValidatableViewModelBase() { Validator = new ValidationHelper(); NotifyDataErrorInfoAdapter = new NotifyDataErrorInfoAdapter(Validator); NotifyDataErrorInfoAdapter.ErrorsChanged += OnErrorsChanged; }
} // OnSaveRecord // si esta entidad necesita cargar otras entidades o colecciones es aqui donde se implementan los metodos de carga. #endregion #region Protected Methods protected override void SetupValidation(MvvmValidation.ValidationHelper validation) { //ejemplo de validacion //// Validación de hora de Inicio //validation.AddRule( // () => this.HoraInicio, // () => RuleResult.Assert( // this.HoraInicio != null, // "La hora de inicio de emisión es requerida")); }
public ValidatableViewModelBase() { Validator = new ValidationHelper(); #if SILVERLIGHT NotifyDataErrorInfoAdapter = new NotifyDataErrorInfoAdapter(Validator); #else DataErrorInfoAdapter = new DataErrorInfoAdapter(Validator); #endif OnCreated(); }
public BaseVM() { Validator = new ValidationHelper(); DataErrorInfoAdapter = new DataErrorInfoAdapter(Validator); Validator.ResultChanged += (o, e) => { var propertyName = e.Target as string; if (!string.IsNullOrEmpty(propertyName)) { RaisePropertyChangedEvent(propertyName); } }; }
public ValidatableViewModelBase() { Validator = new ValidationHelper(); DataErrorInfoAdapter = new DataErrorInfoAdapter(Validator); OnCreated(); }
public ValidationViewModel() : base() { Validator = new ValidationHelper(); NotifyDataErrorInfoAdapter = new NotifyDataErrorInfoAdapter(Validator); }
protected ValidatableViewModel() { Validator = new ValidationHelper(); DataErrorInfoAdapter = new DataErrorInfoAdapter(Validator); OnCreated(); }
public ValidationHelper(BaseViewModel baseViewModel) { _validationHelper = new MvvmValidation.ValidationHelper(); _viewModel = baseViewModel; }
public ValidatableViewModelBase() { Validator = new ValidationHelper(); notifyDataErrorInfoAdapter = new NotifyDataErrorInfoAdapter(Validator); PropertyChanged += delegate { Validator.ValidateAll(); }; }
public void ResetValidators() { Validator = new ValidationHelper(); SetValidators(); ValidateAll(); }