public static Clients GetClients() { //Get client list Clients clients = null; try { _Client = new InvoicingServiceClient(); clients = _Client.GetClients(); _Client.Close(); } catch (FaultException fe) { throw new ApplicationException("GetClients() service error.", fe); } catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetClients() timeout error.", te); } catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetClients() communication error.", ce); } return(clients); }
public static InvoicingDataset GetClients() { //Get client list InvoicingDataset clients = new InvoicingDataset(); InvoicingServiceClient client = null; try { client = new InvoicingServiceClient(); DataSet ds = client.GetClients(); if (ds.Tables["ClientTable"] != null && ds.Tables["ClientTable"].Rows.Count > 0) { clients.Merge(ds); } client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <InvoicingFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(clients); }