Exemplo n.º 1
0
        protected void ButtonBuscarHorario_Click(object sender, EventArgs e)
        {
            if (DropDownListTipoBusqueda.SelectedValue == "Seleccione una opcion")
            {
                Response.Write("<script> window.alert('Seleccione tipo de busqueda') </script>");
            }
            else
            {
                if (DropDownListTipoBusqueda.SelectedValue == "Horario alumno")
                {
                    if (TextBoxIdAlumno.Text == "")
                    {
                        Response.Write("<script> window.alert('Campo matricula obligatorio') </script>");
                    }
                    else
                    {
                        int idAlumno = BDhorario.LeerMatricula(TextBoxIdAlumno.Text);
                        if (BDhorario.buscarHorarioAlumno(idAlumno, Convert.ToInt32(DropDownListMateria.SelectedValue)))
                        {
                            horario = new Horarios();
                            horario = BDhorario.ReornarHorario();

                            TextBoxIdDocente.Text        = Convert.ToString(horario.IdProfesor);
                            DropDownListMateria.Visible  = false;
                            TextBoxNombreMateria.Visible = true;
                            TextBoxNombreMateria.Text    = bdmateria.LeerNombreMateria(horario.IdMateria);
                            //   int numerosemestre = obtenerNumeroSeemstre();
                            // numerosemestre = horario.IdMateria;
                            DropDownListCicloEscolar.SelectedValue = horario.CicloEscolar;
                            DropDownListGrupo.SelectedValue        = horario.Grupo;
                            TextBoxAula.Text               = horario.Aula;
                            TextBoxHoraEntrada.Text        = horario.HoraEntrada;
                            TextBoxHoraSalida.Text         = horario.HoraSalida;
                            DropDownListDias.SelectedValue = horario.Dias;
                        }
                    }
                }
                else
                {
                    if (DropDownListTipoBusqueda.SelectedValue == "Horario docente")
                    {
                        if (TextBoxIdDocente.Text == "")
                        {
                            Response.Write("<script> window.alert('Campo id profesor es obligatorio') </script>");
                        }
                        else
                        {
                            if (BDhorario.buscarHorarioDocente(Convert.ToInt32(TextBoxIdDocente.Text), Convert.ToInt32(DropDownListMateria.SelectedValue)))
                            {
                                horario = new Horarios();
                                horario = BDhorario.ReornarHorario();

                                TextBoxIdAlumno.Text         = Convert.ToString(horario.IdAlumno);
                                DropDownListMateria.Visible  = false;
                                TextBoxNombreMateria.Visible = true;
                                TextBoxNombreMateria.Text    = bdmateria.LeerNombreMateria(horario.IdMateria);
                                //   int numerosemestre = obtenerNumeroSeemstre();
                                // numerosemestre = horario.IdMateria;
                                DropDownListCicloEscolar.SelectedValue = horario.CicloEscolar;
                                DropDownListGrupo.SelectedValue        = Convert.ToString(horario.Grupo);
                                TextBoxAula.Text               = horario.Aula;
                                TextBoxHoraEntrada.Text        = horario.HoraEntrada;
                                TextBoxHoraSalida.Text         = horario.HoraSalida;
                                DropDownListDias.SelectedValue = horario.Dias;
                            }
                        }
                    }
                }
            }
        }