protected void btnCreate_Click(object sender, EventArgs e) { try { string errMsg = ValidateForm(); if (errMsg != string.Empty) { lblMessage.Text = errMsg; } else { ContactsBL contactsBL = new ContactsBL(); populateContact(); if (contactsBL.CreateContact(contact) == true) { PopulateDDL(); lblMessage.Text = "Contact creation successful"; } else { lblMessage.Text = "Contact creation failed"; foreach (ValidationError ve in contactsBL.ValidationErrors) { lblMessage.Text = ve.Description.ToString(); } } } } catch (Exception ex) { lblMessage.Text = ex.Message; } }
private void btnCreate_Click(object sender, EventArgs e) { try { string errMsg = ValidateForm(); if (errMsg != string.Empty) { MessageBox.Show(errMsg); } else { ContactsBL contactsBL = new ContactsBL(); populateContact(); if (contactsBL.CreateContact(contact) == true) { PopulateDGV(); MessageBox.Show("Contact creation successful"); } else { MessageBox.Show("Contact creation failed"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }