コード例 #1
0
 /** Assigns a worker by name to a ticket by ID. */
 public static void assignWorker(int ticketNum, String workername) {
   DBHelper db = DBHelperFactory.createDBHelper();
   Account temp = db.retrieveAccount(workername);
   db.updateTicketWorker(ticketNum, temp.get_id());
   db.updateTicketQueue(ticketNum, 1);
   db.close();
 }
コード例 #2
0
  /** Creates a new Annotation with specified text, ticket ID, and worker name. */
  public static void createNewAnnotation(String text, int ticketid, String workername) {
    DBHelper db = DBHelperFactory.createDBHelper();

    java.util.Date date = new java.util.Date();
    java.sql.Timestamp ts = new java.sql.Timestamp(date.getTime());
    Account temp = db.retrieveAccount(workername);

    Annotation anno = ModelFactory.createAnnotation(text, ts, ticketid, temp.get_id());
    db.storeAnnotation(anno);
    db.close();
  }
コード例 #3
0
  /** Returns a String for a workername by workerid. */
  public static String getWorkerName(int workerid) {
    if (workerid == 0) {
      return "TicketSystem";
    }

    DBHelper db = DBHelperFactory.createDBHelper();
    Account temp = db.retrieveAccount(workerid);
    String result = temp.getUsername();

    db.close();
    return result;
  }
コード例 #4
0
  /** Returns an ArrayList of Tickets by worker username. */
  public static ArrayList<Ticket> getActiveTicketsByWorker(String username) {
    DBHelper db = DBHelperFactory.createDBHelper();
    Account temp = db.retrieveAccount(username);
    ArrayList<Ticket> temp2 = db.createTicketArrayListByWorker(temp.get_id());
    ArrayList<Ticket> result = new ArrayList<Ticket>();

    for (int i = 0; i < temp2.size(); i++) {
      if (temp2.get(i).getActive()) {
        result.add(temp2.get(i));
      }
    }

    db.close();
    return result;
  }