Exemplo n.º 1
0
        public JsonResult LoadCinema()
        {
            GroupCinemaServcie gcService = new GroupCinemaServcie();
            CinemaService      cService  = new CinemaService();
            ShowTimeService    tService  = new ShowTimeService();
            FilmService        fService  = new FilmService();

            List <GroupCinema> groupCinemaList = gcService.GetAll();
            var obj = groupCinemaList
                      .Select(item => new
            {
                name    = item.name,
                img     = item.logoImg,
                cinemas = cService.FindBy(c => c.groupId == item.GroupId)
                          .Select(cine => new
                {
                    id      = cine.cinemaId,
                    img     = cine.profilePicture,
                    name    = cine.cinemaName,
                    address = cine.cinemaAddress,
                })
            });

            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));
        }
        public JsonResult LoadScheduleGroupByCinema()
        {
            GroupCinemaServcie gcService = new GroupCinemaServcie();
            CinemaService      cService  = new CinemaService();
            ShowTimeService    tService  = new ShowTimeService();
            FilmService        fService  = new FilmService();
            //DateTime currentDate = DateTime.Today;
            string   dateInput   = "2018-06-08";
            DateTime currentDate = DateTime.Parse(dateInput);

            List <GroupCinema> groupCinemaList = gcService.GetAll();
            var obj = groupCinemaList
                      .Select(item => new
            {
                name    = item.name,
                img     = item.logoImg,
                cinemas = cService.FindBy(c => c.groupId == item.GroupId)
                          .Select(cine => new
                {
                    id      = cine.cinemaId,
                    img     = cine.profilePicture,
                    name    = cine.cinemaName,
                    address = cine.cinemaAddress,
                    films   = new ScheduleUtility().getFilmListInSchedule(cine.cinemaId, currentDate)
                })
            });

            return(Json(obj));
        }
        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));
        }
Exemplo n.º 5
0
        public List <Object> getFilmListInSchedule(int cinemaId, DateTime currentDate)
        {
            List <Object>        returnList      = new List <Object>();
            MovieScheduleService scheduleService = new MovieScheduleService();
            List <Object>        list            = scheduleService.getMovieScheduleOfCinema(cinemaId, currentDate);
            FilmService          fService        = new FilmService();
            ShowTimeService      tService        = new ShowTimeService();
            Object          c;
            List <Film>     filmList     = fService.FindBy(f => f.filmStatus != (int)FilmStatus.notAvailable);
            List <ShowTime> showTimeList = tService.GetAll();

            int           currentFilmId = -1;
            List <Object> myTimeList    = null;

            foreach (var item in list)
            {
                int      filmId = Convert.ToInt32(item.GetType().GetProperty("filmId").GetValue(item, null));
                Film     aFilm  = findFilmInList(filmList, filmId);
                int      timeId = Convert.ToInt32(item.GetType().GetProperty("timeId").GetValue(item, null));
                ShowTime aTime  = findShowTimeInList(showTimeList, timeId);

                if (filmId != currentFilmId)
                {
                    currentFilmId = filmId;
                    myTimeList    = new List <Object>();
                    Object timeObj = new
                    {
                        id        = aTime.timeId,
                        startTime = aTime.startTime,
                        endTime   = aTime.endTime,
                    };
                    myTimeList.Add(timeObj);
                    c = new
                    {
                        filmId      = aFilm.filmId,
                        filmName    = aFilm.name,
                        img         = aFilm.additionPicture.Split(';')[0],
                        length      = aFilm.filmLength,
                        imdb        = aFilm.imdb,
                        restricted  = aFilm.restricted,
                        digitalType = aFilm.digTypeId,
                        timeList    = myTimeList,
                    };
                    returnList.Add(c);
                }
                else
                {
                    myTimeList.Add(new
                    {
                        id        = aTime.timeId,
                        startTime = aTime.startTime,
                        endTime   = aTime.endTime,
                    });
                }
            }
            return(returnList);
        }
Exemplo n.º 6
0
 public CreateModel(
     ShowTimeService showTimeService,
     TicketTypeService ticketTypeService,
     UserService userService,
     TicketService ticketService)
 {
     this.showTimeService   = showTimeService;
     this.ticketService     = ticketService;
     this.userService       = userService;
     this.ticketTypeService = ticketTypeService;
 }
Exemplo n.º 7
0
 public BookTicketModel(
     TicketService ticketService,
     ShowTimeService showTimeService,
     TicketTypeService ticketTypeService,
     UserService userService
     )
 {
     this.ticketService     = ticketService;
     this.showTimeService   = showTimeService;
     this.ticketTypeService = ticketTypeService;
     this.userService       = userService;
 }
        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));
        }
Exemplo n.º 9
0
 public JsonResult GetTicketListBelongToMail(string confirmCode, string email)
 {
     if (confirmCode.Equals("123456"))
     {
         List <object> objectList = new List <object>();
         List <Ticket> ticketList = new TicketService().getTicketByEmail(email);
         foreach (var item in ticketList)
         {
             MovieSchedule schedule   = new MovieScheduleService().FindByID(item.scheduleId);
             Room          room       = new RoomService().FindByID(schedule.roomId);
             Seat          seat       = new SeatService().FindByID(item.seatId);
             string        startTime  = new ShowTimeService().FindByID(schedule.timeId).startTime;
             string        filmName   = new FilmService().FindByID(schedule.filmId).name;
             string        cinemaName = new CinemaService().FindByID(room.cinemaId).cinemaName;
             string        roomName   = room.name;
             int           seatId     = seat.seatId;
             string        seatName   = ConstantArray.Alphabet[(int)seat.py] + "" + ((int)seat.px + 1);
             string        date       = String.Format("{0:dd/MM/yyyy}", schedule.scheduleDate);
             var           aObj       = new
             {
                 ticketId    = item.ticketId,
                 bookingId   = item.bookingId,
                 scheduleId  = item.scheduleId,
                 seatId      = seatId,
                 filmName    = filmName,
                 cinemaNames = cinemaName.Split('-'),
                 roomName    = roomName,
                 seatName    = seatName,
                 date        = date,
                 startTime   = startTime,
                 status      = item.ticketStatus,
                 statusvn    = TicketStatus.ViStatus[item.ticketStatus],
             };
             objectList.Add(aObj);
         }
         var returnObj = from s in objectList
                         select s;
         return(Json(returnObj));
     }
     else
     {
         var aObj = new
         {
             isWrong = "true"
         };
         return(Json(aObj));
     }
 }
Exemplo n.º 10
0
        public ActionResult ChooseTicketAndSeatToday(string filmId, string timeId, string cinemaId)
        {
            int    filmIdData   = Convert.ToInt32(filmId);
            int    timeIdData   = Convert.ToInt32(timeId);
            int    cinemaIdData = Convert.ToInt32(cinemaId);
            string startTime    = new ShowTimeService().FindByID(timeIdData).startTime;

            DateTime             today        = DateTime.Today;
            string               dateInput    = today.Year + "-" + today.Month + "-" + today.Day + " " + startTime;//21:30
            DateTime             scheduleDate = DateTime.Parse(dateInput);
            MovieScheduleService msService    = new MovieScheduleService();
            MovieSchedule        schedule     = msService.FindMovieSchedule(filmIdData, timeIdData, cinemaIdData, scheduleDate).First();

            ViewBag.scheduleId = schedule.scheduleId;
            return(View("~/Views/Home/ChooseTicketAndSeat.cshtml"));
        }
Exemplo n.º 11
0
        public ActionResult ChooseTicketAndSeat(string filmId, string timeId, string cinemaId, string selectDate)
        {
            int    filmIdData   = Convert.ToInt32(filmId);
            int    timeIdData   = Convert.ToInt32(timeId);
            int    cinemaIdData = Convert.ToInt32(cinemaId);
            string startTime    = new ShowTimeService().FindByID(timeIdData).startTime;
            //DateTime scheduleDate = DateTime.Parse(selectDate);
            DateTime dateSelect   = DateTime.Parse(selectDate);
            string   dateInput    = dateSelect.Year + "-" + dateSelect.Month + "-" + dateSelect.Day + " " + startTime;//21:30
            DateTime scheduleDate = DateTime.Parse(dateInput);

            MovieScheduleService msService = new MovieScheduleService();
            MovieSchedule        schedule  = msService.FindMovieSchedule(filmIdData, timeIdData, cinemaIdData, scheduleDate).First();

            ViewBag.scheduleId = schedule.scheduleId;
            return(View());
        }
Exemplo n.º 12
0
        public JsonResult LoadGroupCinema()
        {
            GroupCinemaServcie gcService  = new GroupCinemaServcie();
            CinemaService      cService   = new CinemaService();
            ShowTimeService    tService   = new ShowTimeService();
            FilmService        fService   = new FilmService();
            string             serverPath = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"));

            List <GroupCinema> groupCinemaList = gcService.GetAll();
            var obj = groupCinemaList
                      .Select(item => new
            {
                id   = item.GroupId,
                name = item.name,
                img  = serverPath + item.logoImg
            });

            return(Json(obj));
        }
Exemplo n.º 13
0
        public void GetAllShowTimeByMovieTheater_ValidQuery_SuccessResult()
        {
            var showtimes = new List<ShowTime>
            {
                new ShowTime{Id=1,MovieTheaterId=1,Status=Data.Enums.Status.NowShowing,DateCreated=DateTime.Now,DateModified=DateTime.Now,DateShowing=DateTime.Now},
                new ShowTime{Id=2,MovieTheaterId=1,Status=Data.Enums.Status.NowShowing,DateCreated=DateTime.Now,DateModified=DateTime.Now,DateShowing=DateTime.Now},
                new ShowTime{Id=3,MovieTheaterId=1,Status=Data.Enums.Status.NowShowing,DateCreated=DateTime.Now,DateModified=DateTime.Now,DateShowing=DateTime.Now}
            };

            _mockMovieTheaterRepository.Setup(x => x.FindSingle(It.IsAny<Expression<Func<MovieTheater, bool>>>()))
                .Returns(new MovieTheater { Id = 1, MovieId = 1, TheaterId = 1 });

            _mockShowTimeTheaterRepository.Setup(x => x.FindAll(It.IsAny<Expression<Func<ShowTime, bool>>>()))
                .Returns(showtimes.AsQueryable());

            var showtimeService = new ShowTimeService(_mockMovieTheaterRepository.Object, _mockShowTimeTheaterRepository.Object, _mapper);

            var result = showtimeService.GetAllShowTimeByMovieTheater(1, 1);

            Assert.Equal(3, result.Count());
        }
Exemplo n.º 14
0
 public CreateModel(ShowTimeService service, TheaterService theaterService, MovieService movieService, RoomService roomService)
 {
     this.service      = service;
     this.movieService = movieService;
     this.roomService  = roomService;
 }
Exemplo n.º 15
0
 public IndexModel(ShowTimeService service)
 {
     this.service = service;
 }
Exemplo n.º 16
0
 public IndexModel(ShowTimeService service, MovieService movieService)
 {
     this.service      = service;
     this.movieService = movieService;
 }
Exemplo n.º 17
0
 public MovieModel(MovieService movieService, TheaterService theaterService, ShowTimeService showTimeService)
 {
     this.movieService    = movieService;
     this.theaterService  = theaterService;
     this.showTimeService = showTimeService;
 }
Exemplo n.º 18
0
 public UpdateModel(ShowTimeService service, MovieService movieService, RoomService roomService)
 {
     this.service      = service;
     this.movieService = movieService;
     this.roomService  = roomService;
 }