示例#1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     frmAddCustomer addCustomerForm = new frmAddCustomer();
     Customer customer = addCustomerForm.GetNewCustomer();
     if (customer != null)
     {
         customers += customer;
     }
 }
示例#2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddCustomer addCustomerForm = new frmAddCustomer();
            Customer       customer        = addCustomerForm.GetNewCustomer();

            if (customer != null)
            {
                customers += customer;
            }
        }
示例#3
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     frmAddCustomer addCustomerForm = new frmAddCustomer();
     Customer customer = addCustomerForm.GetNewCustomer();
     if (customer != null)
     {
         customers.Add(customer);
         CustomerDB.SaveCustomers(customers);
         FillCustomerListBox();
     }
 }
示例#4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddCustomer addCustomerForm = new frmAddCustomer();
            Customer       customer        = addCustomerForm.GetNewCustomer();

            if (customer != null)
            {
                customers.Add(customer);
                CustomerDB.SaveCustomers(customers);
                FillCustomerListBox();
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddCustomer newAddCustomerForm = new frmAddCustomer();                // create new instance of AddCustomer form
            Customer       customer           = newAddCustomerForm.GetNewCustomer(); // get data for new customer

            if (customer != null)                                                    // check if customer object is null
            {
                customers.Add(customer);                                             // add new customer
                CustomerDB.SaveCustomers(customers);                                 // save customers list
                FillCustomerListBox();                                               // call method to refresh customer list box
            }
        }
示例#6
0
        private void btnAdd_Click(object sender, EventArgs e)                  // When the user clicks the add button, give them a form to fill out to create a new customer
        {
            frmAddCustomer newCustomerForm = new frmAddCustomer();             // Create the form
            Customer       customer        = newCustomerForm.GetNewCustomer(); // Get the information from the form

            if (customer != null)
            {
                customers.Add(customer);                // Create, save, and show the new customer
                CustomerDB.SaveCustomers(customers);
                FillCustomerListBox();
            }
        }
示例#7
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddCustomer addCustomerForm = new frmAddCustomer();
            Customer       customer        = addCustomerForm.GetNewCustomer();

            if (customer != null)
            {
                customers.Add(customer);
                // TODO: Add a statement that saves the customers here

                FillCustomerListBox();
            }
        }
示例#8
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddCustomer addCustomerForm = new frmAddCustomer();
            Customer       customer        = addCustomerForm.GetCustomer();

            if (customer != null)
            {
                MessageBox.Show(customer.GetDisplayText("\t"));
                customers.Add(customer);
                CustomerDB.SaveCustomers(customers);
                FillCustomerListBox();
            }
        }
示例#9
0
        // Step 11.
        private void btnAdd_Click(object sender, EventArgs e)
        {
            // create a new instance of the Add Customer form
            frmAddCustomer newAddCustomerForm = new frmAddCustomer();
            Customer       customer           = newAddCustomerForm.GetNewCustomer();

            if (customer != null)
            {
                customers.Add(customer);
                CustomerDB.SaveCustomers(customers);
                FillCustomerListBox();
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddCustomer frmAddCustomer = new frmAddCustomer();
            Customer       customer       = frmAddCustomer.GetNewCustomer();

            if (customer.FirstName != ""
                & customer.LastName != ""
                & customer.Email != "")
            {
                customers.Add(customer);
                CustomerDB.SaveCustomers(customers);
                FillCustomerListBox();
            }
        }
示例#11
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddCustomer newCustomerForm = new frmAddCustomer();
            Customer       customer        = newCustomerForm.GetNewCustomer();

            // if customer is not null
            //   add customer to customers list
            //   save customers list to CustomerDB
            //   fill customer list box
            if (customer != null)
            {
                customers.Add(customer);
                CustomerDB.SaveCustomers(customers);
                FillCustomerListBox();
            }
        }
示例#12
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddCustomer frm = new frmAddCustomer();
            Customer       c   = frm.GetNewCustomer();

            if (c != null)
            {
                customers.Add(c);
                CustomerDB.SaveCustomers(customers);
            }

            lstCustomers.Items.Clear();
            foreach (Customer cx in customers)
            {
                lstCustomers.Items.Add(cx);
            }
        }
示例#13
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddCustomer newCustomerForm = new frmAddCustomer();
            Customer       customer        = newCustomerForm.GetNewCustomer();

            /* If customer object returned not null
             *      add new customer to array list
             *      save list to CustomerDB
             *      refresh customer list box
             */

            if (customer != null)
            {
                customers.Add(customer);
                CustomerDB.SaveCustomers(customers);
                FillCustomerListBox();
            }
        }