public void RegistrarEncargado() { try { if (dbConn.obtenerVariableEntera(" select count(*) from datosEncargado where identidadEncargado = '" + txtIdentidad.Text + "' and estado = 1") == 0) { if (dbConn.AgregarEncargado(txtIdentidad.Text, txtprimerNombre.Text, txtsegundoNombre.Text, txtprimerApellido.Text, txtsegundoApellido.Text, txtCorreoElectronico.Text, txtprimerTelefono.Text, txtsegundoTelefono.Text, txtDireccion.Text, txtfechaNacimiento.Text)) { message.lblCheck.Text = "ENCARGADO REGISTRADO"; message.ShowDialog(); } else { messageError.lblError.Text = "ERROR AL REGISTRAR"; messageError.ShowDialog(); } } else if (dbConn.obtenerVariableEntera("select count(*) from datosEncargado where identidadEncargado = '" + txtIdentidad.Text + "' and estado = 2") >= 1) { if (dbConn.ejecutarComandoSQL("update datosEncargado set primerNombre = '" + txtprimerNombre.Text + "', segundoNombre = '" + txtsegundoNombre.Text + "', primerApellido = '" + txtprimerApellido.Text + "', segundoApellido = '" + txtsegundoApellido.Text + "',correoElectronico = '" + txtCorreoElectronico.Text + "', numeroTelefono = '" + txtprimerTelefono.Text + "', numeroTelefonoAlt = '" + txtsegundoTelefono.Text + "', direccionTrabajo = '" + txtDireccion.Text + "', estado = 1 where identidadEncargado = '" + txtIdentidad.Text + "'")) { message.lblCheck.Text = "ENCARGADO REGISTRADO"; message.ShowDialog(); } else { messageError.lblError.Text = "ERROR AL REGISTRAR"; messageError.ShowDialog(); } } else { messageError.lblError.Text = "EL ENCARGADO YA EXISTE"; messageError.ShowDialog(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }