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); }
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); }