Ejemplo n.º 1
0
  public ArrayList<Reply> getData() {
    Query q = new Query();
    // 쿼리문 수정하기 매장이름,등은 이제 받은걸로 교체해야함
    String query =
        "select id, user_id, star_cnt, content, reg_date, answer from reply "
            + "where shop_name="
            + "(select shop_name from sellers where email='"
            + email
            + "') "
            + "and answer='0' order by reg_date;";

    String tmp = q.send(query);

    tmp = Query.doParse(tmp);

    if (tmp == null) {
      return null;
    }

    String forSplit[] = tmp.split("\n");
    Reply reply = null;
    ArrayList<Reply> replyData = new ArrayList<Reply>();
    for (int i = 0; i < forSplit.length; i++) {
      reply = ReplyTranslator.queryToReply(forSplit[i]);
      replyData.add(reply);
    }
    return replyData;
  }
Ejemplo n.º 2
0
  public void updateClients() {
    String message;
    int online = Query.online();

    if (online > 0) message = String.format("Online %d clients", online);
    else message = "There is not clients online";

    field_clients_online.setText(message);

    ArrayList<Client> list = Query.listOnline();
    String[] map = new String[list.size()];

    for (int i = 0; i < list.size(); i++) map[i] = String.format("%s", list.get(i).name);

    if (!combo_clients_online.isPopupVisible())
      combo_clients_online.setModel(new DefaultComboBoxModel<String>(map));
  }
Ejemplo n.º 3
0
  public ArrayList<Product> getProducts() {
    ArrayList<Product> result = new ArrayList<Product>();

    query += "where shop_email ='" + keyword + "';";

    String str = q.send(query);
    if (str == null) {
      return null;
    }

    String tmp = Query.doParse(str);
    if (tmp == null) {
      System.out.println("Error : Category.java");
      return null;
    }

    String products[] = tmp.split("\n");
    Product p;
    for (int i = 0; i < products.length; i++) {
      p = ProductTranslator.queryToProduct(products[i]);
      result.add(p);
    }
    return result;
  }