private void btnAgregarDetalleEncargados_Click(object sender, EventArgs e) { try { if (txtIdentidadEncargadoDetalle.Text == "" || txtIdentidadEstudianteDetalle.Text == "") { messageError.lblError.Text = "DEBE SELECCIONAR UN\nENCARGADO Y ALUMNO"; messageError.ShowDialog(); } else { if (dbConn.obtenerVariableEntera("select count(*) from detalleEncargado where id_encargadoAlumno = '" + txtIdentidadEncargadoDetalle.Text + "' and id_Estudiante = '" + txtIdentidadEstudianteDetalle.Text + "'") != 1) { dbConn.ejecutarComandoSQL("INSERT INTO detalleEncargado VALUES('" + txtIdentidadEncargadoDetalle.Text + "','" + txtIdentidadEstudianteDetalle.Text + "')"); message.lblCheck.Text = "ENCARGADO AGREGADO\nAL ESTUDIANTE"; message.ShowDialog(); } else { messageError.lblError.Text = "ESTE ENCARGADO YA EXISTE \nEN ESTE ALUMNO"; messageError.ShowDialog(); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void cmbSeccion_SelectedIndexChanged(object sender, EventArgs e) { if (cmbSeccion.SelectedIndex != 0) { clsVariablesGlobales.idSeccionNotas = dbConn.obtenerVariableEntera("SELECT [id_Seccion] from seccion WHERE [nombreSeccion] = '" + cmbSeccion.SelectedItem.ToString() + "' AND id_Curso = " + clsVariablesGlobales.idCursoNotas); } else { clsVariablesGlobales.idSeccionNotas = 0; } }
private void btnRegistrarCurso_Click(object sender, EventArgs e) { int estadoCurso; String nombreCurso; double precio; if (txtNombreCurso.Text == String.Empty) { messageError.lblError.Text = "INGRESE UN NOMBRE DE CURSO"; messageError.ShowDialog(); } else if (txtPrecio.Text == String.Empty) { messageError.lblError.Text = "INGRESE UN PRECIO"; messageError.ShowDialog(); } else if (utilidad.isNumeric(txtPrecio.Text)) { nombreCurso = txtNombreCurso.Text; precio = double.Parse(txtPrecio.Text); estadoCurso = 1; dbConn.PARegistroCursos(nombreCurso, precio, estadoCurso); message.lblCheck.Text = "CURSO REGISTRADO"; message.ShowDialog(); txtNombreCurso.Clear(); txtPrecio.Clear(); actualizarDGV(); } else if (dbConn.obtenerVariableEntera("select [estadoCurso] from [dbo].[cursos]c inner join [dbo].[estados]e on c.estadoCurso = e.id_Estado where [estadoCurso] = 1 and [nombreCurso] = '" + txtNombreCurso.Text + "'") == 1) { messageError.lblError.Text = "EL CURSO YA EXISTE"; messageError.ShowDialog(); utilidad.limpiarTextBox(grbPrincipal); } else if (dbConn.obtenerVariableEntera("select [estadoCurso] from [dbo].[cursos]c inner join [dbo].[estados]e on c.estadoCurso = e.id_Estado where [estadoCurso] = 2 and [nombreCurso] = '" + txtNombreCurso.Text + "'") == 2) { estadoCurso = 1; dbConn.ejecutarComandoSQL("update [dbo].[cursos] set [estadoCurso] = '" + estadoCurso + "' where [nombreCurso] = '" + txtNombreCurso.Text + "'"); message.lblCheck.Text = "CURSO REGISTRADO"; message.ShowDialog(); utilidad.limpiarTextBox(grbPrincipal); actualizarDGVInac(); } else { messageError.lblError.Text = "INGRESE CORRECTAMENTE LOS DATOS SOLICITADOS"; messageError.ShowDialog(); } }
private void cmbCurso_SelectedIndexChanged(object sender, EventArgs e) { clsVariablesGlobales.idCursoImprimir = dbConn.obtenerVariableEntera("SELECT id_Curso FROM cursos WHERE nombreCurso = '" + cmbCurso.SelectedItem.ToString() + "'"); if (cmbCurso.Items.Count > 0) { dbConn.llenarDGV(dgvSecciones, "SELECT A.id_Seccion as 'ID', FORMAT(A.fechaCreacion, 'dd/MM/yyyy') as 'Fecha de Registro', A.nombreSeccion as 'Seccion', CONCAT(B.primerNombre, ' ',B.segundoNombre, ' ',B.primerApellido, ' ', B.segundoApellido) as 'Docente', descripcionEstado as 'Estado' FROM seccion A INNER JOIN datosEmpleados B ON A.id_Docente = B.identidadPersona INNER JOIN estados C ON C.id_Estado = A.estado WHERE A.id_Curso = " + clsVariablesGlobales.idCursoImprimir); } }
private void abContinuar_Click(object sender, EventArgs e) { Registro_y_Vista_de_Notas.Herencia_de_Variables.CursoG = cursoElegido; Registro_y_Vista_de_Notas.Herencia_de_Variables.SeccionG = seccionElegida; formaEvaluacion = dbConn.obtenerVariableEntera("Select [tipoCalificacion] from [dbo].[cursos] where [nombreCurso] = '" + cursoElegido + "'"); if (cmbCursos.SelectedIndex == -1 && (cmbSeccion.SelectedIndex == -1 || cmbSeccion.Text == "<Seleccione>")) { message.lblError.Location = new Point(130, 75); message.lblError.Text = "SELECCIONE UN CURSO"; message.lblError.TextAlign = ContentAlignment.MiddleCenter; message.ShowDialog(); } else if (cmbSeccion.Text != seccionElegida) { message.lblError.Location = new Point(130, 75); message.lblError.Text = "SELECCIONE UNA SECCION"; message.lblError.TextAlign = ContentAlignment.MiddleCenter; message.ShowDialog(); } else { if (formaEvaluacion == 3) { messageWarning.lblError.Location = new Point(130, 68); messageWarning.lblError.Text = "EL CURSO ELEGIDO NO TIENE\n UNA FORMA DE EVALUACIÓN"; messageWarning.lblError.TextAlign = ContentAlignment.MiddleCenter; messageWarning.ShowDialog(); } else { gpxSeleccionCurso.Visible = false; gpxSeleccionAlumno.Visible = true; } } }
private void btnRecuperar_Click(object sender, EventArgs e) { if (mtxtIdentidad.Text != string.Empty) { if (dbConn.obtenerVariableString("SELECT identidadPersona FROM datosEmpleados WHERE identidadPersona = '" + mtxtIdentidad.Text + "' AND estadoEmpleado <> 2") != null) { string correo = dbConn.obtenerVariableString("SELECT correoElectronico FROM datosEmpleados WHERE identidadPersona = '" + mtxtIdentidad.Text + "'"); string nombre = dbConn.obtenerVariableString("SELECT CONCAT(primerNombre, ' ', segundoNombre) FROM datosEmpleados WHERE identidadPersona = '" + mtxtIdentidad.Text + "'"); string contra = utilidad.DesEncriptar(dbConn.obtenerVariableString("SELECT contraseniaEmpleado FROM datosEmpleados WHERE identidadPersona = '" + mtxtIdentidad.Text + "'")); string corr = correo.Substring(0, 5); rtxtHtml.Text = rtxtHtml.Text.Replace("@contra", " " + contra); rtxtHtml.Text = rtxtHtml.Text.Replace("@nombre", " " + nombre); string correoRecu = ""; string contraRecu = ""; string host = ""; int port = 0; try { correoRecu = dbConn.obtenerVariableString("SELECT TOP 1 correo FROM informacionCorreoRecuperacion"); contraRecu = utilidad.DesEncriptar(dbConn.obtenerVariableString("SELECT TOP 1 contra FROM informacionCorreoRecuperacion")); host = dbConn.obtenerVariableString("SELECT TOP 1 host FROM informacionCorreoRecuperacion"); port = dbConn.obtenerVariableEntera("SELECT TOP 1 puerto FROM informacionCorreoRecuperacion"); } catch { MessageBox.Show("ERROR AL OBTENER CREDENCIALES DE RECUPERACION"); } if (utilidad.enviarCorreo(mensaje: rtxtHtml.Text, destinatario: correo, correoRecu, contraRecu, host, port)) { MessageBox.Show("Revise la bandeja de entrada, spam de su correo: " + corr + "********", "Recuperacion de Contraseña", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { MessageBox.Show("Si la informacion que ingreso es correcta, recibira en su correo electronico la contraseña de su cuenta.", "Recuperacion de Contraseña", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Ingrese un correo electronico", "Error de recuperacion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { try { if (cmbCurso.SelectedIndex != 0) { if (dbConn.obtenerVariableEntera("SELECT count(id_DetalleNotas) FROM[dbo].[detalleNotas] A INNER JOIN[dbo].[clasesCurso] B ON A.id_Clase = B.id_Clase INNER JOIN[dbo].[cursos] C ON B.id_Curso = C.id_Curso INNER JOIN[dbo].[detalleMatricula] D ON A.id_DetalleMatricula = D.id_DetalleMatricula INNER JOIN[dbo].[matricula] E ON D.id_RegistroMatricula = E.id_RegistroMatricula WHERE E.id_Estudiante = '" + identidadEstudiante + "' AND C.nombreCurso = '" + cmbCurso.SelectedItem.ToString() + "'") != 0) { dbConn.llenarDGV(dgvNotas, "SELECT C.[nombreCurso] as 'Curso', B.[nombreClase] as 'Nombre Clase', A.[nota1erParcial] as 'I Parcial', A.[nota2doParcial] as 'II Parcial', A.[nota3erParcial] as 'III Parcial', A.[nota4toParcial] as 'IV Parcial', A.[notaFinal] AS 'Promedio' FROM[dbo].[detalleNotas] A INNER JOIN[dbo].[clasesCurso] B ON A.id_Clase = B.id_Clase INNER JOIN[dbo].[cursos] C ON B.id_Curso = C.id_Curso INNER JOIN[dbo].[detalleMatricula] D ON A.id_DetalleMatricula = D.id_DetalleMatricula INNER JOIN[dbo].[matricula] E ON D.id_RegistroMatricula = E.id_RegistroMatricula WHERE E.id_Estudiante = '" + identidadEstudiante + "' AND C.nombreCurso = '" + cmbCurso.SelectedItem.ToString() + "'"); } } else { dgvNotas.DataSource = ""; } } catch { dgvNotas.DataSource = null; } }
private void btnIngresar_Click(object sender, EventArgs e) { int primerInicio = dbConn.obtenerVariableEntera("SELECT COUNT(*) FROM datosEmpleados"); if (primerInicio == 0) { message2.lblError.Text = "ESTA ES SU PRIMERA VEZ INICIANDO \r\nEL SISTEMA, POR FAVOR CREE UN \r\nSUPER USUARIO PARA CONTINUAR."; message2.lblError.Font = new System.Drawing.Font("Balsamiq Sans", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); message2.lblError.Location = new Point(100, 60); message2.ShowDialog(); Form frmRegistro = new frmIngresoAdmin(); frmRegistro.ShowDialog(); } else if (txtdentidad.Text != String.Empty && txtContrase.Text != String.Empty && primerInicio != 0) { if (dbConn.comprobarUsuario(txtdentidad.Text, utilidad.EncriptarTexto(txtContrase.Text))) { clsVariablesGlobales.NumIdentidad = txtdentidad.Text; IfrmSeleccionarTipoInicio frmTipoI = new IfrmSeleccionarTipoInicio(); frmTipoI.Show(); this.Hide(); } else { message.lblError.Location = new Point(118, 65); message.lblError.Text = "USUARIO O CONTRASEÑA \r\nINCORRECTOS"; message.ShowDialog(); } } else { message.lblError.Location = new Point(129, 65); message.lblError.Text = "INTRODUZCA VALORES"; message.ShowDialog(); } }