private void QuitarActivoButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (bsDepositos.Current == null)
                {
                    return;
                }
                if (bsActivos.Current == null)
                {
                    return;
                }

                ActivoBEL   _activo   = (ActivoBEL)bsActivos.Current;
                DepositoBEL _deposito = (DepositoBEL)bsDepositos.Current;

                new ActivoEditForm()
                {
                    Editado = _activo
                }.ShowDialog();
                var _listaActivos = _deposito.Activos;

                _deposito.Activos = _listaActivos
                                    .FindAll(_ => _.Ubicacion.Equals(_deposito.Ubicacion));

                bsDepositos.ResetBindings(false);
                bsActivos.ResetBindings(false);
            }
            catch (Exception ex)
            {
                Mensajes.MensajeExcepcion(ex, this);
            }
        }
示例#2
0
        protected override Hashtable ObtenerParametros(EntidadBase valor)
        {
            var         hdatos = new Hashtable();
            DepositoBEL _valor = (DepositoBEL)valor;

            if (_valor == null)
            {
                _valor = new DepositoBEL();
            }
            hdatos.Add("@cod", _valor.Id);
            hdatos.Add("@des", _valor.Descripcion);
            hdatos.Add("@ubicacion", _valor.Ubicacion.Id);
            hdatos.Add("@capacidad", _valor.Capacidad);
            return(hdatos);
        }
示例#3
0
        protected override List <EntidadBase> ObtenerLista(DataSet ds)
        {
            List <EntidadBase> _lista = new List <EntidadBase>();
            DepositoBEL        x;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                x             = new DepositoBEL();
                x.Id          = (int)dr[0];
                x.Descripcion = dr[1].ToString();
                x.Capacidad   = Convert.ToInt32(dr[2]);
                x.Ubicacion   = (UbicacionBEL) new UbicacionDAL().Listar().Find(_ => ((UbicacionBEL)_).Id == Convert.ToInt32(dr[3]));
                x.Activos     = new ActivoDAL().Listar()
                                .FindAll(_ =>
                                         ((ActivoBEL)_).Ubicacion.Equals(x.Ubicacion))
                                .ConvertAll(_ => (ActivoBEL)_);
                _lista.Add(x);
            }

            return(_lista);
        }