Exemple #1
0
        /// <summary>
        ///    Deletes the current selected customer.
        /// </summary>
        /// <param name="customer">The current customer to delete.</param>
        public void DeleteCustomers(CustomerDTO customer)
        {
            try
            {
                //remove customer
                var client = new ERPModuleServiceClient();

                client.RemoveCustomerCompleted += delegate(object o, AsyncCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        //refresh customer list
                        this.GetCustomers();
                    }
                    else if (e.Error is FaultException <ServiceError> )
                    {
                        var fault = e.Error as FaultException <ServiceError>;
                        MessageBox.Show(fault.Detail.ErrorMessage, "Error", MessageBoxButton.OK);
                    }
                    else
                    {
                        Debug.WriteLine("DeleteCustomers: Error at Service:" + e.Error.ToString());
                    }
                };

                client.RemoveCustomerAsync(customer.Id);
            }
            catch (FaultException <ServiceError> ex) {
                Debug.WriteLine("DeleteCustomers: Error at Service:" + ex.ToString());
            }
        }
        private void DeleteExecute(Object o)
        {
            if (o == null)
            {
                return;
            }

            try
            {
                if (o is CustomerListDTO)
                {
                    var current = (CustomerListDTO)o;
                    var client  = new ERPModuleServiceClient();
                    client.RemoveCustomerCompleted += delegate(object sender, AsyncCompletedEventArgs e)
                    {
                        if (e.Error == null)
                        {
                            GetCustomers();
                        }
                        else if (e.Error is FaultException <ServiceError> )
                        {
                            var fault = e.Error as FaultException <ServiceError>;
                            MessageBox.Show(fault.Detail.ErrorMessage, "Error", MessageBoxButton.OK);
                        }
                        else
                        {
                            Debug.WriteLine("DeleteExecute: Error at Service:" + e.Error.ToString());
                        }
                    };

                    client.RemoveCustomerAsync(current.Id);
                }
                Debug.WriteLine("Delete Customer.");
            }
            catch (FaultException <ServiceError> excep)
            {
                Debug.WriteLine("DeleteExecute: Error at Service:" + excep.ToString());
            }
        }
        private void DeleteExecute(Object o)
        {
            if (o == null) return;

            try
            {
                if (o is CustomerListDTO)
                {
                    var current = (CustomerListDTO)o;
                    var client = new ERPModuleServiceClient();
                    client.RemoveCustomerCompleted += delegate(object sender, AsyncCompletedEventArgs e)
                    {
                        if (e.Error == null)
                        {
                            GetCustomers();
                        }
                        else if (e.Error is FaultException<ServiceError>)
                        {
                            var fault = e.Error as FaultException<ServiceError>;
                            MessageBox.Show(fault.Detail.ErrorMessage, "Error", MessageBoxButton.OK);
                        }
                        else
                        {
                            Debug.WriteLine("DeleteExecute: Error at Service:" + e.Error.ToString());
                        }
                    };

                    client.RemoveCustomerAsync(current.Id);
                }
                Debug.WriteLine("Delete Customer.");
            }
            catch (FaultException<ServiceError> excep)
            {
                Debug.WriteLine("DeleteExecute: Error at Service:" + excep.ToString());
            }
        }
        /// <summary>
        /// Deletes the current selected customer.
        /// </summary>
        /// <param name="customer">The current customer to delete.</param>
        public void DeleteCustomers(CustomerDTO customer)
        {
            try
            {
                //remove customer
                var client = new ERPModuleServiceClient();

                client.RemoveCustomerCompleted += delegate(object o, AsyncCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        //refresh customer list
                        this.GetCustomers();
                    }
                    else if (e.Error is FaultException<ServiceError>)
                    {
                        var fault = e.Error as FaultException<ServiceError>;
                        MessageBox.Show(fault.Detail.ErrorMessage, "Error", MessageBoxButton.OK);
                    }
                    else
                    {
                        Debug.WriteLine("DeleteCustomers: Error at Service:" + e.Error.ToString());
                    }
                };

                client.RemoveCustomerAsync(customer.Id);
            }
            catch (FaultException<ServiceError> ex)
            {
                Debug.WriteLine("DeleteCustomers: Error at Service:" + ex.ToString());
            }
        }