Exemplo n.º 1
0
        public PagoDevolucionViewModel()
        {
            if (!this.IsInDesignMode)
            {
                _proxy = CommonServiceLocator.ServiceLocator.Current.GetInstance <Common.ServiceContracts.IDataServiceAsync>();
            }

            this.PropertyChanged += PagoDevolucionViewModel_PropertyChanged;

            this.FindCommand = new RelayCommand(async() => {
                this.IsBusy     = true;
                this.Devolucion = await _proxy.FindDevolucionAsync(this.Sucursal, this.Folio);
                if (this.Devolucion != null)
                {
                    if (this.Devolucion.Disponible >= this.Total)
                    {
                        this.Pagar = this.Total;
                    }
                    else if (this.Devolucion.Disponible > 0)
                    {
                        this.Pagar = this.Devolucion.Disponible;
                    }
                }
                this.IsBusy = false;
            }, () => !String.IsNullOrEmpty(this.Sucursal) && !String.IsNullOrEmpty(this.Folio));

            if (this.IsInDesignMode)
            {
                //this.Total = 123.4m;
                this.Pagar      = 456;
                this.Sucursal   = "01";
                this.Folio      = "123456";
                this.Devolucion = new Common.Entities.Devolucion
                {
                    Sucursal   = "02",
                    Folio      = "000123",
                    Disponible = 200m
                };
            }
        }