Exemplo n.º 1
0
        public void Test_Showing_Id()
        {
            var expected = typeof(Guid);
            var s        = new Showing();

            var actual = s.Id;

            Assert.True(actual.GetType() == expected);
        }
Exemplo n.º 2
0
        public void Test_ShowingMovies()
        {
            var expected = 1;
            var sut      = new Showing();
            var actual   = sut.Movies;

            Assert.True(typeof(List <Movie>) == actual.GetType());
            Assert.True(expected <= actual.Count);
        }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "ShowingID,Location,Title,Date,StartTime,EndTime, Pending,SpecialEvent MoviePrice")] Showing Showing, int SelectedMovies)
        {
            Movie movie = db.Movies.Find(SelectedMovies);

            Showing.Movie = movie;
            Showing.Title = movie.Title;
            //Showing.Movie.Title = movie.Title;
            Showing.Runtime = movie.Runtime;


            if (ModelState.IsValid)
            {
                db.Showings.Add(Showing);
                db.SaveChanges();

                int      year   = Showing.Date.Year;
                int      month  = Showing.Date.Month;
                int      day    = Showing.Date.Day;
                int      hour   = Showing.Date.Hour;
                int      min    = Showing.Date.Minute;
                int      second = Showing.Date.Second;
                DateTime d2     = new DateTime(year, month, day + 1, hour, min, second);
                Showing.Date = d2;
                db.Showings.Add(Showing);
                db.SaveChanges();

                DateTime d3 = new DateTime(year, month, day + 2, hour, min, second);
                Showing.Date = d3;
                db.Showings.Add(Showing);
                db.SaveChanges();

                DateTime d4 = new DateTime(year, month, day + 3, hour, min, second);
                Showing.Date = d4;
                db.Showings.Add(Showing);
                db.SaveChanges();

                DateTime d5 = new DateTime(year, month, day + 4, hour, min, second);
                Showing.Date = d5;
                db.Showings.Add(Showing);
                db.SaveChanges();

                DateTime d6 = new DateTime(year, month, day + 5, hour, min, second);
                Showing.Date = d6;
                db.Showings.Add(Showing);
                db.SaveChanges();

                DateTime d7 = new DateTime(year, month, day + 6, hour, min, second);
                Showing.Date = d7;
                db.Showings.Add(Showing);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            ViewBag.AllMovies = GetAllMovies(Showing);
            return(View(Showing));
        }
Exemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "ShowingID,Movie,ShowingDate,TimeofWeek,Theatre,SpecialEvent")] Showing showing)
 {
     if (ModelState.IsValid)
     {
         db.Entry(showing).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(showing));
 }
Exemplo n.º 5
0
 public override void OnDraw()
 {
     if (Showing != null)
     {
         // Apply theme
         Util.SetThemeToTexture(Showing, Theme.Lyric);
         Showing.ScaleX *= AmaotoUtil.GetProperScaleX(Showing, Theme.MaximumWidth);
         Showing.Draw(Theme.Lyric.X, Theme.Lyric.Y);
     }
 }
Exemplo n.º 6
0
 public IAsyncAction ShowAsync()
 {
     return(AsyncAction.FromTask(async ct =>
     {
         CoreDispatcher.CheckThreadAccess();
         _isShown = true;
         UpdateSystemUiVisibility();
         Showing?.Invoke(this, null);
     }));
 }
Exemplo n.º 7
0
        private int Insert(Showing item, IDbConnection db)
        {
            var    date = item.ShowingDateTime.ToString("yyyy-MM-dd HH:mm:ss");
            string sql  = @"INSERT INTO Showing (MovieId, TheatreId, ShowingDateTime)"
                          + $"Values ({item.MovieId.Id}, {item.TheatreId.Id}, '{date}');"
                          + @"SELECT CAST(SCOPE_IDENTITY() as int)";
            var id = db.Query <int>(sql).Single();

            return(id);
        }
Exemplo n.º 8
0
        public async Task <List <Showing> > GetShowings(int id = -1)
        {
            List <Showing> showingsFromService = null;
            // api/persons/{id}
            string useRestUrl = restUrl;
            bool   hasValidId = (id > 0);

            if (hasValidId)
            {
                useRestUrl += id;
            }
            var uri = new Uri(string.Format(useRestUrl));

            try
            {
                var response = await _httpClient.GetAsync(uri);

                if (response.IsSuccessStatusCode)
                {
                    var content = await response.Content.ReadAsStringAsync();

                    if (hasValidId)
                    {
                        Showing foundShowing = JsonConvert.DeserializeObject <Showing>(content);
                        if (foundShowing != null)
                        {
                            showingsFromService = new List <Showing>()
                            {
                                foundShowing
                            };
                        }
                    }
                    else
                    {
                        showingsFromService = JsonConvert.DeserializeObject <List <Showing> >(content);
                    }
                }
                else
                {
                    if (response.StatusCode == System.Net.HttpStatusCode.NoContent)
                    {
                        showingsFromService = new List <Showing>();
                    }
                    else
                    {
                        showingsFromService = null;
                    }
                }
            }
            catch
            {
                showingsFromService = null;
            }
            return(showingsFromService);
        }
Exemplo n.º 9
0
        public ActionResult DeleteConfirmed(int id)
        {
            Showing showing = db.Showings.Find(id);

            db.Showings.Remove(showing);
            db.SaveChanges();
            var user = UserManager.FindById(User.Identity.GetUserId());

            SendMovieCancelEmail(user);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 10
0
 private void OnIsOpenChanged()
 {
     if (IsOpen)
     {
         Showing?.Invoke(this, new CalloutEventArgs(this));
     }
     else
     {
         Hiding?.Invoke(this, new CalloutEventArgs(this));
     }
 }
Exemplo n.º 11
0
        private int Insert(Showing item, IDbConnection db)
        {
            int    movieId   = item.MovieId.Id;
            int    theatreId = item.TheatreId.Id;
            string sql       = @"INSERT INTO Showing (MovieId, TheatreId, ShowingDateTime)"
                               + $"Values ({movieId}, {theatreId}, '{item.ShowingDateTime}');"
                               + @"SELECT CAST(SCOPE_IDENTITY() as int)";
            var id = db.Query <int>(sql).Single();

            return(id);
        }
Exemplo n.º 12
0
        public ActionResult SelectSeat(int id)
        {
            OrderDetail od = db.OrderDetails.Find(id);
            //Order order = od.Order;
            Showing            showing = od.Showing;
            List <OrderDetail> ods     = showing.OrderDetails.Where(oo => oo.Order.CancelStatus == CancelStatus.No).ToList();

            ViewBag.GetAvaiableSeats = EasyAvailableSeats(ods);

            return(View(od));
        }
Exemplo n.º 13
0
        public static Decimal GetBasePrice(Showing showing)
        {
            AppDbContext db = new AppDbContext();

            Decimal showingPrice = 0;

            // assign price for each ticket

            Boolean weekend = (int)showing.ShowDate.DayOfWeek == 6 || (int)showing.ShowDate.DayOfWeek == 0;

            Debug.WriteLine(weekend);
            // checks if showing is matinee
            if (showing.StartHour < 12 && weekend == false)
            {
                var query = from c in db.Discounts
                            where c.DiscountName == "matinee"
                            select c;
                foreach (var result in query)
                {
                    // sets Current Price property
                    // $5.00
                    showingPrice = result.DiscountValue;
                }
            }

            // checks if showing day is weekday and afternoon
            else if (showing.StartHour >= 12 && ((int)showing.ShowDate.DayOfWeek >= 1 && (int)showing.ShowDate.DayOfWeek <= 4))
            {
                var query = from c in db.Discounts
                            where c.DiscountName == "weekday"
                            select c;
                foreach (var result in query)
                {
                    // sets Current Price property
                    // $10.00
                    showingPrice = result.DiscountValue;
                }
            }
            // checks if showing day is after friday noontime
            else
            {
                var query = from c in db.Discounts
                            where c.DiscountName == "weekend"
                            select c;
                foreach (var result in query)
                {
                    // sets Current Price property
                    // $12.00
                    showingPrice = result.DiscountValue;
                }
            }

            return(showingPrice);
        }
Exemplo n.º 14
0
        private void ShowShowingButton_Click(object sender, RoutedEventArgs e)
        {
            Showing    showing    = ((FrameworkElement)sender).DataContext as Showing;
            FilmWindow filmWindow = new FilmWindow();

            filmWindow.Owner          = this;
            filmWindow.Showing        = showing;
            filmWindow.Authentication = Authentication;
            filmWindow.Service        = Service;
            filmWindow.Show();
        }
Exemplo n.º 15
0
        public async Task <Showing> Edit(Showing showing)
        {
            if (showing == null)
            {
                return(null);
            }
            _ctx.Showings.Update(showing);
            await _ctx.SaveChangesAsync();

            return(showing);
        }
Exemplo n.º 16
0
        public IActionResult PostShowing([FromBody] Showing showing)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _unitOfWork.Showings.Create(showing);

            return(CreatedAtAction("GetShowing", new { id = showing.Id }, showing));
        }
        public ActionResult SelectShowing(String theaterID, String userName, String movieName)
        {
            TicketOrderViewModel ticketOrderViewModel = new TicketOrderViewModel();

            ticketOrderViewModel.userName  = userName;
            ticketOrderViewModel.showings  = Showing.GetFutureShowings(movieName, theaterID);
            ticketOrderViewModel.theater   = Theater.GetTheater(theaterID);
            ticketOrderViewModel.movieName = movieName;
            ticketOrderViewModel.theaterID = theaterID;
            return(View("~/Views/TicketOrder/SelectShowing.cshtml", ticketOrderViewModel));
        }
Exemplo n.º 18
0
        public async Task <IActionResult> UpdateAsync([FromBody] ShowingDTO showingDTO)
        {
            if (showingDTO != null)
            {
                Showing showing = _mapper.Map <Showing>(showingDTO);
                var     data    = await _unitOfWork.Showings.UpdateAsync(showing);

                return(Ok(data));
            }

            return(BadRequest("Sorry.. The movie was not updated"));
        }
Exemplo n.º 19
0
        public SelectList GetAllMovies(Showing Showing)
        {
            List <Movie> allmovies = db.Movies.OrderBy(d => d.Title).ToList();


            // List<Int32> SelectedMovies = new List<Int32>();
            Int32      SelectedMovies = Showing.Movie.MovieID;
            SelectList selmovies      = new SelectList(allmovies, "MovieID", "Title", SelectedMovies);


            return(selmovies);
        }
Exemplo n.º 20
0
 public ActionResult Edit([Bind(Include = "ShowingID,MovieID,ScreenID,DateAndTime,Price")] Showing showing)
 {
     if (ModelState.IsValid)
     {
         db.Entry(showing).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MovieID  = new SelectList(db.Movies, "MovieID", "Title", showing.MovieID);
     ViewBag.ScreenID = new SelectList(db.Screens, "ScreenID", "ScreenID", showing.ScreenID);
     return(View(showing));
 }
        public ActionResult OrderDetails(String username, String orderID)
        {
            TicketOrderAccountUserViewModel ticketOrderAccountUserViewModel =
                new TicketOrderAccountUserViewModel();

            ticketOrderAccountUserViewModel.username = username;
            ticketOrderAccountUserViewModel.order    = TicketOrder.Get(orderID);
            ticketOrderAccountUserViewModel.showing  = Showing.GetShowing(ticketOrderAccountUserViewModel.order.ShowingID);
            ticketOrderAccountUserViewModel.theater  = Theater.GetTheater(ticketOrderAccountUserViewModel.showing.TheaterID);
            ticketOrderAccountUserViewModel.movie    = Movie.Get(ticketOrderAccountUserViewModel.showing.MovieName);
            return(View("~/Views/MyAccount/OrderDetails.cshtml", ticketOrderAccountUserViewModel));
        }
Exemplo n.º 22
0
        private int Update(Showing item, IDbConnection db)
        {
            int    id        = item.Id;
            int    movieId   = item.MovieId.Id;
            int    theatreId = item.TheatreId.Id;
            string sql       = $"UPDATE Showing SET MovieId = {movieId}, TheatreId = {theatreId}, " +
                               $"ShowingDateTime = '{item.ShowingDateTime}' " +
                               $"WHERE Id = {id};";
            var affectedRows = db.Execute(sql);

            return(affectedRows);
        }
Exemplo n.º 23
0
        public ActionResult Redirect(int f, int s)
        {
            CinemaViewModel model   = (CinemaViewModel)TempData["model"];
            Film            film    = iFilmRepository.GetFilms().First(fl => fl.FilmID == f);
            Showing         showing = iShowingRepository.GetShowings().First(sh => sh.ShowingID == s);

            model.SelectedFilm    = film;
            model.SelectedShowing = showing;

            TempData["model"] = model;
            return(RedirectToAction("RateOverview", "Rate"));
        }
Exemplo n.º 24
0
        static void Main(string[] args)
        {
            StandardedMessages.startMessage();                                             //StandardedMessage Class

            IDictionary <string, string> person = Capturing.CaptureData();                 //Capturing Class capturing person data

            IDictionary <string, string> validatePerson = Validating.validateData(person); //Validating class

            Person selectedPerson = Information.fillingInformation(validatePerson);        //Information class

            Showing.showingData(selectedPerson);
        }
        public SelectList GetAllMovies(Showing showing)
        {
            List <Movie> allMovies = db.Movies.OrderBy(m => m.Title).ToList();

            List <Int32> SelectedMovies = new List <Int32>();

            SelectedMovies.Add(showing.Movie.MovieID);

            SelectList selMovies = new SelectList(allMovies, "MovieID", "Title", SelectedMovies);

            return(selMovies);
        }
Exemplo n.º 26
0
 public bool UpdateShowing(Showing oldShowing, Showing newShowing)
 {
     try
     {
         _showingsCollection.ReplaceOne(showing => showing.Id.Equals(oldShowing.Id), newShowing);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 27
0
        public IEnumerable <Showing> GetUpcomingMovieShowings(int movieId)
        {
            var returnList = new List <Showing>();

            foreach (var showing in _showings)
            {
                Showing newShowing = showing.MakeCopy();
                newShowing.MovieId = movieId;
                returnList.Add(newShowing);
            }
            return(returnList.OrderBy(s => s.StartTime));
        }
Exemplo n.º 28
0
        public ActionResult Create([Bind(Include = "ID,MovieID,Time,Is2D,IsSubtitles")] Showing showing)
        {
            ViewBag.MovieID = new SelectList(db.Repo <Movie>().GetList(),
                                             "ID", "Title", showing.MovieID);

            if (ModelState.IsValid)
            {
                showing.Movie = db.Repo <Movie>().Get(showing.MovieID);

                var startTime   = default(DateTime).AddHours(8);
                var endTime     = default(DateTime).AddHours(23);
                var showingTime = default(DateTime).Add(showing.Time.TimeOfDay);


                var movieEndtime = default(DateTime).Add(showingTime.TimeOfDay).
                                   AddMinutes(showing.Movie.Runtime + showing.AfterShowingCleaningTime);

                if (showingTime < startTime)
                {
                    ModelState.AddModelError("", "Seans za wcześnie");
                    return(View(showing));
                }

                if (movieEndtime > endTime)
                {
                    ModelState.AddModelError("", string.Format("Seans konczy sie za późno (o {0})", movieEndtime.ToString("HH:mm")));
                    return(View(showing));
                }

                var showingsInDay = (db.Repo <Showing>() as IShowingsRepo).GetShowingsForDay(showing.Time);
                var overlapping   = showingsInDay
                                    .Where(s =>
                                           (s.Time >= showing.Time && s.Time <= showing.EndTime) ||
                                           (s.EndTime >= showing.Time && s.EndTime <= showing.EndTime))
                                    .ToList();

                if (overlapping.Count != 0)
                {
                    foreach (var overlap in overlapping)
                    {
                        ModelState.AddModelError("", string.Format("Seans {0}-{1} koliduje z tym seansem", overlap.Time.ToString("HH:mm"), overlap.EndTime.ToString("HH:mm")));
                    }

                    return(View(showing));
                }

                db.Repo <Showing>().Add(showing);
                db.Save();
                return(RedirectToAction("Index"));
            }

            return(View(showing));
        }
Exemplo n.º 29
0
        public async Task <ActionResult> SeatBooking(int phoneNumber, int showId, string reservedSeats)
        {
            //BookingLogic bLogic = new BookingLogic();


            // Transaction

            //bool wasUpdated = await sLogic.UpdateShowingBookings(showId, reservedSeats, phoneNumber);

            //Booking aBooking = new Booking(phoneNumber, showId, 100.0m, reservedSeats);

            ShowingLogic sLogic = new ShowingLogic();

            try
            {
                //
                //bool wasOk = await _bookingLogic.SaveBooking(aBooking);


                int insertedId = -1;
                //decimal price = 100.0m;
                //string seatsBooked = "Row: 666, Seat 1";



                insertedId = await _bookingLogic.CreateBooking(phoneNumber, showId, 100.0m, reservedSeats);

                Showing foundShowing = await sLogic.GetShowingById(showId, true);

                return(View("SeatBooking", foundShowing));
            }
            catch
            {
                /*
                 * if (wasUpdated)
                 * {
                 *
                 *  ViewBag.PrevResult = "Seats was reserved!";
                 * }
                 * else
                 * {
                 *  ViewBag.PrevResult = "Sorry - not reserved - something went wrong";
                 * }
                 */


                // Transaction End
                Showing foundShowing = await sLogic.GetShowingById(1, true);

                return(View("SeatBooking", foundShowing));
            }
        }
Exemplo n.º 30
0
        public virtual void Show()
        {
            if (Visible)
            {
                return;
            }

            gameObject.SetActive(true);
            OnShown();

            Showing?.Invoke();
            AnyViewShowing?.Invoke(this);
        }
        private void btn_load_Click(object sender, EventArgs e)
        {
            setButtons(false);
            String filePath = tb_path.Text;
            file = filePath;
            String extention = Path.GetExtension(filePath);
            List<Mesh> renderableMeshes = new List<Mesh>();
            drawString = "File: " + file;

            updateBitmap(drawString);

            //Try and find the model file
            if (extention == ".mmh")
            {
                GFF tempGFF = new GFF(filePath);
                ModelHierarchy mh = new ModelHierarchy(tempGFF);
                currentlyShowing = Showing.Model;
                meshes = mh.mesh.toModel().meshes;
                setButtons(true);
                if (meshes.Length > 0)
                {
                    setMeshNum(0);
                }
            }
            else if (extention == ".msh")
            {
                GFF tempGFF = new GFF(filePath);
                ModelMesh mm = new ModelMesh(tempGFF);
                currentlyShowing = Showing.Model;
                meshes = mm.toModel().meshes;
                setButtons(true);
                if (meshes.Length > 0)
                {
                    setMeshNum(0);
                }
            }
            else if (extention == ".tga")
            {
                texture = new Targa(filePath);
                currentlyShowing = Showing.Texture;
            }
            else if (extention == ".lvl")
            {
                level = new LevelScene(filePath);
                currentlyShowing = Showing.Level;
                List<Patch> patchList = new List<Patch>();
                List<Triangle> tris = new List<Triangle>();
                foreach (ModelInstance m in level.lightmapModels)
                {
                    for (int i = 0; i < m.meshes.Length; i++)
                    {
                        if (m.meshes[i].isLightmapped)
                        {
                            //Make the lightmap
                            LightMap temp = new LightMap(m, m.meshes[i]);
                            //For each patch instance in the lightmap
                            foreach (Patch p in temp.patches)
                            {
                                patchList.Add(p);
                            }
                        }
                    }
                    if (m.baseModel.castsShadows)
                        tris.AddRange(m.tris);
                }
                octree = new Octree(tris);
                patches = patchList.ToArray();
            }
            else if (extention == ".xml")
            {
                level = new XMLScene(filePath);
                currentlyShowing = Showing.Level;
                List<Patch> patchList = new List<Patch>();
                List<Triangle> tris = new List<Triangle>();
                foreach (ModelInstance m in level.lightmapModels)
                {
                    for (int i = 0; i < m.meshes.Length; i++)
                    {
                        if (m.meshes[i].isLightmapped)
                        {
                            //Make the lightmap
                            LightMap temp = new LightMap(m, m.meshes[i]);
                            //For each patch instance in the lightmap
                            foreach (Patch p in temp.patches)
                            {
                                patchList.Add(p);
                            }
                        }
                    }
                    if (m.baseModel.castsShadows)
                        tris.AddRange(m.tris);
                }
                octree = new Octree(tris);
                patches = patchList.ToArray();
            }
            //If its not the right type of file then print an error
            else
            {
                drawString = "This is not a valid model (.mmh or .msh), texture (.tga), level (.lvl), or scene (.xml) file!";
            }
            refreshView();
        }
 private void btn_show3D_Click(object sender, EventArgs e)
 {
     currentlyShowing = Showing.Model;
     refreshView();
 }
 private void btn_showLightmap_Click(object sender, EventArgs e)
 {
     currentlyShowing = Showing.Lightmap;
     refreshView();
 }