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 ResellTicket(string ticketId, string buyerEmail, string sellerEmail)
        {
            Ticket ticket = new TicketService().FindByID(Convert.ToInt32(ticketId));

            ticket.ticketStatus = TicketStatus.reselled;
            string newCode = ticket.ticketId + RandomUtility.RandomString(9);


            string content = "Chúc mừng quý khách đã mua lại vé thành công!";

            content += "Bạn đã mua lại 1 vé của " + buyerEmail + "\n";
            Seat          seat     = new SeatService().FindByID(ticket.seatId);
            Room          room     = new RoomService().FindByID(seat.roomId);
            Cinema        cinema   = new CinemaService().FindByID(room.cinemaId);
            MovieSchedule schedule = new MovieScheduleService().FindByID(ticket.scheduleId);
            Film          film     = new FilmService().FindByID(schedule.filmId);

            content += "Tại " + cinema.cinemaName + "\n";
            content += "Mã vẽ mới của bạn là " + newCode + "\n";
            content += "Phim " + film.name + "\n";
            content += ". Ghế: " + ConstantArray.Alphabet[(int)seat.py] + "" + ((int)seat.px + 1) +
                       "- Mã vé: " + newCode + "\n";
            string mailSubject = "CinemaBookingTicket - Mua lại vé thành công " + cinema.cinemaName;

            MailUtility.SendEmail(mailSubject, content, buyerEmail);
            new TicketService().Update(ticket);
            var aObj = new
            {
                status   = ticket.ticketStatus,
                statusvn = TicketStatus.ViStatus[ticket.ticketStatus]
            };

            return(Json(aObj));
        }
예제 #4
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);
        }
예제 #5
0
        public ActionResult ChooseTicket(string filmId, string timeId, string cinemaId, string selectDate)
        {
            int                  filmIdData   = Convert.ToInt32(filmId);
            int                  timeIdData   = Convert.ToInt32(timeId);
            int                  cinemaIdData = Convert.ToInt32(cinemaId);
            DateTime             scheduleDate = DateTime.Parse(selectDate);
            MovieScheduleService msService    = new MovieScheduleService();
            MovieSchedule        schedule     = msService.FindMovieSchedule(filmIdData, timeIdData, cinemaIdData, scheduleDate).First();

            ViewBag.scheduleId = schedule.scheduleId;
            return(View());
        }
예제 #6
0
        public ActionResult ChooseTicket1(string filmId, string timeId, string cinemaId)
        {
            int      filmIdData   = Convert.ToInt32(filmId);
            int      timeIdData   = Convert.ToInt32(timeId);
            int      cinemaIdData = Convert.ToInt32(cinemaId);
            DateTime scheduleDate = DateTime.Parse("2018-06-08");
            //DateTime scheduleDate = DateTime.Today;
            MovieScheduleService msService = new MovieScheduleService();
            MovieSchedule        schedule  = msService.FindMovieSchedule(filmIdData, timeIdData, cinemaIdData, scheduleDate).First();

            ViewBag.scheduleId = schedule.scheduleId;
            return(View("~/Views/Home/ChooseTicket.cshtml"));
        }
        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));
        }
예제 #8
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));
     }
 }
예제 #9
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"));
        }
예제 #10
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());
        }