示例#1
0
  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());
 }
示例#3
0
    @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());
    }
示例#4
0
  /**
   * 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;
  }
示例#5
0
  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);
  }
示例#6
0
  @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);
  }
示例#7
0
  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);
  }
示例#9
0
 public Guest insertGuest() {
   Guest guest = new Guest();
   guest.setID(mGuestDBHelper.insertGuest(guest));
   return guest;
 }