Пример #1
0
        public static IList <clsTipoObjeciones> ListarTipoObjeciones(bool activo)
        {
            IList <clsTipoObjeciones> lista = new List <clsTipoObjeciones>();
            clsTipoObjeciones         objecion;

            SqlDataReader objReader = null;

            SqlParameter[] objParams;

            try
            {
                objParams          = SqlHelperParameterCache.GetSpParameterSet(BaseDatos.GetConexion(), "SP_C_TIPO_OBJECIONES");
                objParams[0].Value = activo;

                objReader = SqlHelper.ExecuteReader(BaseDatos.GetConexion(), "SP_C_TIPO_OBJECIONES", objParams);
                while (objReader.Read())
                {
                    objecion               = new clsTipoObjeciones();
                    objecion.Id            = Convert.ToInt64(objReader["Id"]);
                    objecion.Nombre        = objReader["Descripcion"].ToString();
                    objecion.Estado        = Convert.ToBoolean(objReader["Estado"]);
                    objecion.FechaCreacion = Convert.ToDateTime(objReader["FechaCreacion"]);
                    lista.Add(objecion);
                }
            }
            catch (Exception ex)
            {
                Base.Log.Log.EscribirLog(ex.Message);
                return(null);
            }
            finally
            {
                if (objReader != null)
                {
                    objReader.Close();
                }
            }
            return(lista);
        }
Пример #2
0
        public static clsTipoObjeciones ObtenerObjecionPorId(Int16 IdObjecion)
        {
            clsTipoObjeciones objecion = null;

            SqlDataReader objReader = null;

            SqlParameter[] objParams;

            try
            {
                objParams          = SqlHelperParameterCache.GetSpParameterSet(BaseDatos.GetConexion(), "SP_C_TIPO_OBJECIONES_PORID");
                objParams[0].Value = IdObjecion;

                objReader = SqlHelper.ExecuteReader(BaseDatos.GetConexion(), "SP_C_TIPO_OBJECIONES_PORID", objParams);
                while (objReader.Read())
                {
                    objecion        = new clsTipoObjeciones();
                    objecion.Id     = Convert.ToInt64(objReader["Id"]);
                    objecion.Nombre = objReader["Descripcion"].ToString();
                    objecion.Estado = Convert.ToBoolean(objReader["Estado"]);
                }
            }
            catch (Exception ex)
            {
                Base.Log.Log.EscribirLog(ex.Message);
                return(null);
            }
            finally
            {
                if (objReader != null)
                {
                    objReader.Close();
                }
            }
            return(objecion);
        }