public JsonResult LoadScheduleGroupByCinemaForFilmDetail(int filmId)
        {
            GroupCinemaServcie   gcService       = new GroupCinemaServcie();
            CinemaService        cService        = new CinemaService();
            ShowTimeService      tService        = new ShowTimeService();
            MovieScheduleService scheduleService = new MovieScheduleService();
            FilmService          fService        = new FilmService();
            DateTime             currentDate     = DateTime.Now;

            /*string dateInput = "2018-06-08";
             * DateTime currentDate = DateTime.Parse(dateInput);*/
            Film            currentFilm = fService.FindByID(filmId);
            List <DateTime> dates       = new DateUtility().getSevenDateFromNow(currentDate);
            string          serverPath  = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"));

            List <GroupCinema> groupCinemaList = gcService.GetAll();
            var obj = groupCinemaList
                      .Select(group => new
            {
                name  = group.name,
                img   = serverPath + group.logoImg,
                dates = new DateUtility().getSevenDateFromNow(currentDate)
                        .Select(selectDate => new
                {
                    dateOfWeek = selectDate.DayOfWeek,
                    date       = selectDate.Day,
                    /*cinemas =...*/
                }),
            });

            return(Json(obj));
        }
        public JsonResult GetSubScheduleFilmDetail(string filmIdStr, string selectDateStr, string groupIdStr)
        {
            int                  filmId          = Convert.ToInt32(filmIdStr);
            int                  groupId         = Convert.ToInt32(groupIdStr);
            string               serverPath      = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"));
            CinemaService        cService        = new CinemaService();
            ShowTimeService      tService        = new ShowTimeService();
            FilmService          fService        = new FilmService();
            MovieScheduleService scheduleService = new MovieScheduleService();
            Film                 currentFilm     = fService.FindByID(filmId);
            DateTime             selectDate      = DateTime.Parse(selectDateStr);
            var                  cinemas         = cService.getCinemaHasScheduleInCurrentDate(selectDate, filmId).FindAll(c => (int)c.groupId == groupId)
                                                   .Select(cine => new
            {
                id          = cine.cinemaId,
                img         = serverPath + cine.profilePicture,
                name        = cine.cinemaName,
                address     = cine.cinemaAddress,
                digTypeList = currentFilm.digTypeId.Split(';')
                              .Select(digType => new
                {
                    type  = digType,
                    times = scheduleService.GetMovieScheduleForDetailFilm(cine.cinemaId, selectDate, Convert.ToInt32(digType), filmId)
                            .Select(time => new
                    {
                        timeId    = Convert.ToInt32(time.GetType().GetProperty("timeId").GetValue(time, null)),
                        startTime = tService.FindByID(Convert.ToInt32(time.GetType().GetProperty("timeId").GetValue(time, null))).startTime
                    })
                })
            });

            return(Json(cinemas));
        }
예제 #3
0
        public JsonResult LoadFilmById(string filmId)
        {
            FilmService filmService = new FilmService();
            Film        item        = filmService.FindByID(Convert.ToInt32(filmId));
            string      serverPath  = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"));
            var         obj         = new
            {
                id          = item.filmId,
                name        = item.name,
                filmStatus  = item.filmStatus,
                trailerUrl  = item.trailerLink,
                imdb        = item.imdb,
                dateRelease = String.Format("{0:dd/MM/yyyy}", item.dateRelease),
                restricted  = item.restricted,
                img         = serverPath + item.additionPicture.Split(';')[0],
                length      = item.filmLength,
                star        = new string[(int)Math.Ceiling((double)item.imdb / 2)],
                author      = item.author,
                actorList   = item.actorList,
                movieGenre  = item.movieGenre,
                countries   = item.countries,
                content     = item.filmContent,
            };

            return(Json(obj));
        }
        public JsonResult LoadScheduleGroupByCinemaForFilmDetailBackGround(int filmId)
        {
            GroupCinemaServcie   gcService       = new GroupCinemaServcie();
            CinemaService        cService        = new CinemaService();
            ShowTimeService      tService        = new ShowTimeService();
            MovieScheduleService scheduleService = new MovieScheduleService();
            FilmService          fService        = new FilmService();
            DateTime             currentDate     = DateTime.Now;

            /*string dateInput = "2018-06-08";
             * DateTime currentDate = DateTime.Parse(dateInput);*/
            Film            currentFilm = fService.FindByID(filmId);
            List <DateTime> dates       = new DateUtility().getSevenDateFromNow(currentDate);
            string          serverPath  = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"));

            List <GroupCinema> groupCinemaList = gcService.GetAll();
            var obj = groupCinemaList
                      .Select(group => new
            {
                name  = group.name,
                img   = serverPath + group.logoImg,
                dates = new DateUtility().getSevenDateFromNow(currentDate)
                        .Select(selectDate => new
                {
                    dateOfWeek = selectDate.DayOfWeek,
                    date       = selectDate.Day,
                    cinemas    = cService.getCinemaHasScheduleInCurrentDate(selectDate, filmId).FindAll(c => c.groupId == group.GroupId)
                                 .Select(cine => new
                    {
                        id          = cine.cinemaId,
                        img         = serverPath + cine.profilePicture,
                        name        = cine.cinemaName,
                        address     = cine.cinemaAddress,
                        digTypeList = currentFilm.digTypeId.Split(';')
                                      .Select(digType => new{
                            type  = digType,
                            times = scheduleService.GetMovieScheduleForDetailFilm(cine.cinemaId, selectDate, Convert.ToInt32(digType), filmId)
                                    .Select(time => new
                            {
                                timeId    = Convert.ToInt32(time.GetType().GetProperty("timeId").GetValue(time, null)),
                                startTime = tService.FindByID(Convert.ToInt32(time.GetType().GetProperty("timeId").GetValue(time, null))).startTime
                            })
                        })
                    })
                }),
            });

            return(Json(obj));
        }