public Terminal[] GetTerminals(string agentNumber) { //Returns a list of terminals Terminal[] terminals = null; IssueMgtServiceClient _Client = null; try { _Client = new IssueMgtServiceClient(); Terminal[] ts = _Client.GetTerminals(); if (agentNumber == null) { terminals = new Terminal[ts.Length + 1]; Terminal all = new Terminal(); all.AgentID = ""; all.Description = "All"; terminals[0] = all; for (int i = 0; i < ts.Length; i++) { terminals[i + 1] = ts[i]; } } else { terminals = new Terminal[1]; for (int i = 0; i < ts.Length; i++) { if (ts[i].AgentID == agentNumber) { terminals[0] = ts[i]; break; } } } _Client.Close(); } catch (FaultException fe) { throw new ApplicationException("GetTerminals() service error.", fe); } catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetTerminals() timeout error.", te); } catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetTerminals() communication error.", ce); } return(terminals); }