コード例 #1
0
        public PagoValeExternoViewModel2()
        {
            this.PropertyChanged += PagoValeExternoViewModel2_PropertyChanged;
            if (!this.IsInDesignMode)
            {
                _proxy        = CommonServiceLocator.ServiceLocator.Current.GetInstance <Common.ServiceContracts.IDataServiceAsync>();
                this.Negocios = _proxy.GetNegocios();
            }

            this.SearchCommand = new GalaSoft.MvvmLight.Command.RelayCommand(() =>
            {
                this.Vale = _proxy.FindDistribuidorExterno(this.SelectedNegocio.Value, this.Cuenta, this.ValeSearch);
                var pago  = (Models.Pagos.PagoVale) this.PagoIem;
                if (this.Vale != null)
                {
                    pago.Info.Electronica = this.Vale.Distribuidor.Electronica;
                    this.Limite           = this.Vale.Limite;
                    this.Search           = null;
                    if (!this.HasPromocion)
                    {
                        this.SelectedPromocion = this.Promocion.Promociones.FirstOrDefault();
                    }
                    if (this.Vale.Distribuidor.Firmas != null && this.Vale.Distribuidor.Firmas.Any())
                    {
                        this.SelectedFirma = this.Vale.Distribuidor.Firmas.First();
                    }
                    else
                    {
                        this.SelectedFirma = null;
                    }
                    this.Caja.UpdatePagos();
                }
                else
                {
                    MessageBox.Show("Distribuidor no encontrado.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }, () => !string.IsNullOrEmpty(this.ValeSearch) && this.SelectedNegocio.HasValue && !string.IsNullOrEmpty(this.Cuenta));


            if (this.IsInDesignMode)
            {
            }
        }
コード例 #2
0
        public VerificarValeExternoViewModel()
        {
            this.PropertyChanged += VerificarValeExternoViewModel_PropertyChanged;
            if (!IsInDesignMode)
            {
                _proxy = CommonServiceLocator.ServiceLocator.Current.GetInstance <Common.ServiceContracts.IDataServiceAsync>();

                this.Negocios = _proxy.GetNegocios();
            }
            this.SearchCommand = new GalaSoft.MvvmLight.Command.RelayCommand(() =>
            {
                this.Vale = _proxy.FindDistribuidorExterno(this.SelectedNegocio.Value, this.Cuenta, this.ValeSearch);
                if (this.Vale == null)
                {
                    MessageBox.Show("Distribuidor no encontrado.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }, () => !string.IsNullOrEmpty(this.ValeSearch) && this.SelectedNegocio.HasValue && !string.IsNullOrEmpty(this.Cuenta));

            if (this.IsInDesignMode)
            {
                this.ValeSearch = "search";
                this.Vale       = new ValeResponse
                {
                    Cancelado       = true,
                    CanceladoMotivo = "motivo",
                    Disponible      = 100,
                    Vale            = "123",
                    Distribuidor    = new Distribuidor
                    {
                        Id          = 1,
                        Nombre      = "nombre",
                        ApMaterno   = "materno",
                        ApPaterno   = "paterno",
                        Status      = Common.Constants.StatusDistribuidor.SOBREGIRADO,
                        Electronica = true,
                        Firmas      = new short[] { 1, 2, 3 }
                    }
                };
            }
        }
コード例 #3
0
        public PagoValeExternoViewModel()
        {
            this.PlanPago         = new ObservableCollection <Models.PlanPagoItem>();
            this.PropertyChanged += PagoValeExternoViewModel_PropertyChanged;
            if (!IsInDesignMode)
            {
                _proxy = CommonServiceLocator.ServiceLocator.Current.GetInstance <Common.ServiceContracts.IDataServiceAsync>();
            }

            this.SearchCommand = new GalaSoft.MvvmLight.Command.RelayCommand(() =>
            {
                this.Vale = _proxy.FindDistribuidorExterno(this.SelectedNegocio.Value, this.Cuenta, this.ValeSearch);
                if (this.Vale == null)
                {
                    MessageBox.Show("Distribuidor no encontrado.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }, () => !string.IsNullOrEmpty(this.ValeSearch) && this.SelectedNegocio.HasValue && !string.IsNullOrEmpty(this.Cuenta));

            if (!this.IsInDesignMode)
            {
                var settings = CommonServiceLocator.ServiceLocator.Current.GetInstance <Utilities.Models.Settings>();
                this.Promocion = _proxy.FindPromocionesVale(settings.Sucursal.Clave);
                this.Negocios  = _proxy.GetNegocios();
            }

            if (this.IsInDesignMode)
            {
                this.Plazos        = new int[] { 1, 2, 3 };
                this.SelectedPlazo = 3;
                this.Promocion     = new PromocionesValeResponse
                {
                    Promociones = new DateTime[] {
                        DateTime.Parse("2019-01-01"),
                        DateTime.Parse("2019-02-10"),
                        DateTime.Parse("2019-03-20")
                    },
                    Fechas = new DateTime[] {
                        DateTime.Parse("2020-01-01"),
                        DateTime.Parse("2020-02-10"),
                        DateTime.Parse("2020-03-20")
                    },
                    Blindaje = 100
                };
                this.SelectedPromocion = this.Promocion.Promociones.Last();
                this.Primero           = 123;
                this.Ultimo            = 456;
                this.Pagar             = 100m;
                this.ValeSearch        = "vale";
                this.Negocios          = new Common.Entities.NegocioExterno[]
                {
                    new Common.Entities.NegocioExterno {
                        Id = 1, Negocio = "a", Descripcion = "n1"
                    },
                    new Common.Entities.NegocioExterno {
                        Id = 2, Negocio = "b", Descripcion = "n2"
                    },
                    new Common.Entities.NegocioExterno {
                        Id = 3, Negocio = "c", Descripcion = "n3"
                    }
                };
                this.Negocio         = "a";
                this.SelectedNegocio = 1;
                this.Cuenta          = "0123456";
                this.Vale            = new Common.Entities.ValeResponse
                {
                    Cancelado       = true,
                    CanceladoMotivo = "motivo",
                    Disponible      = 199m,
                    Vale            = "123",
                    ClienteId       = 1,
                    Distribuidor    = new Common.Entities.Distribuidor
                    {
                        Id          = 1,
                        Cuenta      = "0123",
                        Nombre      = "nombre",
                        ApPaterno   = "appaterno",
                        ApMaterno   = "apmaterno",
                        Status      = Common.Constants.StatusDistribuidor.SOBREGIRADO,
                        Electronica = true,
                        Promocion   = true,
                        ContraVale  = true,
                        Firmas      = new short[] { 1, 2, 3 }
                    }
                };
            }
        }