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); }
public static InvoicingDataset GetClientInvoices(string clientNumber, string clientDivision, string startDate) { //Get invoices for the specified client InvoicingDataset invoices = new InvoicingDataset(); InvoicingServiceClient client = null; try { client = new InvoicingServiceClient(); DataSet ds = client.GetClientInvoices(clientNumber, clientDivision, startDate); if (ds.Tables["ClientInvoiceTable"] != null && ds.Tables["ClientInvoiceTable"].Rows.Count > 0) { invoices.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(invoices); }