public bool Guardar() { try { //Guardar Profesor if (tools.ValidarControles(this)) { profesor.id_profe = isNuevoRegistro ? 0 : Convert.ToInt32(txtCodigo.Text); profesor.nombre = txtNombre.Text; profesor.apellido = txtApellido.Text; profesor.email = txtEmail.Text; profesor.contacto = txtContacto.Text; profesor.estado = chkEstado.Checked ? "A" : "I"; int id_nuevo_profesor = profesor.Sentencia(profesor, isNuevoRegistro ? "I" : "U"); txtCodigo.Text = isNuevoRegistro ? id_nuevo_profesor.ToString() : profesor.id_profe.ToString(); tools.MensajeNormal(this, "Profesor guardado con éxito"); isNuevoRegistro = false; tools.DeshabilitarControles(this); FormatearBotones(ProcesoBotones.Guardar); return(true); } } catch (Exception ex) { tools.MensajeNormal(ex.Message); } return(false); }