private void btnAgregar_Click(object sender, EventArgs e) { BE.Cliente _cliente = new BE.Cliente(); if (txtNombre.Text == "" || txtNombre.Text == null || txtApellido.Text == "" || txtApellido.Text == null || txtDomicilio.Text == "" || txtDomicilio.Text == null || txtNroDoc.Text == "" || txtNroDoc.Text == null || txtEmail.Text == "" || txtEmail.Text == null) { MessageBox.Show("Por favor complete los campos obligatorios"); return; } if (String.IsNullOrEmpty(txtEmail.Text) && String.IsNullOrEmpty(txtTelefono.Text)) { MessageBox.Show("Por favor debe introducir un email o un telefono de contacto"); return; } _cliente.Nombre = txtNombre.Text.ToUpper(); _cliente.Apellido = txtApellido.Text.ToUpper(); var tDoc = (KeyValuePair <int, string>)cmbTipoDoc.SelectedItem; _cliente.TipoDoc = tDoc.Key; _cliente.NroDoc = long.Parse(txtNroDoc.Text); _cliente.Domicilio = txtDomicilio.Text; _cliente.Email = txtEmail.Text; _cliente.Estado = true; if (!String.IsNullOrEmpty(txtTelefono.Text)) { _cliente.Telefono = long.Parse(txtTelefono.Text); } BLL.Cliente _clienteBll = new BLL.Cliente(); try { _clienteBll.AltaCliente(_cliente); var dialogResult = MessageBox.Show("Se cargo el cliente"); //this.Hide(); if (dialogResult == DialogResult.Cancel) { this.Close(); } } catch (Exception exp) { MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }