Пример #1
0
 /** @see cmdCore.ICommand#doIt() */
 public UCommandStatus doIt() {
   try {
     fServerTimeInfo.clear();
     fStatus = fUMart.doServerTime(fServerTimeInfo);
     if (fStatus.getStatus()) {
       fAgent.sendMessage("+ACCEPT");
       fAgent.sendMessage(fServerTimeInfo.get(STRING_SERVER_TIME).toString());
     } else {
       fAgent.sendMessage("+ERROR " + fStatus.getErrorCode());
       fAgent.sendMessage(fStatus.getErrorMessage());
     }
   } catch (Exception e) {
     System.err.println("Error in UCServerTime.doIt");
     System.exit(5);
   }
   fAgent.flushMessage();
   return fStatus;
 }
Пример #2
0
 /** @see cmdCore.ICommand#doIt() */
 public UCommandStatus doIt() {
   try {
     fSpotArray.clear();
     fStatus = fUMart.doSpotPrice(fSpotArray, fBrandName, fNoOfSteps);
     if (fStatus.getStatus()) {
       fAgent.sendMessage("+ACCEPT");
       Iterator itr = fSpotArray.iterator();
       while (itr.hasNext()) {
         HashMap hm = (HashMap) itr.next();
         String result = "";
         result += hm.get(STRING_BRAND_NAME).toString();
         result += " " + hm.get(INT_DAY).toString();
         result += ":" + hm.get(INT_BOARD_NO).toString();
         result += ":" + hm.get(INT_STEP).toString();
         result += " " + hm.get(LONG_PRICE).toString();
         fAgent.sendMessage(result);
       }
     } else {
       fAgent.sendMessage("+ERROR " + fStatus.getErrorCode());
       fAgent.sendMessage(fStatus.getErrorMessage());
     }
   } catch (Exception e) {
     fAgent.sendMessage("+ERROR " + ICommand.INVALID_ARGUMENTS);
     fAgent.sendMessage("USAGE: ORDERCANCEL <ORDERID>");
   }
   fAgent.flushMessage();
   return fStatus;
 }