private void btnAddNewPOC_Click(object sender, RoutedEventArgs e) { if (lstContactList.SelectedIndex == -1) { if (txtContactName.Text.Trim() == "") { MessageBox.Show("Please Enter Name of Point of Contact"); return; } if (txtContactPosition.Text.Trim() == "") { MessageBox.Show("Please Enter Position of Point of Contact"); return; } if (txtContactTel.Text.Trim() == "") { MessageBox.Show("Please Enter Phone of Point of Contact"); return; } try { ServiceContactHelper client = new ServiceContactHelper(); if (event_ != null) { client.AddPointOfContact(user, event_.EventID, ((Service)lstServiceList.SelectedItem).ServiceID, txtContactName.Text.Trim(), txtContactPosition.Text.Trim(), txtContactTel.Text.Trim(), txtContactEmail.Text.Trim()); } else { client.AddPointOfContact(user, -1, ((Service)lstServiceList.SelectedItem).ServiceID, txtContactName.Text.Trim(), txtContactPosition.Text.Trim(), txtContactTel.Text.Trim(), txtContactEmail.Text.Trim()); } MessageBox.Show("Operation Success"); client.Close(); loadPointOfContact(((Service)lstServiceList.SelectedItem).ServiceID); Select_PointOfContact(txtContactName.Text.Trim(), txtContactPosition.Text.Trim(), txtContactTel.Text.Trim(), txtContactEmail.Text.Trim()); } catch (Exception ex) { MessageBox.Show(ex.Message); } //check and save } else { PointOfContact poc = ((PointOfContact)lstContactList.SelectedItem); //edit UpdatePointOfContact(poc); loadPointOfContact(((Service)lstServiceList.SelectedItem).ServiceID); } }