Ejemplo n.º 1
0
        //Button add new customer
        private void buttonAddCustomer_Click(object sender, EventArgs e)
        {
            //Make new Customer Object.
            Customer addCustomer = new Customer();

            //Make new CustomerAddOrEditForm object and pass a new Customer object to the form.
            CustomersAddOrEditForm CustomersAddOrEditForm = new CustomersAddOrEditForm(addCustomer);

            CustomersAddOrEditForm.FormClosed += Form1_Load;
            CustomersAddOrEditForm.Show();
        }
Ejemplo n.º 2
0
        //Button edit Customer.
        private void buttonEditCustomer_Click(object sender, EventArgs e)
        {
            if (comboBoxMainEditCustomer.SelectedItem != null)
            {
                //Find selected Customer and add it to the Customer Object.
                Customer addCustomer = Program.db.Customers.Find(comboBoxMainEditCustomer.SelectedValue);

                //Make new CustomerAddOrEditForm object and pass the selected Customer object to the form.
                CustomersAddOrEditForm CustomersAddOrEditForm = new CustomersAddOrEditForm(addCustomer);
                CustomersAddOrEditForm.FormClosed += Form1_Load;
                CustomersAddOrEditForm.Show();
            }

            //Clears datasource.
            comboBoxMainEditCustomer.DataSource = null;

            //Rerun method Dictionary to refresh comboboxes and listview.
            Dictionary();
        }