private void PayButton_Click(object sender, RoutedEventArgs e) { if (PayTextBox.Text == "0" || PayTextBox.Text == "") { MessageBox.Show("Please enter a value greater than 0", "GOLDLINE", MessageBoxButton.OK); } else if (CustomerIdLabel.Content.ToString() == "" || _selectedCustomer == null) { MessageBox.Show("Please select a customer", "GOLDLINE", MessageBoxButton.OK); } else { CustomerPayment cs = new CustomerPayment(CustomerPayment.GetNextCustomerPaymentId(), _selectedCustomer.Id, decimal.Parse(PayTextBox.Text), DateTime.Now, App.CurrentUser.Id); MessageBox.Show(CustomerPayment.AddCustomerPayment(cs) ? "Payment was recorded successfully" : "Could not record payment"); PayTextBox.Text = ""; ReloadDataGrid(); } }
public void Test_AddCustomerPayment() { Assert.IsNull(CustomerPayment.AddCustomerPayment(new CustomerPayment(1, 1, 0, new DateTime(), 1))); }