예제 #1
0
        private void AsignarButton_Click(object sender, EventArgs e)
        {
            try
            {
                var _buscar = new BuscarActivoForm();
                _buscar.ShowDialog();

                if (_buscar.Seleccionado == null)
                {
                    return;
                }
                ActivoBEL _seleccionado = (ActivoBEL)_buscar.Seleccionado;
                _buscar.Close();

                if (_seleccionado.EstadoActivo.Id != (int)Estados.Disponible)
                {
                    throw new InvalidOperationException("Activo no disponible");
                }

                ((ClienteBEL)bsClientes.Current).ActivosAsignados.Add(_seleccionado);

                if (new ClienteBLL().Modificar((ClienteBEL)bsClientes.Current))
                {
                    _seleccionado.EstadoActivo = (EstadoBEL) new EstadoBLL().Listar().Find(x => x.Id == (int)Estados.EnUso);
                    new ActivoBLL().Modificar(_seleccionado);
                }

                bsActivosAsignados.ResetBindings(false);
            }
            catch (Exception ex)
            {
                Mensajes.MensajeExcepcion(ex, this);
            }
        }
예제 #2
0
        private void AgregarActivoButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (bsDonaciones.Current == null)
                {
                    return;
                }
                var _buscar = new BuscarActivoForm();
                _buscar.ShowDialog();

                if (_buscar.Seleccionado == null)
                {
                    return;
                }

                bsActivos.Add(_buscar.Seleccionado);
                if (new DonacionBLL().Modificar((DonacionBEL)bsDonaciones.Current))
                {
                    bsDonaciones.ResetCurrentItem();
                }
            }
            catch (Exception ex)
            {
                Mensajes.MensajeExcepcion(ex, this);
            }
        }
예제 #3
0
        private void ActivoBuscarButton_Click(object sender, EventArgs e)
        {
            var _busqueda = new BuscarActivoForm();

            _busqueda.ShowDialog();
            ((ReparacionBEL)Tag).Activo = (ActivoBEL)_busqueda.Seleccionado;
            bsReparacion.ResetCurrentItem();

            _busqueda.Close();
        }
예제 #4
0
        private void AgregarActivoButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (bsDepositos.Current == null)
                {
                    return;
                }
                var _deposito = (DepositoBEL)bsDepositos.Current;

                var _buscar = new BuscarActivoForm();
                _buscar.ShowDialog();

                if (_buscar.Seleccionado == null)
                {
                    return;
                }
                ActivoBEL _activo = (ActivoBEL)_buscar.Seleccionado;

                if (_deposito.Activos.Contains(_activo))
                {
                    return;
                }

                _activo.Ubicacion = ((DepositoBEL)bsDepositos.Current).Ubicacion;

                if (new ActivoBLL().Modificar(_activo))
                {
                    ((DepositoBEL)bsDepositos.Current).Activos.Add(_activo);
                }

                bsActivos.ResetBindings(false);
            }
            catch (Exception ex)
            {
                Mensajes.MensajeExcepcion(ex, this);
            }
        }