Exemplo n.º 1
0
        private void CancelExecute()
        {
            try
            {
                var client = new ERPModuleServiceClient();

                client.FindCustomerCompleted += delegate(object sender, FindCustomerCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        if (e.Result != null)
                        {
                            Customer = 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("CancelExecute: Error at Service:" + e.Error.ToString());
                    }
                };

                client.FindCustomerAsync(Customer.Id);
            }
            catch (FaultException <ServiceError> excep)
            {
                Debug.WriteLine("CancelExecute: Error at Service:" + excep.ToString());
            }

            ((MainPage)App.Current.RootVisual).GoBackEditCustomer.Begin();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VMEditCustomer"/> class.
        /// </summary>
        /// <param name="customerCode">The customer code of the current user.</param>
        public VMEditCustomer(Guid customerCode)
        {
            try
            {
                var client = new ERPModuleServiceClient();

                client.FindCustomerCompleted += delegate(object sender, FindCustomerCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        if (e.Result != null)
                        {
                            Customer = 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("VMEditCustomer: Error at Service:" + e.Error.ToString());
                    }
                };

                client.FindCustomerAsync(customerCode);
            }
            catch (FaultException <ServiceError> excep)
            {
                Debug.WriteLine("VMEditCustomer: Error at Service:" + excep.ToString());
            }
        }
        private void ViewExecute(Object o)
        {
            try
            {
                if (o is CustomerListDTO)
                {
                    var current = (CustomerListDTO)o;
                    var client  = new ERPModuleServiceClient();

                    client.FindCustomerCompleted += delegate(object sender, FindCustomerCompletedEventArgs e)
                    {
                        if (e.Error == null)
                        {
                            if (e.Result != null)
                            {
                                ((MainPage)App.Current.RootVisual).viewCustomer.DataContext = new VMCustomer(e.Result);
                                ((MainPage)App.Current.RootVisual).ViewCustomer.Begin();
                            }
                        }
                        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("ViewExecute: Error at Service:" + e.Error.ToString());
                        }
                    };

                    client.FindCustomerAsync(current.Id);
                }
            }
            catch (FaultException <ServiceError> excep)
            {
                Debug.WriteLine("ViewExecute: Error at Service:" + excep.ToString());
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the customer info by id.
        /// </summary>
        /// <param name="id">The current customer id.</param>
        private void GetCustomerInfoById(Guid id)
        {
            var client = new ERPModuleServiceClient();

            client.FindCustomerAsync(id);
            client.FindCustomerCompleted += delegate(object s, FindCustomerCompletedEventArgs args)
            {
                if (args.Error == null)
                {
                    Customer = args.Result;
                    GetCustomerOrders();
                }
                else if (args.Error is FaultException <ServiceError> )
                {
                    var fault = args.Error as FaultException <ServiceError>;
                    Debug.WriteLine("GetFirstCustomer: Error at Service:" + fault.ToString());
                }
                else
                {
                    Debug.WriteLine("GetFirstCustomer: Error at Service:" + args.Error.ToString());
                }
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="VMEditCustomer"/> class.
        /// </summary>
        /// <param name="customerCode">The customer code of the current user.</param>
        public VMEditCustomer(Guid customerCode)
        {
            try
            {
                var client = new ERPModuleServiceClient();

                client.FindCustomerCompleted += delegate(object sender, FindCustomerCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        if (e.Result != null)
                        {
                            Customer = 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("VMEditCustomer: Error at Service:" + e.Error.ToString());
                    }
                };

                client.FindCustomerAsync(customerCode);
            }
            catch (FaultException<ServiceError> excep)
            {
                Debug.WriteLine("VMEditCustomer: Error at Service:" + excep.ToString());
            }
        }
        private void CancelExecute()
        {
            try
            {
                var client = new ERPModuleServiceClient();

                client.FindCustomerCompleted += delegate(object sender, FindCustomerCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        if (e.Result != null)
                        {
                            Customer = 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("CancelExecute: Error at Service:" + e.Error.ToString());
                    }
                };

                client.FindCustomerAsync(Customer.Id);
            }
            catch (FaultException<ServiceError> excep)
            {
                Debug.WriteLine("CancelExecute: Error at Service:" + excep.ToString());
            }

            ((MainPage)App.Current.RootVisual).GoBackEditCustomer.Begin();
        }
        private void ViewExecute(Object o)
        {
            try
            {
                if (o is CustomerListDTO)
                {
                    var current = (CustomerListDTO)o;
                    var client = new ERPModuleServiceClient();

                    client.FindCustomerCompleted += delegate(object sender, FindCustomerCompletedEventArgs e)
                    {
                        if (e.Error == null)
                        {
                            if (e.Result != null)
                            {
                                ((MainPage)App.Current.RootVisual).viewCustomer.DataContext = new VMCustomer(e.Result);
                                ((MainPage)App.Current.RootVisual).ViewCustomer.Begin();
                            }
                        }
                        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("ViewExecute: Error at Service:" + e.Error.ToString());
                        }
                    };

                    client.FindCustomerAsync(current.Id);
                }
            }
            catch (FaultException<ServiceError> excep)
            {
                Debug.WriteLine("ViewExecute: Error at Service:" + excep.ToString());
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// Gets the customer info by id.
 /// </summary>
 /// <param name="id">The current customer id.</param>
 private void GetCustomerInfoById(Guid id)
 {
     var client = new ERPModuleServiceClient();
     client.FindCustomerAsync(id);
     client.FindCustomerCompleted += delegate(object s, FindCustomerCompletedEventArgs args)
     {
         if (args.Error == null)
         {
             Customer = args.Result;
             GetCustomerOrders();
         }
         else if (args.Error is FaultException<ServiceError>)
         {
             var fault = args.Error as FaultException<ServiceError>;
             Debug.WriteLine("GetFirstCustomer: Error at Service:" + fault.ToString());
         }
         else
         {
             Debug.WriteLine("GetFirstCustomer: Error at Service:" + args.Error.ToString());
         }
     };
 }