public ConsultaPorDiaView() { InitializeComponent(); this.Loaded += new RoutedEventHandler(ConsultaPorDiaView_Loaded); this._consultaPorDiaViewModel = new ConsultaPorDiaViewModel(this.Dispatcher); token.TokenSelected += new UserControls.Token.TokenSelectedEventHandler(token_TokenSelected); this.BackKeyPress += token.CancelBackKeyPress; _paginacionEnable = false; _flagTitle = true; (ApplicationBar.MenuItems[1] as IApplicationBarMenuItem).Text = TextosPantallas.menuVolverConsultaSaldos; (ApplicationBar.MenuItems[2] as IApplicationBarMenuItem).Text = TextosPantallas.menuCerrarSesion; _consultaPorDiaViewModel.CerrarSesionComplete += new Global.ViewModelServiceCallback(_consultaPorDiaViewModel_CerrarSesionComplete); _consultaPorDiaViewModel.CerrarSesionError += new Global.ViewModelServiceCallback<Global.ViewModelEventArgs>(_consultaPorDiaViewModel_CerrarSesionError); _consultaPorDiaViewModel.ProcesoError += new Global.ViewModelServiceCallback<Global.ViewModelEventArgs>(_consultaPorDiaViewModel_ProcesoError); progress.OnShow += (s, e) => { ApplicationBar.IsMenuEnabled = false; this.BackKeyPress += progress.CancelBackKeyPress; }; progress.OnHide += (s, e) => { ApplicationBar.IsMenuEnabled = true; this.BackKeyPress -= progress.CancelBackKeyPress; }; }
private void realizarConsulta(ConsultaPorDiaViewModel.CriterioConsulta consultaTipo) { progress.Show(); bool validado = true; this._tipo = consultaTipo; date = datePicker.Value; #if OFFLINE this._consultaPorDiaViewModel.consultarFecha(); this._consultaPorDiaViewModel.getFechas(ref _fecha, ref _fechaHistorico, ref _tipo, date.Value.Day.ToString(), date.Value.Month.ToString(), date.Value.Year.ToString()); if (!String.IsNullOrEmpty(_fecha) && !String.IsNullOrEmpty(_fechaHistorico)) { if (_producto == _productoCheques) this._consultaPorDiaViewModel.chequesConsultaPorDia(_noCuenta, _fecha, _fechaHistorico); else this._consultaPorDiaViewModel.tarjetaConsultaPorDia(_noCuenta, _fecha, _fechaHistorico); _consultaPorDiaViewModel_consultaPorDiaEventHandler(new ClienteEventArgs() { ErrorCliente = false, datosBase = new Error() { clave = "OK" } }); } else { progress.Hide(); } #else this._consultaPorDiaViewModel.consultarFecha(); this._consultaPorDiaViewModel.getFechas(ref _fecha, ref _fechaHistorico, ref _tipo, date.Value.Day.ToString(), date.Value.Month.ToString(), date.Value.Year.ToString()); if (this._tipo == ConsultaPorDiaViewModel.CriterioConsulta.Historico) { if (String.IsNullOrEmpty(date.Value.Month.ToString()) || String.IsNullOrEmpty(date.Value.Day.ToString()) || String.IsNullOrEmpty(date.Value.Year.ToString())) { MessageBox.Show(TextosPantallas.tIntroduzcaFecha); validado = false; progress.Hide(); } else { if (String.IsNullOrEmpty(_fecha) && String.IsNullOrEmpty(_fechaHistorico)) { MessageBox.Show(TextosPantallas.tFechaMenor); validado = false; progress.Hide(); } } } if (validado) { this._consultaPorDiaViewModel.ValidaAccesoComplete += new Global.ViewModelServiceCallback<Model.Dto.DtoValidaAcceso>(_consultaPorDiaViewModel_ValidaAccesoComplete); this._consultaPorDiaViewModel.ValidaTokenComplete += new Global.ViewModelServiceCallback(_consultaPorDiaViewModel_ValidaTokenComplete); this._consultaPorDiaViewModel.ValidaAccesoError += new Global.ViewModelServiceCallback<Global.ViewModelEventArgs>(_vm_ProcesoError); this._consultaPorDiaViewModel.ValidaTokenError += new Global.ViewModelServiceCallback<Global.ViewModelEventArgs>(_vm_ProcesoError); if (_producto == "C") { this._consultaPorDiaViewModel.ValidaAcceso(ClavesOperacion.ConsultaMovimientosCheques); } else { this._consultaPorDiaViewModel.ValidaAcceso(ClavesOperacion.ConsultaMovimientosTarjetas); } } #endif }