예제 #1
0
        private void CustomerForm_Load_1(object sender, EventArgs e)
        {
            List <Customer> customerList;

            try
            {
                customerList = CustomerDBDAL.GetCustomers();
                if (customerList.Count > 0)
                {
                    Customer customer;
                    for (int i = 0; i < customerList.Count; i++)
                    {
                        customer        = customerList[i];
                        txtCustID.Text  = customer.CustomID.ToString();
                        txtName.Text    = customer.Name;
                        txtAddress.Text = customer.Address;
                        txtCity.Text    = customer.City;
                        txtState.Text   = customer.State;
                        txtZip.Text     = customer.ZipCode.ToString();
                        txtPhone.Text   = customer.Phone;
                        txtEmail.Text   = customer.Email;
                    }
                }
                else
                {
                    MessageBox.Show("No Customer fitting that ID can be found.");
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.GetType().ToString());
            }
        }
예제 #2
0
 /// <summary>
 /// Method to retrieve the customer name list from the DB
 /// </summary
 /// <returns>The IncidentDBDal customers list</returns>
 public List <Customer> GetCustomers()
 {
     return(customerDBDAL.GetCustomers());
 }