Exemplo n.º 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);
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 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);
        }