示例#1
0
        // Bill a contract button
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            // Initialize a temporary int to then convert the textbox to it
            int contractID;

            try
            {
                int.TryParse(tbx_ContractID.Text, out contractID);
                // Call the billcustomer method
                CustomerDataAccess.BillCustomer(contracts, contractID);
                // Refresh list logic
                lbx_contracts.ItemsSource = null;
                lbx_contracts.ItemsSource = contracts.ToList();
            }
            catch (SystemException ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }