Exemplo n.º 1
0
        public IQueryable lugaresOcupados([FromBody] InDataFecha data)
        {
            var periodoController = new PeriodoAcademicoController(context);
            var tipoSemana        = periodoController.getTipoSemanaEnPeriodo(new InDataFecha {
                fecha = data.fecha
            });
            var    periodoActual = periodoController.GetPeriodoFecha(data.fecha);
            string examen        = periodoController.tipoExamen(data.fecha);
            int    dia           = (int)data.fecha.DayOfWeek;


            var lugaresOcupados =
                from horario in context.TBL_HORARIO
                where horario.strExamen == examen
                join curso in context.TBL_CURSO on horario.intIdCurso equals curso.intIdCurso
                join lugar in context.TBL_LUGAR_ESPOL on horario.intIdAula equals lugar.intIdLugarEspol
                join padre in context.TBL_LUGAR_ESPOL on lugar.intIdLugarPadre equals padre.intIdLugarEspol
                where lugar.strTipo == "A" &&
                curso.intIdPeriodo == periodoActual.intIdPeriodoAcademico &&
                horario.intDia == dia &&
                horario.chTipo == tipoSemana.tipo &&
                horario.tsHoraInicio <= data.fecha.TimeOfDay &&
                horario.tsHoraFin > data.fecha.TimeOfDay
                select new
            {
                idLugar     = lugar.intIdLugarEspol,
                nombreLugar = lugar.strDescripcion,
                idPadre     = padre.intIdLugarEspol,
                nombrePadre = padre.strDescripcion
            };

            return(lugaresOcupados.Distinct());
        }
Exemplo n.º 2
0
        public IQueryable obtenerLugaresDisponibles([FromBody] InDataFecha data)
        {
            var periodoController = new PeriodoAcademicoController(context);
            var tipoSemana        = periodoController.getTipoSemanaEnPeriodo(new InDataFecha {
                fecha = data.fecha
            });
            var    periodoActual = periodoController.GetPeriodoFecha(data.fecha);
            string examen        = periodoController.tipoExamen(data.fecha);


            var lugaresOcupados =
                from horario in context.TBL_HORARIO
                where horario.strExamen == examen
                join curso in context.TBL_CURSO on horario.intIdCurso equals curso.intIdCurso
                join lugar in context.TBL_LUGAR_ESPOL on horario.intIdAula equals lugar.intIdLugarEspol
                join padre in context.TBL_LUGAR_ESPOL on lugar.intIdLugarPadre equals padre.intIdLugarEspol
                where lugar.strTipo == "A" &&
                horario.chTipo == tipoSemana.tipo &&
                horario.tsHoraInicio <= data.fecha.TimeOfDay &&
                horario.tsHoraFin > data.fecha.TimeOfDay
                select new
            {
                idLugar     = lugar.intIdLugarEspol,
                nombreLugar = lugar.strDescripcion,
                idPadre     = padre.intIdLugarEspol,
                nombrePadre = padre.strDescripcion
            };

            var lugaresOcupadosRecuperaciones =
                from horario in context.TBL_HORARIO_CONTENIDO
                join lugar in context.TBL_LUGAR_ESPOL on horario.intIdLugarEspol equals lugar.intIdLugarEspol
                join padre in context.TBL_LUGAR_ESPOL on lugar.intIdLugarPadre equals padre.intIdLugarEspol
                where lugar.strTipo == "A" &&
                horario.dtFecha == data.fecha.Date &&
                horario.tsHoraInicio <= data.fecha.TimeOfDay &&
                horario.tsHoraFin <= data.fecha.TimeOfDay
                select new
            {
                idLugar     = lugar.intIdLugarEspol,
                nombreLugar = lugar.strDescripcion,
                idPadre     = padre.intIdLugarEspol,
                nombrePadre = padre.strDescripcion
            };

            var infoLugares =
                from lugar in context.TBL_LUGAR_ESPOL
                join padre in context.TBL_LUGAR_ESPOL on lugar.intIdLugarPadre equals padre.intIdLugarEspol
                where lugar.strTipo == "A" && lugar.strEstado == "V"
                select new
            {
                idLugar     = lugar.intIdLugarEspol,
                nombreLugar = lugar.strDescripcion,
                idPadre     = padre.intIdLugarEspol,
                nombrePadre = padre.strDescripcion
            };

            return(infoLugares.Except(lugaresOcupados.Union(lugaresOcupadosRecuperaciones)).Distinct().OrderBy(x => x.nombreLugar));;
        }
        public TipoSemana getTipoSemanaEnPeriodo([FromBody] InDataFecha data)
        {
            var periodoContenedor = context.TBL_PERIODO_ACADEMICO.Where(x => x.dtFechaInicio <= data.fecha && data.fecha <= x.dtFechaFin).FirstOrDefault();

            if (periodoContenedor == null)
            {
                return new TipoSemana {
                           tipo = "N"
                }
            }
            ;

            //Semanas donde habrá examen
            if (data.fecha >= periodoContenedor.FechaIniEval1 && data.fecha.Date <= periodoContenedor.FechaFinEval1)
            {
                return new TipoSemana {
                           tipo = "E"
                }
            }
            ;
            if (data.fecha >= periodoContenedor.FechaIniEval2 && data.fecha.Date <= periodoContenedor.FechaFinEval2)
            {
                return new TipoSemana {
                           tipo = "E"
                }
            }
            ;
            if (data.fecha >= periodoContenedor.FechaIniMejoramiento && data.fecha.Date <= periodoContenedor.FechaFinMejoramiento)
            {
                return new TipoSemana {
                           tipo = "E"
                }
            }
            ;

            //Semanas donde no habrá ni examen, ni clases
            if (data.fecha > periodoContenedor.FechaFinMejoramiento)
            {
                return new TipoSemana {
                           tipo = "N"
                }
            }
            ;
            if (data.fecha < periodoContenedor.FechaIniMejoramiento && data.fecha > periodoContenedor.FechaFinEval2)
            {
                return new TipoSemana {
                           tipo = "N"
                }
            }
            ;

            //Caso contrario, habrá clases
            return(new TipoSemana {
                tipo = "C"
            });
        }
Exemplo n.º 4
0
        public Object datosFecha([FromBody] InDataFecha data)
        {
            var periodoController = new PeriodoAcademicoController(contextSAAC);

            return(new
            {
                tipoSemana = periodoController.getTipoSemanaEnPeriodo(new InDataFecha {
                    fecha = data.fecha
                }),
                examen = periodoController.tipoExamen(data.fecha),
                dia = (int)data.fecha.DayOfWeek
            });
        }
Exemplo n.º 5
0
 public RetornoEstadisticas estadisticasMapa([FromBody] InDataFecha data)
 {
     return(new RetornoEstadisticas
     {
         numRegistrados = cantRegistrados(data.fecha) + cantProfesoresPeriodo(data.fecha),
         cantBloquesUsados = cantBloquesUsadosFecha(data.fecha),
         cantBloquesTotales = cantBloquesTotales(),
         cantLugares = cantLugaresTotales(),
         cantLugaresUsados = cantLugaresUsadosFecha(data.fecha),
         promPersonasPorBloque = promedioPersonasPorBloque(data.fecha),
         promPersonasPorLugar = promedioPersonasPorLugar(data.fecha),
         totalPersonasMomento = totalPersonasMomento(data.fecha),
         cantPersonasPorBloque = CantidadDePersonasPorBloque(data.fecha)
     });
 }
Exemplo n.º 6
0
        public IQueryable datosMapa([FromBody] InDataFecha data)
        {
            var periodoController = new PeriodoAcademicoController(contextSAAC);
            var periodoActual     = periodoController.GetPeriodoFecha(data.fecha);
            var tipoSemana        = periodoController.getTipoSemanaEnPeriodo(new InDataFecha {
                fecha = data.fecha
            });
            string examen = periodoController.tipoExamen(data.fecha);
            int    dia    = (int)data.fecha.DayOfWeek;
            var    query  =
                from horario in contextSAAC.TBL_HORARIO
                where horario.strExamen == examen
                join curso in contextSAAC.TBL_CURSO on horario.intIdCurso equals curso.intIdCurso
                join lugar in contextSAAC.TBL_LUGAR_ESPOL on horario.intIdAula equals lugar.intIdLugarEspol
                where horario.intDia == dia &&
                curso.intIdPeriodo == periodoActual.intIdPeriodoAcademico &&
                horario.chTipo == tipoSemana.tipo &&
                horario.tsHoraInicio <= data.fecha.TimeOfDay &&
                horario.tsHoraFin > data.fecha.TimeOfDay
                select new
            {
                idHorario        = horario.intIdHorario,
                fecha            = horario.dtFecha,
                horaInicio       = horario.tsHoraInicio,
                horaFin          = horario.tsHoraFin,
                tipoHorario      = horario.chTipo,
                numRegistrados   = curso.intNumRegistrados + 1,   // Por el profesor
                tipoCurso        = curso.strTipoCurso,
                idLugar          = lugar.intIdLugarEspol,
                descripcionLugar = lugar.strDescripcion,
                latitud          = lugar.strLatitud,
                longitud         = lugar.strLongitud,
                tipoLugar        = lugar.strTipo
            };

            var query2 =
                from horario in contextSAAC.TBL_HORARIO_CONTENIDO
                join curso in contextSAAC.TBL_CURSO on horario.intIdCurso equals curso.intIdCurso
                join lugar in contextSAAC.TBL_LUGAR_ESPOL on horario.intIdLugarEspol equals lugar.intIdLugarEspol
                where data.fecha == horario.dtFecha &&
                horario.strEstadoRecuperacion == "AP" &&
                horario.intIdLugarEspol != null &&
                horario.tsHoraInicio <= data.fecha.TimeOfDay &&
                horario.tsHoraFin > data.fecha.TimeOfDay
                select new
            {
                idHorario        = horario.intIdHorarioContenido,
                fecha            = horario.dtFecha,
                horaInicio       = horario.tsHoraInicioPlanificado,
                horaFin          = horario.tsHoraFinPlanificado,
                tipoHorario      = horario.strTipo,
                numRegistrados   = curso.intNumRegistrados + 1,   // Por el profesor
                tipoCurso        = curso.strTipoCurso,
                idLugar          = lugar.intIdLugarEspol,
                descripcionLugar = lugar.strDescripcion,
                latitud          = lugar.strLatitud,
                longitud         = lugar.strLongitud,
                tipoLugar        = lugar.strTipo
            };

            return(query.Concat(query2));
        }
 public CdaPeriodoAcademico periodoFecha([FromBody] InDataFecha data)
 {
     return(this.GetPeriodoFecha(data.fecha));
 }