public void Ejecutar()
 {
     //aca es a quien llama cuando queres cambiar
     if (Application.Current.Windows.Count == 1)
     {
         this.obtenerEmpresas();
         this.obtenerSucursales();
         this.vista             = new Vistas.VistaCambiaEmpresa();
         this.vista.DataContext = this;
         this.cmdCancelar       = new RelayCommand(m => TryCatch.Intentar(n => this.Cancelar()));
         this.cmdAceptar        = new RelayCommand(m => TryCatch.Intentar(n => this.CambiarEmpresa((Empresa)this.vista.cboEmpresa.SelectedItem, (Sucursal)this.vista.cboSucursal.SelectedItem)));
         CambiarEmpresaWindow   = new Window()
         {
             Content = this.vista,
             WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
             Height      = 300,
             Width       = 450,
             WindowStyle = System.Windows.WindowStyle.None,
         };
         if (Application.Current.MainWindow.IsVisible)
         {
             CambiarEmpresaWindow.Owner = Application.Current.MainWindow;
             CambiarEmpresaWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
         }
         CambiarEmpresaWindow.ShowDialog();
     }
     else
     {
         MessageBox.Show("No Podes Cambiar de unidad de negocio si tenes mas de una ventana abierta");
     }
 }
        public override void Configurar()
        {
            base.Configurar();
            Func <Servicios.DTO.Proveedores.OrdenDeCompra> nuevo = delegate
            {
                var vistaNuevo = new BaseVentanaDialogo();
                vistaNuevo.VistaPrincipal.Content = new VistaProveedorNuevoOrdenDeCompra();
                var presentador = new VMSeleccionaProveedor()
                {
                    Ventana = vistaNuevo
                };
                vistaNuevo.DataContext = presentador;
                vistaNuevo.ShowDialog();
                if (presentador.SeleccionOk)
                {
                    var ordenDeCompra = this.Servicio.CrearConParametros(Sistema.Instancia.EmpresaActual.Codigo, presentador.ObtenerIds()).GetEntidad();
                    if (ordenDeCompra.Detalle == null)
                    {
                        Mensajes.Error("Proveedor no tiene plantilla o lista de precios. No se Puede continuar.");
                        ordenDeCompra.Detalle = new System.Data.DataTable();
                    }
                    return(ordenDeCompra);
                }
                else
                {
                    return(null);
                }
            };

            this.CmdNuevo = new RelayCommand(m => TryCatch.Intentar(i => this.Editar(nuevo()), this.PuedeCrearNuevo()));
        }
        public override void Configurar()
        {
            base.Configurar();
            Func <Servicios.DTO.Proveedores.ListaDePrecios> nuevo = delegate
            {
                var vistaNuevo = new BaseVentanaDialogo();
                vistaNuevo.VistaPrincipal.Content = new VistaListaProveedorNuevo();
                var presentador = new VMSeleccionaProveedor()
                {
                    Ventana = vistaNuevo
                };
                vistaNuevo.DataContext = presentador;
                vistaNuevo.ShowDialog();

                if (presentador.SeleccionOk)
                {
                    return(this.Servicio.CrearConParametros(Sistema.Instancia.EmpresaActual.Codigo, presentador.ObtenerCodigo()).GetEntidad());
                }
                else
                {
                    return(null);
                }
            };

            this.CmdNuevo = new RelayCommand(m => TryCatch.Intentar(i => this.Editar(nuevo()), this.PuedeCrearNuevo()));
        }
 public VistaModeloLista(IList <TDto> dto)
     : base()
 {
     //this.Items = (ObservableCollection<TDto>)dto;
     this.Items    = new ObservableCollection <TDto>(dto);
     this.CmdExcel = new RelayCommand(x => TryCatch.Intentar(f => this.ExportarAExcel(), n => Mensajes.Error((Exception)n)));
 }
 public VMNuevoIngreso()
 {
     this.PresentadorDeposito  = InstanciarPresentador("PresentadorDeposito");
     this.PresentadorProveedor = InstanciarPresentador("PresentadorProveedor");
     this.Ordenes   = new ObservableCollection <object>();
     this.CmdOpcion = new RelayCommand(p => TryCatch.Intentar(i => this.CargarOrdenesPendientes()), p => this.PresentadorProveedor.Entidad != null);
     this.PresentadorProveedor.CambioEntidad += PresentadorProveedor_CambioEntidad;
 }
        public VMCabeceraDocumentoDeCompra()
        {
            this.InstanciarPresentador("PresentadorEmpresa");
            this.PresentadorEmpresa.cantidadNumeros = 2;

            this.InstanciarPresentador("PresentadorProveedor");
            this.PresentadorProveedor.cantidadNumeros = 5;
            this.BotonBuscaDocumentoCompra            = new RelayCommand(p => TryCatch.Intentar(x => this.BuscarDocumentoDeCompraOCrearNuevo()), x => this.PuedeBuscarDocumentoDeCompra());
        }
Example #7
0
 public VistaModeloBaseDialogo()
     : base()
 {
     this.CmdAceptar  = new RelayCommand(p => TryCatch.Intentar(i => this.Ventana.Close()), p => this.puedegrabar());
     this.CmdCancelar = new RelayCommand(c => TryCatch.Intentar(delegate(object o)
     {
         this.EntidadActual = null;
         this.Ventana.Close();
     }));
 }
Example #8
0
 //constructor
 public Sistema()
 {
     this.ControladorLogin        = new ControladorLogin();
     this.SeleccionEmpresa        = new ControladorSeleccionEmpresa();
     this.ControladorMenu         = new ControladorMenu();
     this.MainWindow              = Application.Current.MainWindow;
     this.MainWindow.Initialized += new EventHandler(MainWindow_Initialized);
     this.MenuPrincipal           = new ObservableCollection <OpcionMenu>();
     this.CmdCambiarUsuario       = new RelayCommand(c => TryCatch.Intentar(n => Login()));
     this.CmdCambiarEmpresa       = new RelayCommand(c => TryCatch.Intentar(n => CambiarEmpresa()));
     this.MainWindow.DataContext  = this;
 }
 public PresentadorBaseDialogo()
 {
     this.CmdAceptar = new RelayCommand(a => TryCatch.Intentar(delegate(object o)
     {
         this.Ventana.Close();
         this.DialogoCerrado(true);
     }));
     this.CmdCancelar = new RelayCommand(c => TryCatch.Intentar(delegate(object o)
     {
         this.EntidadActual = null;
         this.Ventana.Close();
         this.DialogoCerrado(false);
     }));
 }
        public override void Configurar()
        {
            base.Configurar();

            dynamic vista = new BuscadorArbol();
            dynamic VM    = new VMFuerzaDeVenta();

            vista.DataContext = VM;
            this.VistaABM.PanelIzquierdo.Content = vista;
            this.CmdNuevo         = new RelayCommand(m => TryCatch.Intentar(i => this.Editar(VM.CreaItemArbol(vista.Arbol.SelectedItem))));
            this.CmdGrabar        = new ComandoGrabar(m => TryCatch.Intentar(i => VM.Grabar(this.EntidadActual, VM), f => TryCatch.Intentar(i => this.Cancelar()), true), m => this.PuedeGrabar());
            this.CmdCerrarPestaña = new RelayCommand(m => TryCatch.Intentar(i => this.Cancelar()), m => this.PuedeCancelar(m));
            this.CmdBorrar        = new CommandoBorrar(m => TryCatch.Intentar(i => VM.Borrar(vista.Arbol.SelectedItem), f => TryCatch.Intentar(i => this.Cancelar()), false), m => this.PuedeBorrar());
            this.CmdEditar        = new RelayCommand(m => TryCatch.Intentar(i => this.Editar(VM.Editar(vista.Arbol.SelectedItem))));
        }
        public void Ejecutar()
        {
            vistalogin             = new Login();
            vistalogin.DataContext = this;
            this.cmdCancelar       = new RelayCommand(m => TryCatch.Intentar(n => this.Cancelar()));
            this.cmdAceptar        = new RelayCommand(m => TryCatch.Intentar(n => this.Login(vistalogin.txtNombreUsuario.Text.ToUpperInvariant(), vistalogin.txtClaveUsuario.Password.ToUpperInvariant())));

            LoginWindow = new Window()
            {
                Content = vistalogin,
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
                WindowStyle           = System.Windows.WindowStyle.None,
                SizeToContent         = SizeToContent.WidthAndHeight,
                ResizeMode            = ResizeMode.NoResize,
            };
            if (Application.Current.MainWindow.IsVisible)
            {
                LoginWindow.Owner = Application.Current.MainWindow;
                LoginWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            }
            LoginWindow.ShowDialog();
        }
        public override void Configurar()
        {
            base.Configurar();
            dynamic vista = new BuscadorHabilitaLista();

            vmBuscador = new VMHabilitaLista()
            {
                Servicio = this.Servicio
            };
            vmBuscador.CargarDatos();
            vista.DataContext = vmBuscador;
            this.VistaABM.PanelIzquierdo.Content = vista;



            this.CmdCerrarPestaña = new RelayCommand(m => TryCatch.Intentar(i => this.Cancelar()), m => this.PuedeCancelar(m));
            //this.CmdBorrar = new CommandoBorrar(m => TryCatch.Intentar(i => VM.Borrar(vista.Arbol.SelectedItem), f => TryCatch.Intentar(i => this.Cancelar()), false), m => this.PuedeBorrar());
            this.CmdEditar = new RelayCommand(m => TryCatch.Intentar(i => this.Editar(vmBuscador.ItemSeleccionado)));

            this.CmdGrabar = new ComandoGrabar(m => TryCatch.Intentar(i => this.Grabar(this.EntidadActual),
                                                                      f => TryCatch.Intentar(i => this.Cancelar()), false),
                                               p => this.PuedeGrabar());
        }
        public virtual void Configurar()
        {
            this.CmdNuevo         = new RelayCommand(m => TryCatch.Intentar(i => this.Crear(Servicio.Crear(Sistema.Instancia.EmpresaActual.Codigo)), this.PuedeCrearNuevo()));
            this.CmdGrabar        = new ComandoGrabar(i => this.Grabar(), i => this.PuedeGrabar());
            this.CmdVer           = new RelayCommand(m => TryCatch.Intentar(i => this.Ver(this.Servicio.ObtenerPorId(this.Buscador.ItemSeleccionado.Id, CargarRelaciones.CargarTodo, Sistema.Instancia.EmpresaActual.Codigo)), true), m => this.PuedeVer());
            this.CmdEditar        = new RelayCommand(m => TryCatch.Intentar(i => this.Editar(this.Servicio.ObtenerPorId(this.Buscador.ItemSeleccionado.Id, CargarRelaciones.CargarTodo, Sistema.Instancia.EmpresaActual.Codigo)), true), m => this.PuedeEditar());
            this.CmdBorrar        = new CommandoBorrar(m => this.Borrar(), m => this.PuedeBorrar());
            this.CmdClonar        = new RelayCommand(m => TryCatch.Intentar(i => this.Editar(this.EntidadActual.ClonarSinID <TEntidad>())), m => this.PuedeClonar());
            this.CmdCerrarPestaña = new RelayCommand(m => TryCatch.Intentar(i => this.Cancelar()), m => this.PuedeCancelar(m));
            this.CmdListar        = new RelayCommand(m => TryCatch.Intentar(i => this.Listar()), m => this.PuedeListar());
            //this.CmdImprimir = new RelayCommand(m => TryCatch.Intentar(i => this.Imprimir(this.EntidadActual)), m => this.PuedeImprimir());

            this.VistaTemplate = FabricaVistas.Instancia.BuscaVista(typeof(TEntidad));

            var controlBuscador = new BuscadorInicial();

            //presentador Buscador para el buscador :)
            this.Buscador.CmdSeleccionarItem = this.CmdEditar;
            controlBuscador.DataContext      = this.Buscador;
            controlBuscador.txtBusqueda.Focus();

            this.VistaABM = new BaseABM();
            this.VistaABM.PanelIzquierdo.Content = controlBuscador;
        }
Example #14
0
 public void TryFinallyTest( )
 {
     TryCatch.Intentar(p => tryMethod(p), o => finallyMethod(o), false);
     Assert.AreEqual(4, result);
 }
Example #15
0
 public void ExeptionCathTest( )
 {
     TryCatch.Intentar(p => tryMethod(p), true);
 }