コード例 #1
0
 public boolean saveMove(CashMove move) throws BasicException {
   try {
     ServerLoader loader = new ServerLoader();
     ServerLoader.Response r =
         loader.write(
             "CashMvtsAPI",
             "move",
             "cashId",
             move.getCashId(),
             "date",
             String.valueOf(DateUtils.toSecTimestamp(move.getDate())),
             "note",
             move.getNote(),
             "payment",
             move.getPayment().toJSON().toString());
     if (r.getStatus().equals(ServerLoader.Response.STATUS_OK)) {
       return true;
     } else {
       return false;
     }
   } catch (Exception e) {
     e.printStackTrace();
     throw new BasicException(e);
   }
 }
コード例 #2
0
 // Tickets and Receipt list
 public List<TicketInfo> searchTickets(
     Integer ticketId,
     Integer ticketType,
     String cashId,
     Date start,
     Date stop,
     String customerId,
     String userId)
     throws BasicException {
   try {
     ServerLoader loader = new ServerLoader();
     ServerLoader.Response r =
         loader.read(
             "TicketsAPI",
             "search",
             "ticketId",
             ticketId != null ? ticketId.toString() : null,
             "ticketType",
             ticketType != null ? ticketType.toString() : null,
             "cashId",
             cashId,
             "dateStart",
             start != null ? String.valueOf(DateUtils.toSecTimestamp(start)) : null,
             "dateStop",
             stop != null ? String.valueOf(DateUtils.toSecTimestamp(stop)) : null,
             "customerId",
             customerId,
             "userId",
             userId);
     if (r.getStatus().equals(ServerLoader.Response.STATUS_OK)) {
       JSONArray a = r.getArrayContent();
       List<TicketInfo> list = new ArrayList<TicketInfo>();
       for (int i = 0; i < a.length(); i++) {
         JSONObject o = a.getJSONObject(i);
         list.add(new TicketInfo(o));
       }
       return list;
     } else {
       return null;
     }
   } catch (Exception e) {
     e.printStackTrace();
     throw new BasicException(e);
   }
 }