private void btnUpdate_Click(object sender, RoutedEventArgs e) { if (txtQty.Text == "") { MessageBox.Show("Invalid input!"); return; } object id_obj = ((Button)sender).CommandParameter; int id; int.TryParse(id_obj.ToString(), out id); int qty; bool success = int.TryParse(txtQty.Text, out qty); if (success) { TicketTransactionController.getInstance().update(id, qty); MessageBox.Show("Success update transaction!"); } else { MessageBox.Show("Quantity must be numeric!"); } txtQty.Clear(); load(); }
private void load() { txtName.Text = "Good to see you back, " + employee.Name + "!"; viewTransaction.ItemsSource = TicketTransactionController.getInstance().getAll(); viewTicket.ItemsSource = TicketController.getInstance().getAll(); viewPers.ItemsSource = getPersList(); }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { if (txtQty.Text == "") { MessageBox.Show("Ticket's quantity must be inputted!"); return; } int qty; bool success = int.TryParse(txtQty.Text, out qty); if (success) { TicketTransactionController.getInstance().add(employee.Id, qty); MessageBox.Show("Success add transaction!"); } else { MessageBox.Show("Quantity must be numeric!"); } txtQty.Clear(); load(); }