private void txtAgregarMod_Click(object sender, EventArgs e) { classContacto ObjContact = new classContacto(); ObjContact.Nombres = txtNombre.Text; ObjContact.Apellidos = txtApellidos.Text; string sexo = ""; if (rdoMas.Checked == true) { sexo = "MASCULINO"; } if (rdoFem.Checked == true) { sexo = "FEMENINO"; } if (rdoOtros.Checked == true) { sexo = "OTROS"; } ObjContact.Sexo = sexo; ObjContact.Direccion = txtDireccion.Text; ObjContact.Ciudad = txtCiudad.Text; ObjContact.Pais = txtPais.Text; ObjContact.TelefonoMovil = txtTelefono.Text; ObjContact.FelefonoFijo = txtTelefonoFijo.Text; ObjContact.Email = txtEmail.Text; db.Contactos.Add(ObjContact); }
private void txtAgregarMod_Click(object sender, EventArgs e) { LimpiarErrores(); if (ValidarCampos()) { //Agregar classContacto ObjContact = new classContacto(); ObjContact.Id = int.Parse(txtID.Text); ObjContact.Nombres = txtNombre.Text; ObjContact.Apellidos = txtApellidos.Text; string sexo = ""; if (rdoMas.Checked == true) { sexo = "MASCULINO"; } if (rdoFem.Checked == true) { sexo = "FEMENINO"; } if (rdoOtros.Checked == true) { sexo = "OTROS"; } ObjContact.Sexo = sexo; ObjContact.Direccion = txtDireccion.Text; ObjContact.Ciudad = txtCiudad.Text; ObjContact.Pais = txtPais.Text; ObjContact.TelefonoMovil = txtTelefono.Text; ObjContact.Email = txtEmail.Text; db.Contactos.Add(ObjContact); CargarGV(); } }