public void ExibirTurno()
    {
        GameObject exibirTurnoAtual = Instantiate(exibicaoTurno);

        exibirTurnoAtual.transform.SetParent(this.transform, false);
        exibirTurnoAtual.transform.GetChild(0).GetComponent <Text>().text = turno.ToString();
    }
Beispiel #2
0
        public static List <string> AmigosEnMateria(int alumnoId, int materiaId, Dias dia, Turnos turno)
        {
            var amigosEnMateria = new List <string>();

            using (var conn = new SqlConnection(Program.Configuration["ConnectionStrings:DefaultConnection"]))
            {
                conn.Open();

                var cmdSelect = new SqlCommand();
                cmdSelect.CommandText = @"SELECT A.Nombre
                                            FROM MateriaAlumno MA
                                            JOIN Alumnos A
                                              ON MA.AlumnoId = A.Id
                                            JOIN Seguidores S
                                              ON MA.AlumnoId = S.SeguidoId
                                            JOIN MateriaHorarios MH
                                              ON MA.MateriaHorarioId = MH.Id
                                            JOIN Horarios H
                                              ON MH.HorarioId = H.Id
                                           WHERE (S.AlumnoId = @AlumnoId)
                                             AND (MH.MateriaId = @MateriaId)
                                             AND (H.Dia = @Dia)
                                             AND (H.Turno = @Turno)
                                             AND (MA.Estado = 0)";
                cmdSelect.Parameters.Add(new SqlParameter("AlumnoId", alumnoId));
                cmdSelect.Parameters.Add(new SqlParameter("MateriaId", materiaId));
                cmdSelect.Parameters.Add(new SqlParameter("Dia", dia.ToString()));
                cmdSelect.Parameters.Add(new SqlParameter("Turno", turno.ToString()));
                cmdSelect.Connection = conn;

                using (var resultSelect = cmdSelect.ExecuteReader())
                {
                    while (resultSelect.Read())
                    {
                        amigosEnMateria.Add((string)resultSelect["Nombre"]);
                    }
                }
            }

            return(amigosEnMateria);
        }
Beispiel #3
0
        public static int ObtenerIdMateriaHorario(int idMateria, Dias dia, Turnos turno)
        {
            int idMateriaHorario = 0;

            using (var conn = new SqlConnection(Program.Configuration["ConnectionStrings:DefaultConnection"]))
            {
                conn.Open();

                var cmdSelect = new SqlCommand();
                cmdSelect.CommandText = @"SELECT Id
                                            FROM MateriaHorarios
                                           WHERE (MateriaId = (SELECT Id
                                                                 FROM Materias
                                                                WHERE (Id = @IdMateria )))
                                             AND (HorarioId = (SELECT Id 
                                                                 FROM Horarios 
                                                                WHERE (Dia = @Dia)
                                                                  AND (Turno = @Turno)))";
                cmdSelect.Parameters.Add(new SqlParameter("IdMateria", idMateria));
                cmdSelect.Parameters.Add(new SqlParameter("Dia", dia.ToString()));
                cmdSelect.Parameters.Add(new SqlParameter("Turno", turno.ToString()));
                cmdSelect.Connection = conn;

                using (var resultSelect = cmdSelect.ExecuteReader())
                {
                    while (resultSelect.Read())
                    {
                        idMateriaHorario = (int)resultSelect["Id"];
                    }
                }
            }

            if (idMateriaHorario == 0)
            {
                throw new Exception("IdMateriaHorario no encontrado");
            }

            return(idMateriaHorario);
        }
Beispiel #4
0
        public static string ValidarHorarioLibre(int idAlumno, Dias dia, Turnos turno)
        {
            var nombre = Constantes.Default;

            using (var conn = new SqlConnection(Program.Configuration["ConnectionStrings:DefaultConnection"]))
            {
                conn.Open();

                var cmdSelect = new SqlCommand();
                cmdSelect.CommandText = @"SELECT M.Nombre
                                            FROM Materias M
                                            JOIN MateriaHorarios MH
                                              ON M.Id = MH.MateriaId
                                            JOIN Horarios H
                                              ON MH.HorarioId = H.Id
                                            JOIN MateriaAlumno MA
                                              ON MH.Id = MA.MateriaHorarioId
                                           WHERE (MA.AlumnoId = @IdAlumno)
                                             AND (H.Dia = @Dia)
                                             AND (H.Turno = @Turno)
                                             AND (MA.Estado = 0)";
                cmdSelect.Parameters.Add(new SqlParameter("IdAlumno", idAlumno));
                cmdSelect.Parameters.Add(new SqlParameter("Dia", dia.ToString()));
                cmdSelect.Parameters.Add(new SqlParameter("Turno", turno.ToString()));
                cmdSelect.Connection = conn;

                using (var resultSelect = cmdSelect.ExecuteReader())
                {
                    while (resultSelect.Read())
                    {
                        nombre = resultSelect["Nombre"].ToString();
                    }
                }
            }

            return(nombre);
        }