private void btnSaveCustomer_Click(object sender, EventArgs e) { Customer _cust = new Customer(); if (!IsNewCustomer) { _cust = CustomerDb.GetCustomerById(CustomerId, DatabaseId); } _cust.CustomerName = txtCustomerName.Text; _cust.Address1 = txtAddress1.Text; _cust.Address2 = txtAddress2.Text; _cust.City = txtCity.Text; _cust.CustomerJoined = rdDateJoined.Value; _cust.SanBernardino = chkSanBernardino.Checked; _cust.La = chkLa.Checked; _cust.OrangeCounty = chkOrange.Checked; _cust.RiverSide = chkRiverSide.Checked; _cust.databaseID = DatabaseId; _cust.database = txtDataBaseName.Text; if (chkCountyOther.Checked == true) { _cust.otherCountiesText = txtOtherCounty.Text; } _cust.Zip = txtZip.Text; _cust.State = txtState.Text; _cust.isActive = true; //concatanate all the counties for easier reporting. List <String> counties = new List <string>(); if (chkLa.Checked) { counties.Add("La"); } if (chkOrange.Checked) { counties.Add("Orange County"); } if (chkRiverSide.Checked) { counties.Add("RiverSide"); } if (chkSanBernardino.Checked) { counties.Add("La"); } string Countiesjoined = string.Join(",", counties); _cust.CountiesForReport = Countiesjoined; if (IsNewCustomer) { CustomerDb.AddToCustomer(_cust); CustomerDb.SaveChanges(); MessageBox.Show("Customer Created", "Customer has been created for the information entered", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { CustomerDb.SaveCustomer(_cust); CustomerDb.SaveChanges(); MessageBox.Show("Customer Updated", "Customer has been updates for the information entered", MessageBoxButtons.OK, MessageBoxIcon.Information); } BindCustomers(); }