private void InsertButton_Click(object sender, RoutedEventArgs e) { #region validation ForceValidation(); if (Validation.GetHasError(NameTextBox) || Validation.GetHasError(EmailTextBox) || Validation.GetHasError(PhoneTextBox) || Validation.GetHasError(AddressTextBox)) { var sMessageDialog = new MessageDialog { Message = { Text = "ERROR: Fill required fields!" } }; DialogHost.Show(sMessageDialog, "RootDialog"); return; } if (SelectCustomerComboBox.SelectedItem == null) { var sMessageDialog = new MessageDialog { Message = { Text = "ERROR: Select a Employee to Edit!" } }; DialogHost.Show(sMessageDialog, "RootDialog"); return; } #endregion ContactFactory fac = new ContactFactory(); if (fac.Update(int.Parse(SelectCustomerComboBox.SelectedValue.ToString()), NameTextBox.Text, PhoneTextBox.Text, EmailTextBox.Text, AddressTextBox.Text)) { var sMessageDialog = new MessageDialog { Message = { Text = "Updated Successfull!" } }; DialogHost.Show(sMessageDialog, "RootDialog"); Clear(); conlist = new ContactFactory().SelectAll(); } else { var sMessageDialog = new MessageDialog { Message = { Text = "Updated Successfull!" } }; DialogHost.Show(sMessageDialog, "RootDialog"); } }