Esempio n. 1
0
        private void mnuItemEditCustomer_Click(object sender, EventArgs e)
        {
            //Retrieve selected customer from grid
            var selectedCustomer = gvwCustomers.SelectedRows[0].DataBoundItem;

            //Pass the selected customer to a new customer data form
            using (frmCustomerData dataEntryForm = new frmCustomerData())
            {
                dataEntryForm.CustomerData = (Data.Customer)selectedCustomer;
                dataEntryForm.ShowDialog();
                if (dataEntryForm.DialogResult == DialogResult.OK)
                {
                    //Save any changes
                    dataEntryForm.CustomerData.UpdateToDatabase();
                    RefreshCustomers();
                }
            }
        }
Esempio n. 2
0
        private void mnuItemAddCustomer_Click(object sender, EventArgs e)
        {
            //Retrieve selected customer from grid
            Data.RetailCustomer retailCustomer = new Data.RetailCustomer();

            //Pass the selected customer to a new customer data form
            using (frmCustomerData dataEntryForm = new frmCustomerData())
            {
                dataEntryForm.CustomerData = retailCustomer;
                dataEntryForm.ShowDialog();
                if (dataEntryForm.DialogResult == DialogResult.OK)
                {
                    //Save
                    dataEntryForm.CustomerData.Transactions = new List <Data.Transaction>();
                    dataEntryForm.CustomerData.AddToDatabase();
                    RefreshCustomers();
                }
            }
        }