Example #1
0
        public static void ConstruirTurnos()
        {
            ADTurnos.Agregar(new Turno()
            {
                Fecha = DateTime.Now.AddDays(-7),
                Hora  = 18
            }
                             );

            DateTime fechaDesde = ObtenerUltimaFecha();

            DateTime fechaHastaNueva = fechaDesde.AddDays(30);

            do
            {
                for (int i = 18; i <= 23; i++)
                {
                    ADTurnos.Agregar(
                        new Entidades.Turno()
                    {
                        Fecha = fechaDesde,
                        Hora  = i
                    }
                        );
                }
                fechaDesde = fechaDesde.AddDays(1);
            } while (fechaDesde != fechaHastaNueva);
        }
Example #2
0
        public static void ConstruirTurnos(DateTime fechaDesde, DateTime fechaHasta)
        {
            DateTime fecha           = DameLunes(fechaDesde);
            DateTime fechaHastaNueva = fecha.AddDays(6);

            do
            {
                for (int i = 18; i <= 23; i++)
                {
                    ADTurnos.Agregar(
                        new Entidades.Turno()
                    {
                        Fecha = fecha,
                        Hora  = i
                    }
                        );
                    //ADTurnos.Agregar(
                    //    new Entidades.Turno()
                    //    {
                    //        Fecha = fecha,
                    //        Hora = i + 0.5M
                    //    }
                    //    );
                }
                fecha = fecha.AddDays(1);
            } while (fecha != fechaHastaNueva);
        }
Example #3
0
        public static int[] DevolverCantTurnosOcupados(int idSala, DateTime fechaInicio, DateTime fechaFin)
        {
            int[] TurnosOcupadosPorFecha = new int[30];

            List <Models.TurnosModel> ListaDeTurnos = ADTurnos.DevolverTurnosOcupados(idSala, fechaInicio, fechaFin);

            foreach (Models.TurnosModel Turno in ListaDeTurnos)
            {
                int i = DateFormat.NumeroFecha(Convert.ToDateTime(Turno.fecha));

                TurnosOcupadosPorFecha[i - 1]++;
            }

            return(TurnosOcupadosPorFecha);
        }
Example #4
0
        //Método deprecado
        public static List <SelectListItem> DevolverListaItems(int idSala, DateTime fechaIni, DateTime fechaFin)
        {
            List <Models.TurnosModel> lista = ADTurnos.devolverLista(idSala, fechaIni, fechaFin);
            List <SelectListItem>     items = null;

            items = lista.ConvertAll(db =>
            {
                return(new SelectListItem()
                {
                    Text = db.fecha + " ," + db.hora + "hs.",
                    Value = db.Id.ToString(),
                    Selected = false
                });
            });


            return(items);
        }
Example #5
0
 public static List <Models.TurnosModel> DevolverListaTurnos(int idSala, DateTime fechaIni, DateTime fechaFin)
 {
     return(ADTurnos.devolverLista(idSala, fechaIni, fechaFin));
 }
Example #6
0
 //Método deprecado
 private static List <Models.TurnosModel> DevolverListaTurnos(int idSala)
 {
     return(ADTurnos.devolverLista(idSala));
 }
Example #7
0
        private static DateTime ObtenerUltimaFecha()
        {
            DateTime UltimaFecha = ADTurnos.ObtenerUltimaFecha();

            return(UltimaFecha);
        }
Example #8
0
 public static Turno BuscarTurno(int idTurno)
 {
     return(ADTurnos.Buscar(idTurno));
 }
Example #9
0
        public static Models.TurnosModel[,] DevolverMatrizDeTurnos(int idSala, DateTime fechaIni, DateTime fechaFin)
        {
            List <Models.TurnosModel> listaDeTurnos = ADTurnos.devolverLista(idSala, fechaIni, fechaFin);

            Models.TurnosModel[,] matrizDeTurnos = new Models.TurnosModel[6, 7];

            int PosicionDia;
            int PosicionHora;

            foreach (Models.TurnosModel turno in listaDeTurnos)
            {
                switch (Convert.ToDateTime(turno.fecha).DayOfWeek)
                {
                case DayOfWeek.Monday:
                    PosicionDia = 0;
                    break;

                case DayOfWeek.Tuesday:
                    PosicionDia = 1;
                    break;

                case DayOfWeek.Wednesday:
                    PosicionDia = 2;
                    break;

                case DayOfWeek.Thursday:
                    PosicionDia = 3;
                    break;

                case DayOfWeek.Friday:
                    PosicionDia = 4;
                    break;

                case DayOfWeek.Saturday:
                    PosicionDia = 5;
                    break;

                case DayOfWeek.Sunday:
                    PosicionDia = 6;
                    break;

                default:
                    PosicionDia = -1;
                    break;
                }
                decimal hora = Convert.ToDecimal(turno.hora);
                switch (turno.hora)
                {
                case "18.00":
                    PosicionHora = 0;
                    break;

                case "19.00":
                    PosicionHora = 1;
                    break;

                case "20.00":
                    PosicionHora = 2;
                    break;

                case "21.00":
                    PosicionHora = 3;
                    break;

                case "22.00":
                    PosicionHora = 4;
                    break;

                case "23.00":
                    PosicionHora = 5;
                    break;

                default:
                    PosicionHora = -1;
                    break;
                }

                if (PosicionDia != -1 && PosicionHora != -1)
                {
                    matrizDeTurnos[PosicionHora, PosicionDia] = turno;
                }
            }


            return(matrizDeTurnos);
        }