/** * Have the connected user buy the products in the checkout, adding the total cost to the users * bill, taking the number bought from the products in the database and clearing both the user and * the checkout */ public static void checkOutItems() { LinkedList<String> purchased = checkOuts.productBought(); // clear the quantities and checkout LoggingDatabase.logItemsOut(purchased, userID); checkOuts = new CheckOut(); // ensure checkout clear userName = null; userID = null; }
/** * Takes the given (prehashed) password and set it as the admin password * * @param PW The prehashed password to be set */ public static int setPassword(String barcode, String PW, String adBarcode, String adPass) { if (isUserAdmin(adBarcode) && passwordsEqual(adBarcode, adPass)) { if (personDatabase.entryExists(barcode)) { String[] pass; try { pass = getSecurePassword(PW, getSalt()); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return -1; } personDatabase.setPassword(barcode, pass[0], pass[1]); LoggingDatabase.appendPasswordLog(barcode, adBarcode); return 0; } return 1; } return 2; }
public static ArrayList<ItemLog> getItemLog(boolean outOnly) { return LoggingDatabase.getItemLog(outOnly); }
public static ArrayList<ItemLog> getItemLog(boolean outOnly, LocalDate from, LocalDate to) { return LoggingDatabase.getItemLog(outOnly, from, to); }
public static ArrayList<PasswordLog> getPasswordLog(LocalDate from, LocalDate to) { return LoggingDatabase.getPasswordLog(from, to); }
public static ArrayList<PasswordLog> getPasswordLog() { return LoggingDatabase.getPasswordLog(); }
public static void signItemsIn(ArrayList<ReturnItem> items) { loggingDatabase.signItemsIn(items, getUserName(userID)); returnCheckOut = new ReturnCheckOut(); }
public static ArrayList<String> getOutItemPersIDs() { return loggingDatabase.getOutItemPersIDs(); }
public static ArrayList<inventoryManager.formatters.ReturnItem> getOutItems(String search) { return loggingDatabase.getOutItems(search); }