コード例 #1
0
 private void OnSubmitOrder()
 {
     if (_CurrentOrder.CustomerId != Guid.Empty && _CurrentOrder.OrderItems.Count > 0)
     {
         HSServiceClient proxy = new HSServiceClient("BasicHttpBinding_IHSService");
         try
         {
             proxy.SubmitOrder(_CurrentOrder);
             CurrentOrder               = new Order();
             CurrentOrder.OrderDate     = DateTime.Now;
             CurrentOrder.OrderStatusId = 1;
             Items = new ObservableCollection <OrderItemModel>();
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error saving order, please try again later.");
         }
         finally
         {
             proxy.Close();
         }
     }
     else
     {
         MessageBox.Show("You must select a customer and add order items to submit an order");
     }
 }
コード例 #2
0
        private void LoadProductsAndCustomers()
        {
            HSServiceClient proxy = new HSServiceClient("BasicHttpBinding_IHSService");

            try
            {
                Products  = proxy.GetProducts();
                Customers = proxy.GetCustomers();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to load server data. " + ex.Message);
            }
            finally
            {
                proxy.Close();
            }
        }