Exemple #1
0
  public static void picToSalon(String salonId, File pic, String milliTime) throws IOException {

    Salon salon = Salon.read(new ObjectId(salonId));
    salon.saveSalonImage(pic, milliTime);

    Edit.salon(salon.key);
  }
Exemple #2
0
  public static void saveSalon(Salon salon, String password1, String password2) {

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

    if (password1.equals(password2)) {
      Account acct = new Account();
      acct.email = salon.email;
      acct.password = password1;
      acct.type = UserTypes.SALON;
      acct.save();
      salon.acctId = acct.id;
      salon.save();

      String text =
          "Hi, your Repinzle account has been created. Your temporary password is: "
              + acct.password;
      String[] to = {salon.email};
      String from = "*****@*****.**";

      Email msg = new Email(text, to, from, "Confirm your Repinzle salon account", "Repinzle");
      msg.sendMessage();

      View.salon(salon.key);
    } else {
      salon("The passwords entered do not match");
    }
  }
Exemple #3
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);
  }
Exemple #4
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();
  }
Exemple #5
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");
    }
  }
Exemple #6
0
  public static void picture() {

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

    render(salons, stylists, users);
  }
Exemple #7
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);
  }
Exemple #8
0
 public static void stylist(String msg) {
   List<Salon> salons = Salon.listAll();
   render(salons);
 }