예제 #1
0
        /// <summary>
        /// The btn refresh_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            var m = new Cinema(int.Parse(this.cmbCinema.SelectedItem.ToString().Split('|').Last().Trim())).GetMovies(this.dtpDay.Value);
            var serializer = new XmlSerializer(typeof(List<Movie>));
            var stream = new FileStream(Directory.GetCurrentDirectory() + "\\data\\" + this.cmbCinema.SelectedItem.ToString().Split('|').Last().Trim() + ".xml", FileMode.Truncate);
            serializer.Serialize(stream, m);
            stream.Close();

            this.GenerateChart();
        }
예제 #2
0
        public void Load(Cinema.CinemaArgument[] arguments, Dictionary<string, HashSet<object>> valuerange)
        {
            this.arguments = arguments;

            // Create selection array and populate it with the default values
            selection = new Selection(arguments.Length, valuerange.Count, images);
            for(int i = 0; i < arguments.Length; ++i)
            {
                if(arguments[i].defaultValue != null)
                    selection[i].Add(Array.IndexOf(arguments[i].values, arguments[i].defaultValue));
            }

            // Load shader
            sdrColored = new GLShader(new string[] {ARGUMENT_INDEX_SHADER.VS}, new string[] {ARGUMENT_INDEX_SHADER.FS});
            sdrColored_colorParam = sdrColored.GetUniformLocation("Color");
            sdrColored.Bind();

            meshSelection = new GLMesh(new Vector3[] {new Vector3(0.0f, -0.1f, 0.0f), new Vector3(0.0f, 1.15f, 0.0f)}, null, null, null, null, null, PrimitiveType.Lines);

            // Create track bars for each argument
            foreach(Cinema.CinemaArgument argument in arguments)
            {
                TrackBar newtrackbar = new TrackBar(argument.values.Length, meshSelection);
                newtrackbar.label = argument.label;
                trackbars.Add(newtrackbar);
            }

            // Create track bars for meta data value
            foreach(KeyValuePair<string, HashSet<object>> range in valuerange)
            {
                TrackBar newtrackbar = new TrackBar(range.Value.Count, meshSelection);
                newtrackbar.label = range.Key;
                trackbars.Add(newtrackbar);
            }

            argumentLabelBounds = new Rectangle[arguments.Length];
        }
 private void MainMoviesWindow_FormClosing(object sender, FormClosingEventArgs e)
 {
     Cinema.SerializeJSON();
 }
예제 #4
0
        public List <Cinema> GetCinemabycity(string city)
        {
            List <Cinema> cin = new List <Cinema>();

            string y = "";

            try
            {
                String         uri = "http://107.170.65.250:8080/Hello1/webresources/cinema/city/" + city;
                HttpWebRequest req = WebRequest.Create(uri) as HttpWebRequest;
                req.KeepAlive = false;
                req.Method    = "GET";//Method.ToUpper();
                HttpWebResponse resp             = req.GetResponse() as HttpWebResponse;
                Encoding        enc              = System.Text.Encoding.GetEncoding(1252);
                StreamReader    loResponseStream =
                    new StreamReader(resp.GetResponseStream(), enc);

                //   string Response = loResponseStream.ReadToEnd();
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(resp.GetResponseStream());
                // return (xmlDoc);

                loResponseStream.Close();
                resp.Close();
                TreeNode root = new TreeNode(xmlDoc.DocumentElement.Name);


                foreach (XmlNode node in xmlDoc.DocumentElement.ChildNodes) // for each <testcase> node
                {
                    if (node.HasChildNodes)
                    {
                        //Movie m = new Movie();
                        Cinema c = new Cinema();
                        foreach (XmlNode n in node.ChildNodes)
                        {
                            try
                            {
                                string i = n.InnerText + "";
                                //  y += i;
                                switch (n.Name)
                                {
                                case "cin_id":
                                    c.setCin_id(Int32.Parse(i));
                                    break;

                                case "name":

                                    c.setName(i);
                                    //y += m.getName();
                                    break;

                                case "city":
                                    c.setCity(i);
                                    //y += m.getRelease_date();
                                    break;
                                }
                            }
                            catch (Exception exq)
                            {
                                y += (exq.Message.ToString());
                            }
                        }
                        //y += m.ToString();
                        //y += "\n\n";
                        //ml.Add(m);
                        cin.Add(c);
                    }
                }
            }
            catch (Exception ex)
            {
                y += (ex.Message.ToString());
            }
            return(cin);
        }
예제 #5
0
        static void Main(string[] args)
        {
            bool   quit = false;
            Cinema currentCinema;
            bool   chooseNewTheater = false;

            // Franchises
            Franchise megaPlex = new Franchise("Megaplex");

            // Cinemas
            Cinema edwards14 = new Cinema("Edwards 14", "123 fake str", 14);
            Cinema majestic  = new Cinema("The Majestic", "456 Not Real Rd.", 12);

            // Movies
            Movie starWarsVIII = new Movie()
            {
                Title = "Star Wars"
            };
            Movie jumanji = new Movie()
            {
                Title = "Jumanji 2"
            };
            Movie monstersInc = new Movie()
            {
                Title = "Monster's Inc"
            };
            Movie indianaJones = new Movie()
            {
                Title = "Indiana Jones and the Temple of Doom"
            };

            // Console.WriteLine("Edwards14.name = " + edwards14.Name);

            // Populate Franchise with Cinemas
            megaPlex.AddCinema(edwards14);
            megaPlex.AddCinema(majestic);

            // edwards14 movies and showtimes
            edwards14.Movies.Add(starWarsVIII);
            edwards14.Movies.Add(jumanji);

            edwards14.AddShowTime(edwards14.Theaters[0], starWarsVIII, "1000");
            edwards14.AddShowTime(edwards14.Theaters[1], starWarsVIII, "1100");
            edwards14.AddShowTime(edwards14.Theaters[2], starWarsVIII, "1200");
            edwards14.AddShowTime(edwards14.Theaters[0], starWarsVIII, "1300");
            edwards14.AddShowTime(edwards14.Theaters[1], starWarsVIII, "1400");
            edwards14.AddShowTime(edwards14.Theaters[2], starWarsVIII, "1500");

            edwards14.AddShowTime(edwards14.Theaters[3], jumanji, "1000");
            edwards14.AddShowTime(edwards14.Theaters[4], jumanji, "1100");
            edwards14.AddShowTime(edwards14.Theaters[5], jumanji, "1200");
            edwards14.AddShowTime(edwards14.Theaters[3], jumanji, "1300");
            edwards14.AddShowTime(edwards14.Theaters[4], jumanji, "1400");
            edwards14.AddShowTime(edwards14.Theaters[5], jumanji, "1500");

            // majestic movies and showtimes
            majestic.Movies.Add(starWarsVIII);
            majestic.Movies.Add(monstersInc);
            majestic.Movies.Add(indianaJones);

            majestic.AddShowTime(majestic.Theaters[0], starWarsVIII, "1000");
            majestic.AddShowTime(majestic.Theaters[1], starWarsVIII, "1100");
            majestic.AddShowTime(majestic.Theaters[2], starWarsVIII, "1200");
            majestic.AddShowTime(majestic.Theaters[0], starWarsVIII, "1300");
            majestic.AddShowTime(majestic.Theaters[1], starWarsVIII, "1400");
            majestic.AddShowTime(majestic.Theaters[2], starWarsVIII, "1500");

            majestic.AddShowTime(majestic.Theaters[3], monstersInc, "1000");
            majestic.AddShowTime(majestic.Theaters[4], monstersInc, "1100");
            majestic.AddShowTime(majestic.Theaters[5], monstersInc, "1200");
            majestic.AddShowTime(majestic.Theaters[3], monstersInc, "1300");
            majestic.AddShowTime(majestic.Theaters[4], monstersInc, "1400");
            majestic.AddShowTime(majestic.Theaters[5], monstersInc, "1500");

            majestic.AddShowTime(majestic.Theaters[6], indianaJones, "1000");
            majestic.AddShowTime(majestic.Theaters[7], indianaJones, "1100");
            majestic.AddShowTime(majestic.Theaters[8], indianaJones, "1200");
            majestic.AddShowTime(majestic.Theaters[6], indianaJones, "1300");
            majestic.AddShowTime(majestic.Theaters[7], indianaJones, "1400");
            majestic.AddShowTime(majestic.Theaters[8], indianaJones, "1500");

            // Assign default theater
            currentCinema = edwards14;

            while (!quit)
            {
                if (!chooseNewTheater)
                {
                    currentCinema = megaPlex.DisplayCinemas();
                    quit          = currentCinema.DisplayMovies();
                }
                else
                {
                    quit = currentCinema.DisplayMovies();
                }
            }



            // movieSelection = edwards14.DisplayMovies();
            // edwards14.DisplayShowtimes(movieSelection);

            //expand to multi-theater allowing you to check movies per theater, and then change theaters to see other showtimes and then an option to quit.



            // edwards14.Name = "paul";

            // Console.WriteLine("is it paul? Edwards14.name = " + edwards14.Name);
            // edwards14.Name = "Majestic";

            // Console.WriteLine("is it Majestic? Edwards14.name = " + edwards14.Name);

            /**
             * Models
             *  cinema
             *      - constructor
             *      - Get Movies
             *          - Movie see showtimes
             *              - GetShowtimes(movie)??? each theater show times flag if availble
             *                  - purchase ticket
             *
             *
             *  theater
             *  movie
             *  ticket - showtime
             *  concession
             */
        }
        static void Main(string[] args)
        {
            #region singleton
            var conexao1 = Conexao.GetInstance();
            var conexao2 = Conexao.GetInstance();

            Console.WriteLine(conexao1.Equals(conexao2) ? "Conexões iguais" : "Conexões diferentes");
            #endregion

            #region polimorfismo com interface
            var matrix     = new Matrix();
            var crepusculo = new Crepusculo();

            var cinema = new Cinema();
            cinema.EntrarNoCinema(matrix);
            cinema.EntrarNoCinema(crepusculo);
            #endregion

            #region Factory method

            #region exemplo com enum

            //exemplo do factory com mau uso de enum,
            //pois a cada moto nova será incrementado o enum, ferindo o princípio de aberto/fechado

            var fabricaMoto = new FabricaMoto();
            var cg          = fabricaMoto.FabricarMoto(EMotos.CG150);
            var f800        = fabricaMoto.FabricarMoto(EMotos.F800);

            Console.WriteLine(cg.ExibirModelo());
            Console.WriteLine(f800.ExibirModelo());

            #endregion

            #region exemplo sem uso de enum

            Fabrica[] fabricas = new Fabrica[4];
            fabricas[0] = new FabricaCG150();
            fabricas[1] = new FabricaF800();
            fabricas[2] = new FabricaNinja250R();
            fabricas[3] = new FabricaYBR();

            foreach (var fabricador in fabricas)
            {
                var moto = fabricador.FabricarMoto();
                Console.WriteLine("Criado {0}", moto.ExibirModelo());
            }

            #endregion

            #endregion

            #region Facade
            var game = new SistemasFacade();
            game.InicializarSubSistemas();
            game.ReproduzirAudio("AC/DC-Back_in_Black.mp3");

            var venda = new VendaFacade();
            venda.FecharPedido();
            #endregion

            #region Proxy
            IImagem imagem = new ImagemProxy("c:/teste.png");
            imagem.MostrarImagem();

            var Car = new ProxyCar(new Driver(26));
            Car.DriveCar();

            var motorista = new MotoristaProxy(18);
            motorista.Dirigir();
            #endregion

            #region State
            try
            {
                IOrdemServicoState os = new Elaboracao();
                var agendamento       = os.Agendar();
                var execucao          = agendamento.Executar();
                var finalizacao       = execucao.Finalizar();
                finalizacao.Finalizar();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            #endregion

            #region strategy

            var localizacaoEnsaioPM = new EnsaioPlanoManutencaoContext(new LocalizacaoEnsaioPlanoManutencao()).GetEnsaios();
            var equipmentoEnsaioPM  = new EnsaioPlanoManutencaoContext(new EquipamentoEnsaioPlanoManutencao()).GetEnsaios();
            var familiaEnsaioPM     = new EnsaioPlanoManutencaoContext(new FamiliaEnsaioPlanoManutencao()).GetEnsaios();

            new GeradorBoletoContext(new GeradorBoletoBB()).Gerar();
            new GeradorBoletoContext(new GeradorBoletoBradesco()).Gerar();
            new GeradorBoletoContext(new GeradorBoletoItau()).Gerar();
            new GeradorBoletoContext(new GeradorBoletoCaixa()).Gerar();

            #endregion
        }
예제 #7
0
        static void Main(string[] args)
        {
            Cinema cinema1 = new Cinema(" ");
            Cinema cinema2 = new Cinema(" ");

            try
            {
                #region allMovies
                Movie        movie1    = new Movie("Scary Movie", Genre.Comedy, 4, 2.5);
                Movie        movie2    = new Movie("American Pie", Genre.Comedy, 4, 2.5);
                Movie        movie3    = new Movie("Saw", Genre.Horror, 4, 2.5);
                Movie        movie4    = new Movie("The Shining", Genre.Horror, 4, 2.5);
                Movie        movie5    = new Movie("Rambo", Genre.Action, 4, 2.5);
                Movie        movie6    = new Movie("The Terminator", Genre.Action, 4, 2.5);
                Movie        movie7    = new Movie("Forrest Gump", Genre.Drama, 4, 2.5);
                Movie        movie8    = new Movie("12 Angru Men", Genre.Drama, 4, 2.5);
                Movie        movie9    = new Movie("Passengers", Genre.SciFi, 4, 2.5);
                Movie        movie10   = new Movie("Interstellar", Genre.SciFi, 4, 2.5);
                List <Movie> MovieSet1 = new List <Movie>()
                {
                    movie1, movie2, movie3, movie4, movie5, movie6, movie7, movie8, movie9, movie10
                };
                Movie        movie11   = new Movie("Airplane", Genre.Comedy, 4, 2.5);
                Movie        movie12   = new Movie("Johnny English", Genre.Comedy, 4, 2.5);
                Movie        movie13   = new Movie("The Ring", Genre.Horror, 4, 2.5);
                Movie        movie14   = new Movie("Sinister", Genre.Horror, 4, 2.5);
                Movie        movie15   = new Movie("RoboCop", Genre.Action, 4, 2.5);
                Movie        movie16   = new Movie("Judge Dredd", Genre.Action, 4, 2.5);
                Movie        movie17   = new Movie("The Social Network", Genre.Drama, 4, 2.5);
                Movie        movie18   = new Movie("The Shawshank Redemption", Genre.Drama, 4, 2.5);
                Movie        movie19   = new Movie("Inception", Genre.SciFi, 4, 2.5);
                Movie        movie20   = new Movie("Avatar", Genre.SciFi, 4, 2.5);
                List <Movie> MovieSet2 = new List <Movie>()
                {
                    movie11, movie12, movie13, movie14, movie15, movie16, movie17, movie18, movie19, movie20
                };
                #endregion

                cinema1       = new Cinema("Cineplex");
                cinema1.Halls = new List <int>()
                {
                    1, 2, 3, 4
                };
                cinema1.ListOfMovies = MovieSet1;
                cinema2       = new Cinema("Milenium");
                cinema2.Halls = new List <int>()
                {
                    1, 2
                };
                cinema2.ListOfMovies = MovieSet2;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            try
            {
                int titleNum = 0;
                int cinema   = ChooseCinema();
                Console.Clear();
                int allOrGenre = ChooseAllOrByGenre();
                Console.Clear();
                //show the user all movies
                if (allOrGenre == 1)
                {
                    //if the user choose Cineplex
                    if (cinema == 1)
                    {
                        // titleNum is number of movie the user choose to watch
                        titleNum = AllMovie(cinema1.ListOfMovies);
                        Console.Clear();
                        cinema1.MoviePlaying(cinema1.ListOfMovies[titleNum - 1]);
                    }

                    //if the user choose Milenium
                    else
                    {
                        titleNum = AllMovie(cinema2.ListOfMovies);
                        Console.Clear();
                        cinema2.MoviePlaying(cinema2.ListOfMovies[titleNum - 1]);
                    }
                }
                //show movie by genre to the user
                else
                {
                    //if the user choose Cineplex
                    if (cinema == 1)
                    {
                        //in genre is the number of genre the user choose
                        int genre = ChooseGenre();
                        //in move is a Movie the user choose to watch after showing to him list of movies of genre he choose
                        Movie movie = movieA(MovieGenre(genre, cinema1.ListOfMovies));
                        Console.Clear();
                        cinema1.MoviePlaying(movie);
                    }
                    //if the user choose Milenium
                    else
                    {
                        int   genre = ChooseGenre();
                        Movie movie = movieA(MovieGenre(genre, cinema2.ListOfMovies));
                        Console.Clear();
                        cinema2.MoviePlaying(movie);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.ReadLine();
        }
        public void ReturnsTwoShowing_GivenSingleDateWithTwoTimes()
        {
            var sut = new sut.ShowingBuilder();

            var film = new Film
            {
                Slug = "new-film"
            };
            var cinema = new Cinema
            {
                Number = "123"
            };

            var sourceShowing = new Showing
            {
                At   = cinema,
                What = film
            };

            var parentDoc    = new HtmlDocument();
            var titleElement = new HtmlNode(HtmlNodeType.Text, parentDoc, 0);

            titleElement.InnerHtml = @"<h1 class=""h2 filmPageTitle"">Ghost Stories</h1>";
            var parentFilmSession = new HtmlNode(HtmlNodeType.Element, parentDoc, 1);

            parentFilmSession.Name = "div";
            parentFilmSession.AddClass("filmSessions");
            parentFilmSession.SetAttributeValue("data-filmpage-sessions", "data-filmpage-sessions");

            parentFilmSession.InnerHtml = @"<div class=""filmItemDate"" data-dateformat=""2018-04-07"">Saturday 7 April 2018</div>";
            var unused = new HtmlNode(HtmlNodeType.Element, parentDoc, 2);

            unused.Name      = "ul";
            unused.InnerHtml = @"<ul class=""filmExp dn""></ul>";
            parentFilmSession.AppendChild(unused);

            var sessionList = new HtmlNode(HtmlNodeType.Element, parentDoc, 3);

            sessionList.Name = "ul";
            sessionList.AddClass("filmTimes");
            sessionList.AddClass("filmInfo");

            var session1 = new HtmlNode(HtmlNodeType.Element, parentDoc, 4);

            session1.Name = "li";

            var session1Film = new HtmlNode(HtmlNodeType.Element, parentDoc, 5);

            session1Film.Name      = "a";
            session1Film.InnerHtml = "6:15 PM";
            session1Film.Attributes.Add("href", "/booking/240/6184758");
            session1Film.Attributes.Add("data-filmpage-exp", "");
            session1Film.AddClass("filmTimeItem");

            session1.AppendChild(session1Film);
            sessionList.AppendChild(session1);

            var session2 = new HtmlNode(HtmlNodeType.Element, parentDoc, 4);

            session2.Name = "li";

            var session2Film = new HtmlNode(HtmlNodeType.Element, parentDoc, 5);

            session2Film.Name      = "a";
            session2Film.InnerHtml = "9:15 AM";
            session2Film.Attributes.Add("href", "/booking/240/6184758");
            session2Film.Attributes.Add("data-filmpage-exp", "");
            session2Film.AddClass("filmTimeItem");

            session2.AppendChild(session2Film);
            sessionList.AppendChild(session2);

            parentFilmSession.AppendChild(sessionList);

            var result = sut.FromScheduleDivs(sourceShowing, new List <HtmlNode> {
                parentFilmSession
            });

            Assert.Equal(2, result.Count());
        }
예제 #9
0
 public void Add(Cinema cinema)
 {
     repository.Add(cinema);
     repository.Save();
 }
        private void InitializeFields()
        {
            this.firstTicket = new Ticket
            {
                Row        = 1,
                Seat       = 1,
                Price      = 10,
                TimeSlot   = TimeSlot.Afternoon,
                TicketType = TicketType.Regular,
                Quantity   = 1,
            };

            this.firstDirector = new Director
            {
                FirstName = "Peter",
                LastName  = "Kirilov",
            };

            this.firstMovie = new Movie
            {
                Name           = "Titanic",
                DateOfRelease  = DateTime.UtcNow,
                Resolution     = "HD",
                Rating         = 7.80m,
                Description    = "Test description here",
                Language       = "English",
                CinemaCategory = CinemaCategory.B,
                TrailerPath    = "test trailer path",
                CoverPath      = "test cover path",
                WallpaperPath  = "test wallpaper path",
                IMDBLink       = "test imdb link",
                Length         = 120,
                DirectorId     = 1,
            };

            this.firstHall = new Hall
            {
                Category = HallCategory.Small,
                Capacity = 20,
            };

            this.firstCinema = new Cinema
            {
                Name    = "Bulgaria Mall",
                Address = "Sofia bul.Stamboliiski",
            };

            this.firstMovieProjection = new MovieProjection
            {
                Date     = DateTime.ParseExact("30/09/2020 14:30:00", "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture),
                MovieId  = 1,
                HallId   = 1,
                CinemaId = 1,
            };

            this.firstSeat = new Seat
            {
                Number      = 1,
                RowNumber   = 1,
                HallId      = 1,
                Category    = SeatCategory.Normal,
                IsAvailable = true,
                IsSold      = false,
            };
        }
 /// <summary>
 /// Create a new cinema output model based on a specific cinema
 /// </summary>
 /// <param name="cinema"></param>
 public CinemaOutputModel(Cinema cinema)
 {
     this.cinema = cinema;
 }
예제 #12
0
 public TrackBar(Cinema.CinemaArgument argument, int argidx, GLMesh meshBorders, GLMesh meshTick, GLMesh meshSelection)
 {
     this.argument = argument;
     this.argidx = argidx;
     this.meshBorders = meshBorders;
     this.meshTick = meshTick;
     this.meshSelection = meshSelection;
 }
 /// <summary>
 /// Don't use this, please, this is only to create the preview of the response
 /// </summary>
 public CinemaOutputModel()
 {
     cinema = new Cinema();
 }
예제 #14
0
 public void TUpdate(Cinema t)
 {
     _cinemaDal.Update(t);
 }
예제 #15
0
 public void TDelete(Cinema t)
 {
     _cinemaDal.Delete(t);
 }
예제 #16
0
 public void TAdd(Cinema t)
 {
     _cinemaDal.Add(t);
 }
 protected override void ExecuteInsertVenueCommand(string[] commandWords)
 {
     switch (commandWords[2])
     {
         case "cinema":
             var cinema = new Cinema(commandWords[3], commandWords[4], int.Parse(commandWords[5]));
             this.Venues.Add(cinema);
             break;
         case "opera":
             var opera = new OperaHall(commandWords[3], commandWords[4], int.Parse(commandWords[5]));
             this.Venues.Add(opera);
             break;
         case "sports_hall":
             var sportsHall = new SportsHall(commandWords[3], commandWords[4], int.Parse(commandWords[5]));
             this.Venues.Add(sportsHall);
             break;
         case "concert_hall":
             var concertHall = new ConcertHall(commandWords[3], commandWords[4], int.Parse(commandWords[5]));
             this.Venues.Add(concertHall);
             break;
         default:
             break;
     }
 }
예제 #18
0
 /// <summary>
 /// Initializing ScreeningWindow
 /// </summary>
 /// <param name="cinema"></param>
 public ScreeningWindow(Cinema cinema)
 {
     InitializeComponent();
     this.cinema = cinema;
     Init();
 }
예제 #19
0
 public void Insert(Cinema entity)
 {
     Context.Cinemas.Add(entity);
 }
예제 #20
0
 public void Update(Cinema cinema)
 {
     repository.Update(cinema);
     repository.Save();
 }
예제 #21
0
        public void Delete(Cinema entity)
        {
            Cinema cinema = Context.Cinemas.First(x => x.Id == entity.Id);

            Context.Cinemas.Remove(cinema);
        }
예제 #22
0
 public static Show Create(Guid id, Cinema cinema, Movie movie, DateTime date, Dictionary <Ticket, decimal> priceList)
 {
     return(new Show(id, cinema, movie, date, priceList));
 }
예제 #23
0
 public void AddStore(Cinema store)
 {
     _storeDataAccess.AddStore(store);
 }
예제 #24
0
        public ActionResult DeleteConfirmed(int id)
        {
            Cinema cinema = db.Cinemas.Find(id);

            if (cinema.Salles.Count > 0)
            {
                List <Salle> salles   = db.Salles.Where(t => t.CinemaID == id).ToList();
                List <int>   sallesId = new List <int>();
                foreach (Salle salle in salles)
                {
                    if (salle.Seances.Count > 0)
                    {
                        sallesId.Add(salle.SalleID);
                    }
                }

                if (sallesId.Count > 0)
                {
                    List <Seance> seances   = new List <Seance>();
                    List <int>    seancesId = new List <int>();
                    foreach (int i in sallesId)
                    {
                        seances = db.Seances.Where(t => t.SalleID == i).ToList();

                        foreach (Seance seance in seances)
                        {
                            if (seance.SeanceContenus.Count > 0)
                            {
                                seancesId.Add(seance.SeanceID);
                            }
                            if (seance.SeancePromoes.Count > 0)
                            {
                                seancesId.Add(seance.SeanceID);
                            }
                        }

                        if (seancesId.Count > 0)
                        {
                            List <SeanceContenu> seancesContenu = new List <SeanceContenu>();
                            List <SeancePromo>   seancesPromo   = new List <SeancePromo>();
                            foreach (int j in seancesId)
                            {
                                seancesContenu = db.SeanceContenus.Where(t => t.SeanceID == j).ToList();
                                seancesPromo   = db.SeancePromoes.Where(t => t.SeanceID == j).ToList();
                                db.SeanceContenus.RemoveRange(seancesContenu);
                                db.SeancePromoes.RemoveRange(seancesPromo);
                            }
                        }
                        db.Seances.RemoveRange(seances);
                    }
                    db.Salles.RemoveRange(salles);
                    db.Cinemas.Remove(cinema);
                }
                else
                {
                    db.Salles.RemoveRange(salles);
                    db.Cinemas.Remove(cinema);
                }
            }
            else
            {
                db.Cinemas.Remove(cinema);
            }
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #25
0
 public void UpdateStore(Cinema storeToUpdate)
 {
     _storeDataAccess.UpdateStore(storeToUpdate);
 }
        public void ReturnsFourShowingsWithCorrectTimes_GivenTwoDaysWithTwoShowings()
        {
            var sut = new sut.ShowingBuilder();

            var film = new Film
            {
                Slug = "new-film"
            };
            var cinema = new Cinema
            {
                Number = "123"
            };

            var sourceShowing = new Showing
            {
                At   = cinema,
                What = film
            };

            var parentDoc    = new HtmlDocument();
            var titleElement = new HtmlNode(HtmlNodeType.Text, parentDoc, 0);

            titleElement.InnerHtml = @"<h1 class=""h2 filmPageTitle"">Ghost Stories</h1>";
            var day1 = new HtmlNode(HtmlNodeType.Element, parentDoc, 1);

            day1.Name = "div";
            day1.AddClass("filmSessions");
            day1.SetAttributeValue("data-filmpage-sessions", "data-filmpage-sessions");

            day1.InnerHtml = @"<div class=""filmItemDate"" data-dateformat=""2018-04-07"">Saturday 7 April 2018</div>";
            var unused = new HtmlNode(HtmlNodeType.Element, parentDoc, 2);

            unused.Name      = "ul";
            unused.InnerHtml = @"<ul class=""filmExp dn""></ul>";
            day1.AppendChild(unused);

            var sessionList = new HtmlNode(HtmlNodeType.Element, parentDoc, 3);

            sessionList.Name = "ul";
            sessionList.AddClass("filmTimes");
            sessionList.AddClass("filmInfo");

            var session1 = new HtmlNode(HtmlNodeType.Element, parentDoc, 4);

            session1.Name = "li";

            var session1Film = new HtmlNode(HtmlNodeType.Element, parentDoc, 5);

            session1Film.Name      = "a";
            session1Film.InnerHtml = "6:15 PM";
            session1Film.Attributes.Add("href", "/booking/240/6184758");
            session1Film.Attributes.Add("data-filmpage-exp", "");
            session1Film.AddClass("filmTimeItem");

            session1.AppendChild(session1Film);
            sessionList.AppendChild(session1);

            var session2 = new HtmlNode(HtmlNodeType.Element, parentDoc, 4);

            session2.Name = "li";

            var session2Film = new HtmlNode(HtmlNodeType.Element, parentDoc, 5);

            session2Film.Name      = "a";
            session2Film.InnerHtml = "9:15 AM";
            session2Film.Attributes.Add("href", "/booking/240/6184758");
            session2Film.Attributes.Add("data-filmpage-exp", "");
            session2Film.AddClass("filmTimeItem");

            session2.AppendChild(session2Film);
            sessionList.AppendChild(session2);

            day1.AppendChild(sessionList);

            var day2 = new HtmlNode(HtmlNodeType.Element, parentDoc, 1);

            day2.Name = "div";
            day2.AddClass("filmSessions");
            day2.SetAttributeValue("data-filmpage-sessions", "data-filmpage-sessions");

            day2.InnerHtml = @"<div class=""filmItemDate"" data-dateformat=""2018-04-08"">Sunday 8 April 2018</div>";
            day2.AppendChild(unused);

            var day2List = new HtmlNode(HtmlNodeType.Element, parentDoc, 3);

            day2List.Name = "ul";
            day2List.AddClass("filmTimes");
            day2List.AddClass("filmInfo");

            var session3 = new HtmlNode(HtmlNodeType.Element, parentDoc, 4);

            session3.Name = "li";

            var session3Film = new HtmlNode(HtmlNodeType.Element, parentDoc, 5);

            session3Film.Name      = "a";
            session3Film.InnerHtml = "4:25 PM";
            session3Film.Attributes.Add("href", "/booking/240/6184758");
            session3Film.Attributes.Add("data-filmpage-exp", "");
            session3Film.AddClass("filmTimeItem");

            session3.AppendChild(session3Film);
            day2List.AppendChild(session3);

            var session4 = new HtmlNode(HtmlNodeType.Element, parentDoc, 4);

            session4.Name = "li";

            var session4Film = new HtmlNode(HtmlNodeType.Element, parentDoc, 5);

            session4Film.Name      = "a";
            session4Film.InnerHtml = "5:25 AM";
            session4Film.Attributes.Add("href", "/booking/240/6184758");
            session4Film.Attributes.Add("data-filmpage-exp", "");
            session4Film.AddClass("filmTimeItem");

            session4.AppendChild(session4Film);
            day2List.AppendChild(session4);

            day2.AppendChild(day2List);

            var result = sut.FromScheduleDivs(sourceShowing, new List <HtmlNode> {
                day1, day2
            });

            Assert.Contains(result, s => s.When == new DateTime(2018, 4, 8, 5, 25, 00));
            Assert.Contains(result, s => s.When == new DateTime(2018, 4, 8, 16, 25, 00));
            Assert.Contains(result, s => s.When == new DateTime(2018, 4, 7, 9, 15, 00));
            Assert.Contains(result, s => s.When == new DateTime(2018, 4, 7, 18, 15, 00));
        }
예제 #27
0
 public void DeleteStore(Cinema store)
 {
     _storeDataAccess.DeleteStore(store);
 }
예제 #28
0
        public void CreateCinema()
        {
            System.Console.WriteLine("Okay let's create your Cinema");
            System.Console.WriteLine("What is the name of your Cinema?");
            var cinemaName = Console.ReadLine();

            Console.Clear();
            System.Console.WriteLine("What is the address of your Cinema?");
            var cinemaAddress = Console.ReadLine();

            Console.Clear();

            double tp = -1;

            while (tp < 0)
            {
                System.Console.WriteLine("What about the default ticket price?");
                var cinemaTP = Console.ReadLine();
                double.TryParse(cinemaTP, out tp);
            }

            Console.Clear();

            System.Console.WriteLine("Is the following correct?");
            System.Console.WriteLine($@"
      Name: {cinemaName},
      Address: {cinemaAddress},
      Default Ticket Price: ${tp}
      ");
            System.Console.WriteLine("Y/N: ");
            var userInput = Console.ReadLine().ToLower();

            switch (userInput)
            {
            case "y":
                Cinema cinema = new Cinema()
                {
                    Name    = cinemaName,
                    Address = new Address()
                    {
                        StreetAddress = cinemaAddress
                    },
                    DefaultTicketPrice = tp
                };

                if (UserCinemas.ContainsKey(_activeUser))
                {
                    //always at least the second one
                    UserCinemas[_activeUser].Add(cinema);
                }
                else
                {
                    UserCinemas.Add(_activeUser, new List <Cinema>());
                    UserCinemas[_activeUser].Add(cinema);
                }
                Console.WriteLine("Successfully added a new Cinema");
                CinemaManagerMenu();
                break;

            default:
                CreateCinema();
                break;
            }
        }
예제 #29
0
 public SeedData(Cinema cinema)
 {
     Cinema = cinema;
 }
예제 #30
0
 private void FrmPesCidade_Load(object sender, EventArgs e)
 {
     // falar que o datagridview recebe os dados do metodo selecionattodasCidades da classe cinema
     //implementar essa parte
     dgvCidades.DataSource = Cinema.recuperarTodoasCidades();
 }
예제 #31
0
        static void Main(string[] args)
        {
            try
            {
                Movie movie1  = new Movie("Scary Movie", Genre.Comedy, 4);
                Movie movie2  = new Movie("American Pie", Genre.Comedy, 4);
                Movie movie3  = new Movie("Saw", Genre.Horror, 4);
                Movie movie4  = new Movie("The Shining", Genre.Horror, 4);
                Movie movie5  = new Movie("Rambo", Genre.Action, 4);
                Movie movie6  = new Movie("The Terminator", Genre.Action, 4);
                Movie movie7  = new Movie("Forrest Gump", Genre.Drama, 4);
                Movie movie8  = new Movie("12 Angru Men", Genre.Drama, 4);
                Movie movie9  = new Movie("Passengers", Genre.SciFi, 4);
                Movie movie10 = new Movie("Interstellar", Genre.SciFi, 4);
                Movie movie11 = new Movie("Airplane", Genre.Comedy, 4);
                Movie movie12 = new Movie("Johnny English", Genre.Comedy, 4);
                Movie movie13 = new Movie("The Ring", Genre.Horror, 4);
                Movie movie14 = new Movie("Sinister", Genre.Horror, 4);
                Movie movie15 = new Movie("RoboCop", Genre.Action, 4);
                Movie movie16 = new Movie("Judge Dredd", Genre.Action, 4);
                Movie movie17 = new Movie("The Social Network", Genre.Drama, 4);
                Movie movie18 = new Movie("The Shawshank Redemption", Genre.Drama, 4);
                Movie movie19 = new Movie("Inception", Genre.SciFi, 4);
                Movie movie20 = new Movie("Avatar", Genre.SciFi, 4);

                Cinema cinema1 = new Cinema(
                    "Kino1",
                    new List <int>()
                {
                    1, 2, 3, 4
                },
                    new List <Movie>()
                {
                    movie1, movie2, movie3, movie4, movie5, movie6, movie7, movie8, movie9, movie10
                });

                Cinema cinema2 = new Cinema(
                    "Kino2",
                    new List <int>()
                {
                    1, 2, 3, 4, 5, 6, 7
                },
                    new List <Movie>()
                {
                    movie11, movie12, movie13, movie14, movie15, movie16, movie17, movie18, movie19, movie20
                });
                Cinema currentCinema = null;

                Console.WriteLine("Please choose cinema");
                Console.WriteLine($"1. {cinema1.Name}");
                Console.WriteLine($"2. {cinema2.Name}");
                int cinema = int.Parse(Console.ReadLine());
                if (cinema == 1)
                {
                    currentCinema = cinema1;
                }
                else if (cinema == 2)
                {
                    currentCinema = cinema2;
                }
                else
                {
                    throw new Exception("You must enter 1 or 2 for cinema");
                }


                Console.WriteLine("Choose movies:");
                Console.WriteLine($"1. All");
                Console.WriteLine($"2. By Genre");
                int movieOption = int.Parse(Console.ReadLine());
                if (movieOption == 1)
                {
                    foreach (Movie movie in currentCinema.ListOfMovies)
                    {
                        Console.WriteLine(movie.Title);
                    }
                    Console.WriteLine("Choose one of the above movies:");
                    string chosenMovie = Console.ReadLine();
                    currentCinema.WatchMovie(currentCinema.ListOfMovies
                                             .FirstOrDefault(x => x.Title.ToLower() == chosenMovie.ToLower()));
                }
                else if (movieOption == 2)
                {
                    Console.WriteLine("Enter genre:");
                    Console.WriteLine("1) Comedy");
                    Console.WriteLine("2) Horror");
                    Console.WriteLine("3) Action");
                    Console.WriteLine("4) Drama");
                    Console.WriteLine("5) SciFi");
                    int   inputGenre = int.Parse(Console.ReadLine());
                    Genre currentGenre;
                    switch (inputGenre)
                    {
                    case 1:
                        currentGenre = Genre.Comedy;
                        break;

                    case 2:
                        currentGenre = Genre.Horror;
                        break;

                    case 3:
                        currentGenre = Genre.Action;
                        break;

                    case 4:
                        currentGenre = Genre.Drama;
                        break;

                    case 5:
                        currentGenre = Genre.SciFi;
                        break;

                    default:
                        throw new Exception("The genre input was not correct! Sorry, you broke it!");
                    }

                    Console.WriteLine("Choose a movie to watch: ( Write the name )");
                    List <Movie> personMoviesByGenre = currentCinema.ListOfMovies.Where(movie => movie.Genre == currentGenre).ToList();
                    foreach (var movie in personMoviesByGenre)
                    {
                        Console.WriteLine(movie.Title);
                    }
                    string inputMovie = Console.ReadLine();
                    // Another way to get first element from list
                    Movie userChosenMovie = personMoviesByGenre.Where(movie => movie.Title.ToLower() == inputMovie.ToLower()).FirstOrDefault();
                    currentCinema.WatchMovie(userChosenMovie);
                }
                else
                {
                    throw new Exception("You must choose valid option for movies");
                }
            }
            catch (FormatException ex)
            {
                Console.WriteLine("Incorrect input");
            }
            catch (NullReferenceException ex)
            {
                Console.WriteLine("Movie does not exist");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }


            Console.ReadLine();
        }
예제 #32
0
        static void Main(string[] args)
        {
            Methods        GenreChoise = new Methods();
            GenerateMovies MoviesLists = new GenerateMovies();
            Cinema         Cineplex    = new Cinema();

            Cineplex.Name  = "Cineplex";
            Cineplex.Halls = new List <int> {
                1, 2, 3, 4
            };
            Cineplex.Movies = MoviesLists.FirstList();
            Cinema Milenium = new Cinema();

            Milenium.Name  = "Milenium";
            Milenium.Halls = new List <int> {
                1, 2
            };
            Milenium.Movies = MoviesLists.SecondList();
            List <Cinema> Cinemas = new List <Cinema>()
            {
                Cineplex, Milenium
            };

            Console.WriteLine("Choose the Cinema.\nYour choise is:\n1.Cineplex\n2.Milenium");
            string chosenCinema = Console.ReadLine();

            try
            {
                if (chosenCinema == "1")
                {
                    Console.WriteLine("Choose your list:\n1.All movies\n2.Sorted by genre.");
                    string allOrGenre = Console.ReadLine();
                    try
                    {
                        if (allOrGenre == "1")
                        {
                            GenreChoise.AllMovies(MoviesLists.FirstList(), Cinemas);
                        }
                        else if (allOrGenre == "2")
                        {
                            try
                            {
                                Console.WriteLine("Your choise is:\n1.Comedy\n2.Horror\n3.Action\n4.Drama\n5.SciFi");
                                string genreChoise = Console.ReadLine();
                                if (genreChoise == "1" || genreChoise == "2" || genreChoise == "3" || genreChoise == "4" || genreChoise == "5")
                                {
                                    GenreChoise.ChoseTheGenre(MoviesLists.FirstList(), genreChoise);
                                }
                                else
                                {
                                    throw new Exception("Please enter number from 1 to 5");
                                }
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e.Message);
                            }
                        }
                        else
                        {
                            throw new Exception("Please choose 1 or 2");
                        }
                    }catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }
                else if (chosenCinema == "2")
                {
                    Console.WriteLine("Choose your list:\n1.All movies\n2.Sorted by genre.");
                    string allOrGenre = Console.ReadLine();
                    try
                    {
                        if (allOrGenre == "1")
                        {
                            GenreChoise.AllMovies(MoviesLists.SecondList(), Cinemas);
                        }
                        else if (allOrGenre == "2")
                        {
                            try
                            {
                                Console.WriteLine("Your choise is:\n1.Comedy\n2.Horror\n3.Action\n4.Drama\n5.SciFi");
                                string genreChoise = Console.ReadLine();
                                if (genreChoise == "1" || genreChoise == "2" || genreChoise == "3" || genreChoise == "4" || genreChoise == "5")
                                {
                                    GenreChoise.ChoseTheGenre(MoviesLists.SecondList(), genreChoise);
                                }
                                else
                                {
                                    throw new Exception("Please enter number from 1 to 5");
                                }
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e.Message);
                            }
                        }
                        else
                        {
                            throw new Exception("Please choose 1 or 2");
                        }
                    }catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }
                else
                {
                    throw new Exception("Valid choise is 1 or 2");
                }
            }catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.ReadLine();
        }
예제 #33
0
        public void CinemaTest1()
        {
            Cinema ci = cbl.GetCinemaByCineId(1);

            Assert.NotNull(ci);
        }
 protected virtual void ExecuteInsertVenueCommand(string[] commandWords)
 {
     switch (commandWords[2])
     {
         case "cinema":
             var cinema = new Cinema(commandWords[3], commandWords[4], int.Parse(commandWords[5]));
             this.Venues.Add(cinema);
             break;
         default:
             break;
     }
 }
예제 #35
0
 public CinemaRepository()
 {
     _Db  = new EGMoviesWorkshopDB();
     _obj = new Cinema();
 }