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