Пример #1
0
 private void OnSubmitOrder()
 {
     if (_CurrentOrder.CustomerId != Guid.Empty && _CurrentOrder.OrderItems.Count > 0)
     {
         PosServiceClient proxy = new PosServiceClient("NetTcpBinding_IPosService");
         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." + ex);
             // Log it
         }
         finally
         {
             proxy.Close();
         }
     }
     else
     {
         MessageBox.Show("You must select a customer and add order items to submit an order");
     }
 }
Пример #2
0
 public Boolean connectToServer(int id)
 {
     ins = new InstanceContext(new PosCBHandler(posf));
     possclient = new PosServiceClient(ins);
     try
     {
         possclient.subscribePos(id);
     }
     catch (EndpointNotFoundException enfe)
     {
         MessageBox.Show(enfe.Message,"Connection timedout");
         return false;
     }
     return true;
 }