Пример #1
0
 private void btnAddCustomers_Click(object sender, EventArgs e)
 {
     addCustomer = new AddCustomers();
     //Passing form name to identify already opened form to keep using of one form,
     //reference to object and type of form to switch between Add and Edit form view and behavior
     openWindow("AddCustomers", ref addCustomer, "Add");
     //Set customer ID to update customer information in the form
     addCustomer.setID(-1);
 }
Пример #2
0
        private void btnEditCustomers_Click(object sender, EventArgs e)
        {
            //Customer id in database
            int id;

            int.TryParse(dgvCustomers.Rows[dgvCustomers.SelectedRows[0].Index].Cells[0].Value.ToString(), out id);
            addCustomer = new AddCustomers();
            openWindow("AddCustomers", ref addCustomer, "Edit");
            addCustomer.setID(id);
        }