void _client_AddOrderCompleted(object sender, AddOrderCompletedEventArgs e) { if(e.Error == null && e.Result != null) { UserViewModel.viewModel.Orders.Add(e.Result); App.ViewModel.DynDB.Orders.InsertOnSubmit(new Order(e.Result)); foreach(NavOrderItem item in e.Result.OrderItems) { App.ViewModel.DynDB.OrderItems.InsertOnSubmit(new OrderItem(item)); } App.ViewModel.DynDB.SubmitChanges(); } }
private void GarconClient_AddOrderCompleted(object sender, AddOrderCompletedEventArgs e) { var errorMessage = ""; if (e.Error == null) { errorMessage = e.Result; } else { errorMessage = e.Error.Message; } if (string.IsNullOrEmpty(errorMessage)) { _attempt = 0; App.ItensPedidosFinalizados.AddRange(App.ItensPedido); App.ItensPedido = new List <OrderItem>(); DisplayAlertOnMainThread("CONFIRMAÇÃO DO PEDIDO", "Seu pedido foi cadastrado com sucesso.", "FECHAR"); HideProgressDialogOnMainThread(); App.Current.MainPage = new MenuPage(); } else { if (_attempt < 3) { _attempt++; Thread.Sleep(TimeSpan.FromSeconds(2)); AddOrder(); } else { _attempt = 0; DisplayAlertOnMainThread("ERRO NA CONFIRMAÇÃO DO PEDIDO", "Não foi possível cadastrar o pedido, talvez o servidor não esteja respondendo, tente novamente em alguns instantes.\n\nErro: " + errorMessage, "FECHAR"); HideProgressDialogOnMainThread(); } } }
private void SvcClient_AddOrderCompleted(object sender, AddOrderCompletedEventArgs e) { try { // reducing the available stock by the number of items that were ordered. _Inventory.StockQuantity = _Inventory.StockQuantity - _Order.Quantity; // updating the inventory item that the customer has just ordered to reflect the stock changes. pgMain.SvcClient.UpdateItemAsync(_Inventory); MessageBox.Show("Thank you \"" + _Order.CustomerName + "\" for your order. Press OK to browse more brands at Ror's Guitar Bazaar.", "Order Created", MessageBoxButton.OK); NavigationService.Navigate(new Uri("/pgMain.xaml", UriKind.Relative)); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error Processing Order", MessageBoxButton.OK); } }