private void getButton_Click(object sender, RoutedEventArgs e) { string item = itemTextBox.Text; using (var client = new CustomerSupportClient()) { int stock = client.Inquire(item); quantityTextBox.Text = stock.ToString(); } }
private void buyButton_Click(object sender, RoutedEventArgs e) { string item = itemTextBox.Text; int quantity = int.Parse(quantityTextBox.Text); using (var client = new CustomerSupportClient()) { Receipt purchase = client.Purchase(item, quantity); if (purchase.Status != 0) { purchases.Add(new PurchaseEntry { Order = purchase.Status, Item = item, Quantity = quantity, Amount = purchase.Payment }); } else { MessageBox.Show("Not available!", this.Title, MessageBoxButton.OK, MessageBoxImage.Exclamation); } } }