Beispiel #1
0
        public Customer[] GetCustomers()
        {
            var client    = new CrmDataServiceChannel();
            var customers = new Customer[] { };

            try
            {
                customers = client.GetCustomers();
                client.Close();
            }
            catch (CommunicationException)
            {
                client.Abort();
                throw;
            }
            catch (TimeoutException)
            {
                client.Abort();
                throw;
            }
            catch (Exception)
            {
                client.Abort();
                throw;
            }

            return(customers);
        }
Beispiel #2
0
        public void UpdateCustomer(Customer customer)
        {
            var client = new CrmDataServiceChannel();

            try
            {
                client.UpdateCustomer(customer);
                client.Close();
            }
            catch (CommunicationException)
            {
                client.Abort();
                throw;
            }
            catch (TimeoutException)
            {
                client.Abort();
                throw;
            }
            catch (Exception)
            {
                client.Abort();
                throw;
            }
        }
Beispiel #3
0
        public Customer GetCustomer(Guid id)
        {
            var      client = new CrmDataServiceChannel();
            Customer customer;

            try
            {
                customer = client.GetCustomer(id);
                client.Close();
            }
            catch (CommunicationException)
            {
                client.Abort();
                throw;
            }
            catch (TimeoutException)
            {
                client.Abort();
                throw;
            }
            catch (Exception)
            {
                client.Abort();
                throw;
            }

            return(customer);
        }