Example #1
0
        public List <PersonaEN> ObtenerPersona()
        {
            IDbConnection _conn = DBCommon.Conexion();

            _conn.Open();
            SqlCommand _comand = new SqlCommand("CONSULTAR_PERSONA", _conn as SqlConnection);

            _comand.CommandType = CommandType.StoredProcedure;
            IDataReader      _reader = _comand.ExecuteReader();
            List <PersonaEN> _lista  = new List <PersonaEN>();

            while (_reader.Read())
            {
                PersonaEN pEN = new PersonaEN();
                pEN.Id              = _reader.GetInt64(0);
                pEN.Nombres         = _reader.GetString(1);
                pEN.Apellidos       = _reader.GetString(2);
                pEN.Id_Tipo_Persona = _reader.GetInt64(3);


                _lista.Add(pEN);
            }
            _conn.Close();
            return(_lista);
        }
Example #2
0
        public int EliminarTipoPersona(TipoPersonaEN en)
        {
            IDbConnection _conn = DBCommon.Conexion();

            _conn.Open();
            SqlCommand _comand = new SqlCommand("ELIMINAR_TIPOPERSONA", _conn as SqlConnection);

            _comand.CommandType = CommandType.StoredProcedure;
            _comand.Parameters.Add(new SqlParameter("@ID", en.Id));
            int r = _comand.ExecuteNonQuery();

            _conn.Close();
            return(r);
        }
Example #3
0
        public int AgregarModulo(ModuloEN en)
        {
            IDbConnection _conn = DBCommon.Conexion();

            _conn.Open();
            SqlCommand _comand = new SqlCommand("AGREGAR_MODULOS", _conn as SqlConnection);

            _comand.CommandType = CommandType.StoredProcedure;
            _comand.Parameters.Add(new SqlParameter("@NOMBRE", en.Nombre));
            _comand.Parameters.Add(new SqlParameter("@IDPERSONA", en.Id_Persona));
            int r = _comand.ExecuteNonQuery();

            _conn.Close();
            return(r);
        }
Example #4
0
        public int AgregarPersona(PersonaEN en)
        {
            IDbConnection _conn = DBCommon.Conexion();

            _conn.Open();
            SqlCommand _comand = new SqlCommand("AGREGAR_PERSONA", _conn as SqlConnection);

            _comand.CommandType = CommandType.StoredProcedure;
            _comand.Parameters.Add(new SqlParameter("@NOMBRES", en.Nombres));
            _comand.Parameters.Add(new SqlParameter("@APELLIDOS", en.Apellidos));
            _comand.Parameters.Add(new SqlParameter("@IDTIPOPERSONA", en.Id_Tipo_Persona));
            int r = _comand.ExecuteNonQuery();

            _conn.Close();
            return(r);
        }
Example #5
0
        public List <ModuloEN> ObtenerModulo()
        {
            IDbConnection _conn = DBCommon.Conexion();

            _conn.Open();
            SqlCommand _comand = new SqlCommand("CONSULTAR_MODULO", _conn as SqlConnection);

            _comand.CommandType = CommandType.StoredProcedure;
            IDataReader     _reader = _comand.ExecuteReader();
            List <ModuloEN> _lista  = new List <ModuloEN>();

            while (_reader.Read())
            {
                ModuloEN pEN = new ModuloEN();
                pEN.Id         = _reader.GetInt64(0);
                pEN.Nombre     = _reader.GetString(1);
                pEN.Id_Persona = _reader.GetInt64(2);
                _lista.Add(pEN);
            }
            _conn.Close();
            return(_lista);
        }