Exemplo n.º 1
0
        public IList <SEG_ROL> GetById(SEG_ROL entity)
        {
            List <SEG_ROL> roles = new List <SEG_ROL>();

            using (var comando = _database.GetStoredProcCommand(string.Format("{0}{1}", ConectionStringRepository.EsquemaName, "p_SEG_ROL_GetById")))
            {
                _database.AddInParameter(comando, "@Id_rol", DbType.Int32, entity.id_rol);

                using (var lector = _database.ExecuteReader(comando))
                {
                    if (lector.Read())
                    {
                        roles.Add(new SEG_ROL
                        {
                            id_rol              = lector.IsDBNull(lector.GetOrdinal("Id_rol")) ? default(int) : lector.GetInt32(lector.GetOrdinal("Id_rol")),
                            rol                 = lector.IsDBNull(lector.GetOrdinal("rol")) ? default(string) : lector.GetString(lector.GetOrdinal("rol")),
                            descripcion         = lector.IsDBNull(lector.GetOrdinal("Descripcion")) ? default(string) : lector.GetString(lector.GetOrdinal("Descripcion")),
                            estado              = lector.IsDBNull(lector.GetOrdinal("Estado")) ? default(string) : lector.GetString(lector.GetOrdinal("Estado")),
                            UsuarioCreacion     = lector.IsDBNull(lector.GetOrdinal("usuario_registro")) ? default(string) : lector.GetString(lector.GetOrdinal("usuario_registro")),
                            FechaCreacion       = lector.IsDBNull(lector.GetOrdinal("fecha_registro")) ? default(DateTime) : lector.GetDateTime(lector.GetOrdinal("fecha_registro")),
                            UsuarioModificacion = lector.IsDBNull(lector.GetOrdinal("usuario_modifica")) ? default(string) : lector.GetString(lector.GetOrdinal("usuario_modifica")),
                            FechaModificacion   = lector.IsDBNull(lector.GetOrdinal("fecha_modifica")) ? default(DateTime) : lector.GetDateTime(lector.GetOrdinal("fecha_modifica"))
                        });
                    }
                }
            }

            return(roles);
        }
Exemplo n.º 2
0
        public int Delete(SEG_ROL entity)
        {
            int idResult;

            using (var comando = _database.GetStoredProcCommand(string.Format("{0}{1}", ConectionStringRepository.EsquemaName, "p_SEG_ROL_Delete")))
            {
                _database.AddInParameter(comando, "@id_rol", DbType.Int32, entity.id_rol);
                _database.AddOutParameter(comando, "@Response", DbType.Int32, 11);

                _database.ExecuteNonQuery(comando);
                idResult = Convert.ToInt32(_database.GetParameterValue(comando, "@Response"));
            }

            return(idResult);
        }
Exemplo n.º 3
0
        public bool Exists(SEG_ROL entity)
        {
            bool existe = false;

            using (var comando = _database.GetStoredProcCommand(string.Format("{0}{1}", ConectionStringRepository.EsquemaName, "p_SEG_ROL_VerifyExists")))
            {
                _database.AddInParameter(comando, "@rol", DbType.String, entity.rol);

                using (var lector = _database.ExecuteReader(comando))
                {
                    if (lector.Read())
                    {
                        existe = Convert.ToBoolean(lector.GetInt32(0));
                    }
                }
            }

            return(existe);
        }
Exemplo n.º 4
0
        public int Add(SEG_ROL entity)
        {
            int id;

            using (var comando = _database.GetStoredProcCommand(string.Format("{0}{1}", ConectionStringRepository.EsquemaName, "p_SEG_ROL_Insert")))
            {
                _database.AddInParameter(comando, "@rol", DbType.String, entity.rol);
                _database.AddInParameter(comando, "@descripcion", DbType.String, entity.descripcion);
                _database.AddInParameter(comando, "@estado", DbType.String, entity.estado);
                _database.AddInParameter(comando, "@UsuarioCreacion", DbType.String, entity.UsuarioCreacion);
                _database.AddInParameter(comando, "@fecha_registro", DbType.DateTime, entity.FechaCreacion);
                _database.AddOutParameter(comando, "@Response", DbType.Int32, 11);

                _database.ExecuteNonQuery(comando);
                id = Convert.ToInt32(_database.GetParameterValue(comando, "@Response"));
            }

            return(id);
        }
Exemplo n.º 5
0
 public IList <SEG_ROL> GetAllFilters(SEG_ROL entity)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
 public int Update(SEG_ROL entity)
 {
     return(SEG_ROLRepository.Instancia.Update(entity));
 }
Exemplo n.º 7
0
 public IList <SEG_ROL> GetById(SEG_ROL entity)
 {
     return(SEG_ROLRepository.Instancia.GetById(entity));
 }
Exemplo n.º 8
0
 public bool Exists(SEG_ROL entity)
 {
     return(SEG_ROLRepository.Instancia.Exists(entity));
 }
Exemplo n.º 9
0
 public int Delete(SEG_ROL entity)
 {
     return(SEG_ROLRepository.Instancia.Delete(entity));
 }
Exemplo n.º 10
0
 public int Add(SEG_ROL entity)
 {
     return(SEG_ROLRepository.Instancia.Add(entity));
 }