コード例 #1
0
        /// <summary>
        ///    Gets the customer list.
        /// </summary>
        private void GetCustomers()
        {
            try
            {
                var client = new ERPModuleServiceClient();

                client.FindCustomersInPageCompleted += delegate(object sender, FindCustomersInPageCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        Customers = e.Result;
                    }
                    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("GetCustomers: Error at Service:" + e.Error.ToString());
                    }
                };

                client.FindCustomersInPageAsync(0, 100);
            }
            catch (FaultException <ServiceError> excep) {
                Debug.WriteLine("GetCustomers: Error at Service:" + excep.ToString());
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets the customer list.
        /// </summary>
        public void GetCustomers()
        {
            try
            {
                var client = new ERPModuleServiceClient();

                client.FindCustomersInPageCompleted += delegate(object sender, FindCustomersInPageCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        ObservableCollection <CustomerListDTO> listCustomers = e.Result;
                        if (listCustomers != null)
                        {
                            if (listCustomers.Count > 0)
                            {
                                Customers = listCustomers;
                            }
                            if (listCustomers.Count == 0)
                            {
                                if (this.CurrentPage > 1)
                                {
                                    this.CurrentPage--;
                                }
                            }
                        }
                        else
                        {
                            if (this.CurrentPage > 1)
                            {
                                this.CurrentPage--;
                            }
                        }
                    }
                    else
                    {
                        Debug.WriteLine("GetCustomers: Error at Service:" + e.Error.ToString());
                    }
                };

                client.FindCustomersInPageAsync(this.CurrentPage, 4);
            }
            catch (Exception excep)
            {
                Debug.WriteLine("GetCustomers: Error at Service:" + excep.ToString());
            }
        }
コード例 #3
0
        /// <summary>
        /// Gets the first customer.
        /// </summary>
        private void GetFirstCustomer()
        {
            try
            {
                var client = new ERPModuleServiceClient();

                client.FindCustomersInPageAsync(0, 10);

                client.FindCustomersInPageCompleted += delegate(object sender, FindCustomersInPageCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        ObservableCollection <CustomerListDTO> listCustomers = e.Result;
                        if (listCustomers != null && listCustomers.Count > 0)
                        {
                            if (listCustomers.Any())
                            {
                                var id = listCustomers.First().Id;
                                GetCustomerInfoById(id);
                            }
                        }
                    }
                    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("GetFirstCustomer: Error at Service:" + e.Error.ToString());
                    }
                };
            }
            catch (FaultException <ServiceError> excep)
            {
                Debug.WriteLine("GetFirstCustomer: Error at Service:" + excep.ToString());
            }
        }
コード例 #4
0
        /// <summary>
        /// Gets the customer list.
        /// </summary>
        public void GetCustomers()
        {
            try
            {
                var client = new ERPModuleServiceClient();

                client.FindCustomersInPageCompleted += delegate(object sender, FindCustomersInPageCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        ObservableCollection<CustomerListDTO> listCustomers = e.Result;
                        if (listCustomers != null)
                        {
                            if (listCustomers.Count > 0)
                            {
                                Customers = listCustomers;
                            }
                            if (listCustomers.Count == 0)
                            {
                                if (this.CurrentPage > 1)
                                {
                                    this.CurrentPage--;
                                }
                            }
                        }
                        else
                        {
                            if (this.CurrentPage > 1)
                            {
                                this.CurrentPage--;
                            }
                        }
                    }
                    else
                    {
                        Debug.WriteLine("GetCustomers: Error at Service:" + e.Error.ToString());
                    }
                };

                client.FindCustomersInPageAsync(this.CurrentPage, 4);
            }
            catch (Exception excep)
            {
                Debug.WriteLine("GetCustomers: Error at Service:" + excep.ToString());
            }
        }
コード例 #5
0
        /// <summary>
        /// Gets the first customer.
        /// </summary>
        private void GetFirstCustomer()
        {
            try
            {
                var client = new ERPModuleServiceClient();

                client.FindCustomersInPageAsync(0, 10);

                client.FindCustomersInPageCompleted += delegate(object sender, FindCustomersInPageCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        ObservableCollection<CustomerListDTO> listCustomers = e.Result;
                        if (listCustomers != null && listCustomers.Count > 0)
                        {
                            if (listCustomers.Any())
                            {
                                var id = listCustomers.First().Id;
                                GetCustomerInfoById(id);
                            }
                        }
                    }
                    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("GetFirstCustomer: Error at Service:" + e.Error.ToString());
                    }

                };
            }
            catch (FaultException<ServiceError> excep)
            {
                Debug.WriteLine("GetFirstCustomer: Error at Service:" + excep.ToString());
            }
        }
コード例 #6
0
        /// <summary>
        /// Gets the customer list.
        /// </summary>
        private void GetCustomers()
        {
            try
            {
                var client = new ERPModuleServiceClient();

                client.FindCustomersInPageCompleted += delegate(object sender, FindCustomersInPageCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        Customers = e.Result;
                    }
                    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("GetCustomers: Error at Service:" + e.Error.ToString());
                    }
                };

                client.FindCustomersInPageAsync(0, 100);
            }
            catch (FaultException<ServiceError> excep)
            {
                Debug.WriteLine("GetCustomers: Error at Service:" + excep.ToString());
            }
        }