public static void updateGuest() throws IOException, Exception { System.out.println("Enter the guest ID: "); String id = bufferRead.readLine(); System.out.println("Enter the guest's full name, or press enter to skip: "); String name = bufferRead.readLine().trim(); while (!Guest.isNameLengthValid(name)) { System.out.println("Invalid: Please enter a name that is " + "less than 30 characters: "); name = bufferRead.readLine(); } if (name.length() == 0) { name = null; } System.out.println("Please enter the guest's address, or press enter to skip: "); String address = bufferRead.readLine(); if (address.length() == 0) { address = null; } // call add guest Guest.update(conn, id, name, address); }
@Override @Transactional public void addGuest(Guest guest) { jdbcTemplate.update( "INSERT INTO Guest (NAME, email, dateOfVisit) VALUES (?, ?, ?)", guest.getName(), guest.getEmail(), guest.getDateOfVisit()); }
@Override public void bindView(View view, Context context, Cursor cursor) { // Get the guest from the current row Guest guest = mGuestCursor.getGuest(); // if the guest is on the guestlist it will be shown // set up the name TextView TextView nameTextView = (TextView) view.findViewById(R.id.guest_list_nameTextView); nameTextView.setText(guest.getName()); }
/** * Method return true if the Guest is on the given Guestlist * * @param GuestList * @param Guest * @return boolean true if guest on guestlist */ public boolean isOnGuestList(long glID, Guest guest) { GuestDatabaseHelper.GuestListSCursor cursor = mGuestDBHelper.getAllGuest(glID); cursor.moveToFirst(); if (!cursor.isAfterLast()) if (cursor.getGuestListS() == guest.getID()) return true; return false; }
public static void deleteGuest() throws IOException, Exception { System.out.println("Enter the guest ID: "); String id = bufferRead.readLine(); // call delete guest Guest.delete(conn, id); }
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.action_add) { Guest NEWguest = GuestListBank.get(getActivity()).insertGuest(); GuestListBank.get(getActivity()).inserGuestToGuestList(smGuestList.getId(), NEWguest); Intent i = new Intent(getActivity(), GuestActivity.class); i.putExtra(GuestFragment.EXTRA_GUEST_ID, NEWguest.getID()); i.putExtra(GuestFragment.EXTRA_GUEST_LIST_ID, smGuestList.getId()); startActivityForResult(i, REQUEST_CODE_GUESTFRAGMENT_CHANGE); Log.d(TAG, "Added new guest " + NEWguest.getID() + " to guestlist " + smGuestList.getId()); } return super.onOptionsItemSelected(item); }
public static void addGuest() throws IOException, Exception { // Get guestname, address System.out.println("Enter the guest's full name:"); String name = bufferRead.readLine(); while (!Guest.isNameValid(name)) { System.out.println( "Invalid: Please enter a non-empty value that is " + "less than 30 characters: "); name = bufferRead.readLine(); } System.out.println("Enter the guest's address"); String address = bufferRead.readLine(); // call add guest Guest.add(conn, name, address); return; }
public FileSystem(MyDriveManager mdm) { super(); setMyDriveManager(mdm); super.setIdSeed(0); Root root = new Root(); this.addUsers(root); try { super.setFsRoot( new Directory(this.generateUniqueId(), PATH_DELIM, root.getUmask(), root, this)); } catch (InvalidFileNameException | InvalidMaskException e) { /* This exception should not occur it only exists to protect the method against * bad programming */ log.trace(e.getMessage()); e.printStackTrace(); } Directory home = new Directory(generateUniqueId(), HOME_DIR, root.getUmask(), root, getSlash()); addToSlash(home); Directory rootHomeDirectory = new Directory(generateUniqueId(), root.getUsername(), root.getUmask(), root, home); home.addFile(rootHomeDirectory); root.setHomeDirectory((Directory) home.getFileByName(ROOT_USER)); Guest guest = new Guest(); Directory guestHomeDirectory = new Directory(generateUniqueId(), guest.getUsername(), guest.getUmask(), guest, home); home.addFile(guestHomeDirectory); guest.setHomeDirectory((Directory) home.getFileByName(GUEST_USER)); addUsers(guest); }
public Guest insertGuest() { Guest guest = new Guest(); guest.setID(mGuestDBHelper.insertGuest(guest)); return guest; }