예제 #1
0
        } // 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
예제 #2
0
        } // 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;
        }
예제 #4
0
        } // 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();
		}
예제 #6
0
        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();
 }
예제 #8
0
 public ValidationViewModel()
     : base()
 {
     Validator = new ValidationHelper();
     NotifyDataErrorInfoAdapter = new NotifyDataErrorInfoAdapter(Validator);
 }
예제 #9
0
 protected ValidatableViewModel()
 {
     Validator = new ValidationHelper();
     DataErrorInfoAdapter = new DataErrorInfoAdapter(Validator);
     OnCreated();
 }
예제 #10
0
 public ValidationHelper(BaseViewModel baseViewModel)
 {
     _validationHelper = new MvvmValidation.ValidationHelper();
     _viewModel        = baseViewModel;
 }
 public ValidatableViewModelBase()
 {
     Validator = new ValidationHelper();
     notifyDataErrorInfoAdapter = new NotifyDataErrorInfoAdapter(Validator);
     PropertyChanged += delegate { Validator.ValidateAll(); };
 }
예제 #12
0
 public void ResetValidators()
 {
     Validator = new ValidationHelper();
       SetValidators();
       ValidateAll();
 }