void EditCustomerClick(object sender, EventArgs e) { // MessageBox.Show(customerList.SelectedIndex.ToString()); // MessageBox.Show(customerList.SelectedValue.ToString()); if(Convert.ToInt32(customerList.SelectedValue)<0){return;} if(checkCustomerForm()==true) {customerForm.Close();} else { customerForm=new CustomerForm(Convert.ToInt32(customerList.SelectedValue)); customerForm.CustomerListIndex=customerList.SelectedIndex; customerForm.Text="Edit Customer Info"; Customer currentCustomer=db.getCustomer(Convert.ToInt32(customerForm.CustomerIndex)); customerForm.customerName.Text=currentCustomer.Name; customerForm.customerEmail.Text=currentCustomer.Email; customerForm.customerPhone.Text=currentCustomer.Phone; customerForm.CustomerIndex=currentCustomer.ID; customerForm.Show();} }
void CreateCustomerClick(object sender, EventArgs e) { if(checkCustomerForm()==true) { customerForm.Close(); } else { customerForm=new CustomerForm(); customerForm.Text="Create Customer"; customerForm.Show(); } }