Exemple #1
0
 public FondoCierreViewModel()
 {
     this.SaveCommand = new RelayCommand(() => {
         var request = new Common.Entities.FondoArqueoRequest
         {
             Importe     = this.Importe.Value,
             Auditor     = this.Auditor.Value,
             Responsable = this.Responsable.Value
         };
         _proxy.CierreFondo(request);
         MessageBox.Show("ready");
         GalaSoft.MvvmLight.Messaging.Messenger.Default.Send(new Utilities.Messages.FondoAperturaCierre {
             Open = false
         });
     });
     if (this.IsInDesignMode)
     {
         this.Responsable = 1;
         this.Auditor     = 2;
         this.Importe     = 100;
     }
     else
     {
         _proxy           = CommonServiceLocator.ServiceLocator.Current.GetInstance <Common.ServiceContracts.IAdminServiceAsync>();
         this.Responsable = this.Cajero.Id;
     }
 }
Exemple #2
0
        public FondoArqueoViewModel()
        {
            this.PropertyChanged   += FondoArqueoViewModel_PropertyChanged;
            this.LoadAuditorCommand = new RelayCommand(() =>
            {
                this.Auditor = _data.FindAuditorApertura(this.SearchAuditor.Value, this.Cajero.Id);
                if (this.Auditor != null)
                {
                    this.SearchAuditor = null;
                }
                else
                {
                    MessageBox.Show("Auditor no valido.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }, () => this.SearchAuditor.HasValue);
            this.SaveCommand = new RelayCommand(() => {
                var code    = Microsoft.VisualBasic.Interaction.InputBox("Codigo Auditor:");
                var isValid = _proxy.ValidarCodigo(this.Auditor.Id, code);
                if (!isValid)
                {
                    MessageBox.Show("Código no valido.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                var request = new Common.Entities.FondoArqueoRequest
                {
                    Importe     = this.Importe.Value,
                    Auditor     = this.Auditor.Id,
                    Responsable = this.Cajero.Id
                };
                _proxy.ArqueoFondo(request);
                MessageBox.Show("ready");
                this.CloseCommand.Execute(null);
            }, () => this.Auditor != null && this.Importe.HasValue && this.Effectivo.HasValue &&
                                                this.Faltante >= 0);
            if (this.IsInDesignMode)
            {
                this.Effectivo = 150;
                this.Auditor   = new Common.Entities.Empleado {
                    Nombre          = "nom",
                    ApellidoMaterno = "mat",
                    ApellidoPaterno = "pat"
                };
                this.Importe       = 100;
                this.SearchAuditor = 99;
            }
            else
            {
                _proxy         = CommonServiceLocator.ServiceLocator.Current.GetInstance <Common.ServiceContracts.IAdminServiceAsync>();
                _data          = CommonServiceLocator.ServiceLocator.Current.GetInstance <Common.ServiceContracts.IDataServiceAsync>();
                this.Effectivo = _proxy.GetDisponibleFondo(this.Cajero.Id);
            }
        }