示例#1
0
        public List <AppMenu> getAllbyRol(int rolid, ref string mensaje)
        {
            List <AppMenu> menus = new List <AppMenu>();

            sql = new ConsultasSQL();
            sql.Comando.CommandType = CommandType.StoredProcedure;
            sql.Comando.CommandText = "pa_getMenu";
            sql.Comando.Parameters.AddWithValue("@RolID", rolid);

            try
            {
                sql.AbrirConexion();
                IDataReader reader = sql.EjecutaReader(ref mensaje);
                while (reader.Read())
                {
                    menus.Add(AppMenu.CreateAppMenuFromDataRecord(reader));
                }
            }
            catch (Exception ex)
            {
                mensaje = ex.Message;
            }
            finally
            {
                sql.CerrarConexion();
            }

            return(menus);
        }