示例#1
0
 public static string RemoteCommandResponse(string Command)
 {
     if (ClientDDM != null && !ClientDDM.isClosed())
     {
         java.util.List lstMessages = ClientDDM.executeReturnMessageList(Command);
         if (lstMessages == null || lstMessages.size() == 0)
         {
             return("");
         }
         else
         {
             for (int msgidx = 0; msgidx < lstMessages.size(); msgidx++)
             {
                 com.ibm.jtopenlite.Message msg = (com.ibm.jtopenlite.Message)lstMessages.get(0);
                 if (msg.getSeverity() > 10)
                 {
                     return(msg.getText());
                 }
             }
         }
         // Get here means no messages with Sev > 10, so ok
         return("");
     }
     else
     {
         return("Not connected.");
     }
 }
示例#2
0
 //Returns true if successful
 public static bool RemoteCommand(string Command, bool ShowError = true)
 {
     if (ClientDDM != null && !ClientDDM.isClosed())
     {
         try
         {
             java.util.List lstMessages = ClientDDM.executeReturnMessageList(Command);
             if (lstMessages == null || lstMessages.size() == 0)
             {
                 return(true);
             }
             else
             {
                 for (int msgidx = 0; msgidx < lstMessages.size(); msgidx++)
                 {
                     com.ibm.jtopenlite.Message msg = (com.ibm.jtopenlite.Message)lstMessages.get(msgidx);
                     if (msg.getSeverity() > 1) // DDM returns sev 0-8 range (AS400 severity / 10 if you will )
                     {
                         if (ShowError)
                         {
                             MessageBox.Show(msg.getText(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         }
                         return(false);
                     }
                 }
             }
             // Get here means no messages with Sev > 10, so ok
             return(true);
         } catch (Exception ex)
         {
             // command failed.
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }