// PROGRAMA INTERFACE GRAFICA public void deleteRoom(int chosseRoom) { downloadData(); historic = HistoricFactory.getInstance(); RoomData currentRoom = mapRoomData.get(chosseRoom); System.out.println("\nExcluida a sala e todas as suas sessoes"); mapRoomData.remove(currentRoom.getIdRoom()); mapSessionData.remove(currentRoom.getIdRoom()); historic.AddHistoric(currentRoom, "DELETED"); uploadData(); }
// PROGRAMA BASE private void deleteRoom() { RoomData currentRoom = chooseRoom("delete"); if (currentRoom == null) { System.out.print("\nVoce nao selecionou nenhuma sala"); return; } else { System.out.println("\nExcluida a sala e todas as suas sessoes"); mapRoomData.remove(currentRoom.getIdRoom()); mapSessionData.remove(currentRoom.getIdRoom()); historic.AddHistoric(currentRoom, "DELETED"); uploadData(); } }
/** Modifica uma sala */ private void modifyRoom() { Scanner scanner = new Scanner(System.in); RoomData currentRoom = chooseRoom("modify"); if (currentRoom == null) return; Integer rows = null; Integer columns = null; boolean whatever = false; do { try { System.out.println("\nModificando Sala..."); System.out.print("\nQtd. de fileiras (" + currentRoom.getRows() + "): "); rows = scanner.nextInt(); System.out.print("\nQtd. de colunas (" + currentRoom.getColumns() + "): "); columns = scanner.nextInt(); if (rows <= 0 || columns <= 0) { System.out.println("Valores invalidos para fileira/coluna."); whatever = false; } else whatever = true; } catch (NumberFormatException e) { System.out.printf("%s", e); System.out.println("Erro de formato, insira novamente"); scanner = new Scanner(System.in); } catch (InputMismatchException e) { System.out.printf("%s", e); System.out.println("Insira valores validos"); scanner = new Scanner(System.in); } } while (!whatever); currentRoom.setRows(rows); currentRoom.setColumns(columns); mapRoomData.put(currentRoom.getIdRoom(), currentRoom); historic.AddHistoric(currentRoom, "MODIFIED"); uploadData(); }