private void user_add(String[] cmd) throws IOException { if (cmd.length == 3 && logged) { if (DBAccount.getInstance().isAccountExist(cmd[1])) OutputWrite("user_add=error;message=Account esistente"); else { boolean b = DBAccount.getInstance().registra(cmd[1], cmd[2]); if (b) OutputWrite("user_add=OK"); else OutputWrite("user_add=error;message=Errore durante la registrazione"); } } else OutputWrite("user_add=error"); }
private void user_delete_username(String[] cmd) throws IOException { if (cmd.length == 2) { if (logged) { boolean del = DBAccount.getInstance().cancellaAccount(cmd[1]); OutputWrite("user_delete_username="******"OK" : "error")); } else { OutputWrite("user_delete_username=error"); } } else { OutputWrite("user_delete_username=error"); } }
private void user_delete_id(String[] cmd) throws IOException { if (cmd.length == 2) { if (logged) { try { Integer id = Integer.parseInt(cmd[1]); boolean del = DBAccount.getInstance().cancellaAccount(id); OutputWrite("user_delete_id=" + (del ? "OK" : "error")); } catch (NumberFormatException e) { OutputWrite("user_delete_id=error"); } } else { OutputWrite("user_delete_id=error"); } } else { OutputWrite("user_delete_id=error"); } }