private void button1_Click(object sender, EventArgs e) { int y = 12; Coneccion_de_Director con = new Coneccion_de_Director(); int tamaño = con.numero_de_horaio_prof(Buscador_profe.Text); foreach (string cont in con.listar_id_profe(Buscador_profe.Text)) { int i = Convert.ToInt32(cont); Button temp = new Button(); temp.Height = 70; temp.Width = 230; temp.Location = new Point(10, y); y += 75; temp.Name = "btnBoton" + cont; temp.Text = " Materia: " + con.mostrar_horario("materia", i) + " \n Curso: " + con.mostrar_horario("curso", i) + " \n Dia: " + con.mostrar_horario("dia", i) + " \n hora: " + con.mostrar_horario("horarioDE", i) + " " + con.mostrar_horario("horarioHASTA", i); temp.BackColor = Color.CornflowerBlue; temp.TextAlign = ContentAlignment.MiddleLeft; panel_de_horario.Controls.Add(temp); } Nombre_Profesor.Text = con.mostrar_profesor(Buscador_profe.Text, "Nombre_del_profesor"); Apellido_paterno.Text = con.mostrar_profesor(Buscador_profe.Text, "Apellido_paterno"); Apellido_materno.Text = con.mostrar_profesor(Buscador_profe.Text, "Apellido_materno"); CI_de_profesor.Text = con.mostrar_profesor(Buscador_profe.Text, "CI_de_profesor"); }
private void B_Crear_Horario_Click(object sender, EventArgs e) { Coneccion_de_Director conec = new Coneccion_de_Director(); string horarioDE = de_hora.Text + ":" + de_minutos.Text; string horarioHASTA = hasta_hora.Text + ":" + hasta_minutos.Text; conexion conexionbdd = new conexion(); L_error_CI.Visible = CI_de_profesor.Text == ""; l_curso.Visible = curso.Text == "--- Seleccione Curso ---"; l_materia.Visible = materia.Text == "-- Seleccione Materia --"; l_dia.Visible = dia.Text == "----- Seleccione Dia -----"; if (!L_error_CI.Visible && !l_curso.Visible && !l_materia.Visible && !l_dia.Visible) { L_error_CI.Visible = CI_de_profesor.Text != conec.mostrar_profesor(CI_de_profesor.Text, "CI_de_profesor"); if (!L_error_CI.Visible) { conexionbdd.insertar("INSERT INTO Horarios (CI_de_profesor, curso, materia,dia , horarioDE, horarioHASTA) VALUES (" + Convert.ToInt32(CI_de_profesor.Text) + ", '" + curso.Text + "', '" + materia.Text + "', '" + dia.Text + "', '" + horarioDE + "', '" + horarioHASTA + "')"); MessageBox.Show("Guardado.."); } else { MessageBox.Show("ERROR CON LOS DATOS"); } } else { MessageBox.Show("ERROR CON LOS DATOS"); } }