示例#1
0
  public static void saveStylist(Stylist stylist, String password1, String password2) {

    System.out.println("Add saveStylist");

    if (password1.equals(password2)) {
      Account acct = new Account();
      acct.email = stylist.email;
      acct.password = password1;
      acct.type = UserTypes.STYLIST;
      acct.save();

      stylist.acctId = new ObjectId(acct.id.toString());
      stylist.save();
      Salon salon = Salon.read(stylist.salonKey);

      String text =
          "Hi, A stylist how may work at your salon has just created an account with the username "
              + stylist.username
              + " you may wish to add them to your list of stylists.";
      String[] to = {salon.email};
      String from = "*****@*****.**";

      Email msg = new Email(text, to, from, "Stylist just signed up", "Repinzle");
      msg.sendMessage();

      Do.login(acct.email, acct.password);

      View.stylist(stylist.username);
    } else {
      stylist("The passwords entered do not match");
    }
  }
示例#2
0
  public static void savePictureData(
      String url,
      String styles,
      String colors,
      String length,
      String brands,
      String salonKey,
      String stylistUsername,
      String userUsername) {

    Picture pic = Picture.read(url);

    pic.styles = Tag.convertStringListToTagList(Arrays.asList(styles.split("\\s*,\\s*")));
    pic.colors = Tag.convertStringListToTagList(Arrays.asList(colors.split("\\s*,\\s*")));
    pic.length = Tag.convertStringListToTagList(Arrays.asList(length.split("\\s*,\\s*")));
    pic.brands = Tag.convertStringListToTagList(Arrays.asList(brands.split("\\s*,\\s*")));

    pic.salon = Salon.read(salonKey);
    pic.stylist = Stylist.readByUsername(stylistUsername);
    pic.user = User.read(userUsername);

    pic.salonKey = salonKey;
    pic.stylistUsername = stylistUsername;
    pic.userUsername = userUsername;

    pic.save();
  }
示例#3
0
  public static void picture() {

    List<Salon> salons = Salon.listAll();
    List<Stylist> stylists = Stylist.listAll();
    List<User> users = User.listAll();

    render(salons, stylists, users);
  }
示例#4
0
  public static void user() {

    List<Salon> salons = Salon.listAll();
    List<Stylist> stylists = Stylist.listAll();
    String userid = session.get("userid");
    User user = User.read(userid);

    render(salons, stylists, user);
  }
示例#5
0
  public static void stylistToSalon(String salonId, String stylistId) {

    Salon salon = Salon.read(new ObjectId(salonId));
    Stylist stylist = Stylist.read(new ObjectId(stylistId));
    if (!salon.stylists.contains(stylist)) {
      salon.stylists.add(stylist);
      salon.save();
    }

    Edit.salon(salon.key);
  }
示例#6
0
  public static void saveUser(User user) {

    String userid = session.get("userid");
    String email = session.get("useremail");

    User u = User.read(userid);
    u.realname = user.realname;
    u.stylistUsername = user.stylistUsername;
    u.stylist = Stylist.readByUsername(user.stylistUsername);
    u.save();

    Account acct = Account.read(email);
    Do.login(acct.email, acct.password);

    View.user(u.userid.toString());
  }