示例#1
0
        public ArrayList GetOpcoes()
        {
            ArrayList array = new ArrayList();

            string sql = "SELECT * FROM menu";

            my.ExecuteReader(sql);

            if (my.HasRows())
            {
                while (my.ReadNextRecord())
                {
                    MenuPrincipalDTO dto = new MenuPrincipalDTO
                    {
                        Id        = my.GetInt("id"),
                        Descricao = my.GetString("descricao"),
                        Opcao     = my.GetString("opcao"),
                        Nivel     = my.GetInt("nivel")
                    };
                    array.Add(dto);
                }
            }

            return(array);
        }
示例#2
0
        public ArrayList GetOpcoes(MenuPrincipalDTO pai)
        {
            ArrayList array = new ArrayList();

            string sql = $"SELECT * FROM submenu WHERE menuPai = {pai.Id}";

            my.ExecuteReader(sql);

            if (my.HasRows())
            {
                while (my.ReadNextRecord())
                {
                    SubMenuDTO dto = new SubMenuDTO
                    {
                        Id        = my.GetInt("id"),
                        MenuPai   = pai,
                        Descricao = my.GetString("descricao"),
                        Opcao     = my.GetString("opcao"),
                        Nivel     = my.GetInt("nivel")
                    };
                    array.Add(dto);
                }
            }

            return(array);
        }