private void button4_Click(object sender, EventArgs e) { conexion cn = new conexion(); bool respuesta = true; if (validarEBc()) { respuesta = cn.ExistenciasCR(int.Parse(textBoxCodigoRbuscar.Text)); if (respuesta != true) { string actualizar = "codigo_ruta ='" + textBoxCodigoRbuscar.Text + "'"; if (cn.actualizar("Alumno", actualizar, "id_alumno=" + textBox1.Text)) { MessageBox.Show("Datos Actualizados", "Mensaje", MessageBoxButtons.OK); cn.consulta("select codigo_ruta, id_alumno, nombre_alumno from Alumno", "Alumno"); dataGridLARutas.DataSource = cn.ds.Tables["Alumno"]; } else { MessageBox.Show("Error al actualizar el Registro", "Mensaje", MessageBoxButtons.OK); } } else { MessageBox.Show("El ID Existe", "Mensaje", MessageBoxButtons.OK); } } }
private void button1_Click(object sender, EventArgs e) { conexion cn = new conexion(); string actualizar = "nombre_alumno ='" + textBoxNombreAlumnoMod.Text + "', direccion_alumno ='" + textBoxDireccionAlumnoMod.Text + "', telefono_alumno ='" + textBoxTelefonoAlumnoMod.Text + "'"; if (cn.actualizar("Alumno", actualizar, "codigo_alumno=" + textBoxIdAlumnoMod.Text)) { MessageBox.Show("Datos Actualizados", "Mensaje", MessageBoxButtons.OK); cn.consulta("select codigo_alumno, id_alumno, nombre_alumno, direccion_alumno, telefono_alumno from Alumno where codigo_alumno = " + textBoxIdAlumnoMod.Text, "Alumno"); dataGridViewAlumno.DataSource = cn.ds.Tables["Alumno"]; } else { MessageBox.Show("Error al actualizar el Registro", "Mensaje", MessageBoxButtons.OK); } }
private void button2_Click(object sender, EventArgs e) { conexion cn = new conexion(); bool respuesta = true; bool r = true; if (validarEB()) { r = validaciones.Correo(textBoxCorreoEmpleadoMod.Text); if (r != true) { MessageBox.Show("Correo Electronico invalido, el correo debe tener el formato [email protected] ", "Mensaje", MessageBoxButtons.OK); textBoxCorreoEmpleadoMod.SelectAll(); textBoxCorreoEmpleadoMod.Focus(); } else { if (comboBoxPuestoEmpleadoMod.Text == "Profesor") { textBoxPuestoEmpleadoMod.Clear(); textBoxPuestoEmpleadoMod.Text = "1"; } if (comboBoxPuestoEmpleadoMod.Text == "Secretaria") { textBoxPuestoEmpleadoMod.Clear(); textBoxPuestoEmpleadoMod.Text = "2"; } if (comboBoxPuestoEmpleadoMod.Text == "Administrador") { textBoxPuestoEmpleadoMod.Clear(); textBoxPuestoEmpleadoMod.Text = "3"; } if (comboBoxPuestoEmpleadoMod.Text == "Chofer") { textBoxPuestoEmpleadoMod.Clear(); textBoxPuestoEmpleadoMod.Text = "4"; } if (comboBoxPuestoEmpleadoMod.Text == "Personal Limpieza") { textBoxPuestoEmpleadoMod.Clear(); textBoxPuestoEmpleadoMod.Text = "5"; } int puestoMod; puestoMod = Int32.Parse(textBoxPuestoEmpleadoMod.Text); respuesta = cn.NoExistencias(Convert.ToString(textBoxIdEmpleadoMod.Text)); if (respuesta != true) { string actualizar = "codigo_puestoEmpleado ='" + puestoMod + "',nombre_empleado ='" + textBoxNombreEmpleadoMod.Text + "', direccion_empleado ='" + textBoxDireccionEmpleadoMod.Text + "', telefono_empleado ='" + textBoxTelefonoEmpleadoMod.Text + "', telefono_emplaedoEmergencia ='" + textBoxTelefonoEmergenciaEmpleadoMod.Text + "', email_empleado ='" + textBoxCorreoEmpleadoMod.Text + "', usr_empleado ='" + textBoxUsuarioEmpleadoMod.Text + "'"; if (cn.actualizar("Empleado", actualizar, "id_empleado=" + Convert.ToString(textBoxIdEmpleadoMod.Text))) { MessageBox.Show("Datos Actualizados", "Mensaje", MessageBoxButtons.OK); cn.consulta("select codigo_empleado, id_empleado,codigo_puestoEmpleado, nombre_empleado, direccion_empleado, telefono_empleado, telefono_emplaedoEmergencia, email_empleado, usr_empleado from Empleado", "Empleado"); dataGridViewEmpleado.DataSource = cn.ds.Tables["Empleado"]; } else { MessageBox.Show("Error al actualizar el Registro", "Mensaje", MessageBoxButtons.OK); } } else { MessageBox.Show("EL ID NO Existe", "Mensaje", MessageBoxButtons.OK); textBoxIdEmpleadoMod.Clear(); textBoxIdEmpleadoMod.Focus(); } } } }
private void button1_Click(object sender, EventArgs e) { conexion cn = new conexion(); bool respuesta = true; if (validarEB()) { respuesta = cn.NoExistenciasA(Convert.ToString(textBoxIdAlumnoReingreso.Text)); ErrorEB.Clear(); if (respuesta != true) { string año2 = dateTimePickerReingreso.Text; DataClasses1DataContext db = new DataClasses1DataContext(); int codigo = Convert.ToInt32(textBoxIdAlumnoReingreso.Text); conexion xl = new conexion(); SqlConnection conn = new SqlConnection("Data Source=localhost\\SQLEXPRESS;Initial Catalog=Inst_JoseCelilioValle;Integrated Security=True"); conn.Open(); string comando = string.Format("select count(a.codigo_alumno) from [dbo].[Alumno] a inner join [dbo].[grado_alumno] b on a.codigo_alumno = b.codigo_alumno inner join [dbo].[Periodos_Grado] c on b.codigo_periodoGrado = c.codigo_periodoGrado inner join [dbo].[Grado] d on c.codigo_grado= d.codigo_grado inner join [dbo].[Seccion] e on c.codigo_seccion = e.codigo_seccion where c.codigo_grado = {0} AND c.codigo_seccion = {1}", comboBoxGrado2.SelectedIndex + 1, comboBoxSeccion2.SelectedIndex + 1); SqlCommand cmd = new SqlCommand(comando, conn); Int32 count = (Int32)cmd.ExecuteScalar(); conn.Close(); if (count <= 30) { string actualizar = "materiaRetrasada ='" + textBoxRetrasadaReingreso.Text + "',materiaTPA ='" + textBoxTPAreingreso + "', instituto_procedencia ='" + textBoxProcedenciaReingreso.Text + "'"; if (cn.actualizar("Alumno", actualizar, "id_alumno=" + textBoxIdAlumnoReingreso.Text)) { MessageBox.Show("Datos Actualizados", "Mensaje", MessageBoxButtons.OK); } else { MessageBox.Show("Error al actualizar el Registro", "Mensaje", MessageBoxButtons.OK); } if (comboBoxGrado2.Text == "1er grado") { textBoxGrado2.Clear(); textBoxGrado2.Text = "1"; } if (comboBoxGrado2.Text == "2do grado") { textBoxGrado2.Clear(); textBoxGrado2.Text = "2"; } if (comboBoxGrado2.Text == "3er grado") { textBoxGrado2.Clear(); textBoxGrado2.Text = "3"; } if (comboBoxGrado2.Text == "4to grado") { textBoxGrado2.Clear(); textBoxGrado2.Text = "4"; } if (comboBoxGrado2.Text == "5to grado") { textBoxGrado2.Clear(); textBoxGrado2.Text = "5"; } if (comboBoxGrado2.Text == "6to grado") { textBoxGrado2.Clear(); textBoxGrado2.Text = "6"; } if (comboBoxGrado2.Text == "7mo grado") { textBoxGrado2.Clear(); textBoxGrado2.Text = "7"; } if (comboBoxGrado2.Text == "8vo grado") { textBoxGrado2.Clear(); textBoxGrado2.Text = "8"; } if (comboBoxGrado2.Text == "9no grado") { textBoxGrado2.Clear(); textBoxGrado2.Text = "9"; } if (comboBoxGrado2.Text == "10mo grado") { textBoxGrado2.Clear(); textBoxGrado2.Text = "10"; } if (comboBoxGrado2.Text == "11vo grado") { textBoxGrado2.Clear(); textBoxGrado2.Text = "11"; } int grado2; grado2 = Int32.Parse(textBoxGrado2.Text); if (comboBoxSeccion2.Text == "A") { textBoxSeccion2.Clear(); textBoxSeccion2.Text = "1"; } if (comboBoxSeccion2.Text == "B") { textBoxSeccion2.Clear(); textBoxSeccion2.Text = "2"; } if (comboBoxSeccion2.Text == "C") { textBoxSeccion2.Clear(); textBoxSeccion2.Text = "3"; } int seccion2; seccion2 = Int32.Parse(textBoxSeccion2.Text); if (comboBoxGrado2.Text == "1er grado" && comboBoxSeccion2.Text == "A") { textBoxGrado2.Clear(); textBoxAula2.Text = "1"; } if (comboBoxGrado2.Text == "1er grado" && comboBoxSeccion2.Text == "B") { textBoxGrado2.Clear(); textBoxAula2.Text = "2"; } if (comboBoxGrado2.Text == "1er grado" && comboBoxSeccion2.Text == "C") { textBoxGrado2.Clear(); textBoxAula2.Text = "3"; } if (comboBoxGrado2.Text == "2do grado" && comboBoxSeccion2.Text == "A") { textBoxGrado2.Clear(); textBoxAula2.Text = "4"; } if (comboBoxGrado2.Text == "2do grado" && comboBoxSeccion2.Text == "B") { textBoxGrado2.Clear(); textBoxAula2.Text = "5"; } if (comboBoxGrado2.Text == "2do grado" && comboBoxSeccion2.Text == "C") { textBoxGrado2.Clear(); textBoxAula2.Text = "6"; } if (comboBoxGrado2.Text == "3er grado" && comboBoxSeccion2.Text == "A") { textBoxGrado2.Clear(); textBoxAula2.Text = "7"; } if (comboBoxGrado2.Text == "3er grado" && comboBoxSeccion2.Text == "B") { textBoxGrado2.Clear(); textBoxAula2.Text = "8"; } if (comboBoxGrado2.Text == "3er grado" && comboBoxSeccion2.Text == "C") { textBoxGrado2.Clear(); textBoxAula2.Text = "9"; } if (comboBoxGrado2.Text == "4to grado" && comboBoxSeccion2.Text == "A") { textBoxGrado2.Clear(); textBoxAula2.Text = "10"; } if (comboBoxGrado2.Text == "4to grado" && comboBoxSeccion2.Text == "B") { textBoxGrado2.Clear(); textBoxAula2.Text = "11"; } if (comboBoxGrado2.Text == "4to grado" && comboBoxSeccion2.Text == "C") { textBoxGrado2.Clear(); textBoxAula2.Text = "12"; } if (comboBoxGrado2.Text == "5to grado" && comboBoxSeccion2.Text == "A") { textBoxGrado2.Clear(); textBoxAula2.Text = "13"; } if (comboBoxGrado2.Text == "5to grado" && comboBoxSeccion2.Text == "B") { textBoxGrado2.Clear(); textBoxAula2.Text = "14"; } if (comboBoxGrado2.Text == "5to grado" && comboBoxSeccion2.Text == "C") { textBoxGrado2.Clear(); textBoxAula2.Text = "15"; } if (comboBoxGrado2.Text == "6to grado" && comboBoxSeccion2.Text == "A") { textBoxGrado2.Clear(); textBoxAula2.Text = "16"; } if (comboBoxGrado2.Text == "6to grado" && comboBoxSeccion2.Text == "B") { textBoxGrado2.Clear(); textBoxAula2.Text = "17"; } if (comboBoxGrado2.Text == "6to grado" && comboBoxSeccion2.Text == "C") { textBoxGrado2.Clear(); textBoxAula2.Text = "18"; } if (comboBoxGrado2.Text == "7mo grado" && comboBoxSeccion2.Text == "A") { textBoxGrado2.Clear(); textBoxAula2.Text = "19"; } if (comboBoxGrado2.Text == "7mo grado" && comboBoxSeccion2.Text == "B") { textBoxGrado2.Clear(); textBoxAula2.Text = "20"; } if (comboBoxGrado2.Text == "7mo grado" && comboBoxSeccion2.Text == "C") { textBoxGrado2.Clear(); textBoxAula2.Text = "21"; } if (comboBoxGrado2.Text == "8vo grado" && comboBoxSeccion2.Text == "A") { textBoxGrado2.Clear(); textBoxAula2.Text = "22"; } if (comboBoxGrado2.Text == "8vo grado" && comboBoxSeccion2.Text == "B") { textBoxGrado2.Clear(); textBoxAula2.Text = "23"; } if (comboBoxGrado2.Text == "8vo grado" && comboBoxSeccion2.Text == "C") { textBoxGrado2.Clear(); textBoxAula2.Text = "24"; } if (comboBoxGrado2.Text == "9no grado" && comboBoxSeccion2.Text == "A") { textBoxGrado2.Clear(); textBoxAula2.Text = "25"; } if (comboBoxGrado2.Text == "9no grado" && comboBoxSeccion2.Text == "B") { textBoxGrado2.Clear(); textBoxAula2.Text = "26"; } if (comboBoxGrado2.Text == "9no grado" && comboBoxSeccion2.Text == "C") { textBoxGrado2.Clear(); textBoxAula2.Text = "27"; } if (comboBoxGrado2.Text == "10mo grado" && comboBoxSeccion2.Text == "A") { textBoxGrado2.Clear(); textBoxAula2.Text = "28"; } if (comboBoxGrado2.Text == "10mo grado" && comboBoxSeccion2.Text == "B") { textBoxGrado2.Clear(); textBoxAula2.Text = "29"; } if (comboBoxGrado2.Text == "10mo grado" && comboBoxSeccion2.Text == "C") { textBoxGrado2.Clear(); textBoxAula2.Text = "30"; } if (comboBoxGrado2.Text == "11vo grado" && comboBoxSeccion2.Text == "A") { textBoxGrado2.Clear(); textBoxAula2.Text = "31"; } if (comboBoxGrado2.Text == "11vo grado" && comboBoxSeccion2.Text == "B") { textBoxGrado2.Clear(); textBoxAula2.Text = "32"; } if (comboBoxGrado2.Text == "11vo grado" && comboBoxSeccion2.Text == "C") { textBoxGrado2.Clear(); textBoxAula2.Text = "33"; } int aula2; aula2 = Int32.Parse(textBoxAula2.Text); db.ingresarPeriodosGrados(dateTimePickerReingreso.Text, grado2, seccion2, aula2); db.insertarGradoAlumno(); MessageBox.Show("Datos Guardados correctamente", "Mensaje", MessageBoxButtons.OK); } else { MessageBox.Show("Seccion ya tiene 30 alumnos"); } } else { MessageBox.Show("El id NO Existe", "Mensaje", MessageBoxButtons.OK); } } }