예제 #1
0
파일: Form1.cs 프로젝트: NJoosen/iStore
        //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();
        }
예제 #2
0
파일: Form1.cs 프로젝트: NJoosen/iStore
        //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();
        }