Exemplo n.º 1
1
        public MovieItem(Movie movie, MovieManager manager, Form1 form)
        {
            this.form = form;
            this.movie = movie;
            this.Image = movie.image;
            this.SizeMode = PictureBoxSizeMode.Zoom;
            this.BackColor = Color.Black;
            this.MouseDoubleClick += (s, e) =>
            {
                if (Form.ModifierKeys == Keys.Control)
                {
                    System.Diagnostics.ProcessStartInfo ps = new System.Diagnostics.ProcessStartInfo("cmd", string.Format("/c \"{0}\"", "\"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe\" \"" + movie.location + "\""));
                    System.Diagnostics.Process.Start(ps);
                }
                else
                {
                    new MoviePlayer(movie).Show();
                }
            };
            sBoxImg.Image = Properties.Resources.selectedImg;
            sBoxImg.Size = new System.Drawing.Size(10, 10);
            sBoxImg.Location = new Point(190, 0);
            sBoxImg.Visible = false;
            Controls.Add(sBoxImg);
            this.MouseClick += (s, e) =>
            {
                if (e.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    List<Movie> list = new List<Movie>();
                    list.Add(movie);
                    MovieEdit edit = new MovieEdit(manager, list, form, this);
                    edit.changedImage = false;
                    edit.newMovie = false;
                    edit.ShowDialog();
                    if (edit.changed && edit.changedImage)
                    {
                        Image = movie.image;
                    }
                }
                else if (e.Button == System.Windows.Forms.MouseButtons.Left && Form.ModifierKeys == Keys.Control)
                {
                    if (selectedMovies.Contains(movie))
                    {
                        selectedMovies.Remove(movie);
                        sBoxImg.Visible = false;
                    }
                    else
                    {
                        selectedMovies.Add(movie);
                        sBoxImg.Visible = true;
                    }
                    form.SelectedCountLabel.Text = selectedMovies.Count.ToString();
                    form.SetSelectButtons(selectedMovies.Count != 0);
                }
            };
            this.MouseHover += MovieItem_MouseHover;
            this.MouseLeave += MovieItem_MouseLeave;

            CustomLabel length = new CustomLabel();
            length.Text = (movie.length / 60).ToString() + ":" + (movie.length % 60).ToString("00");
            length.Size = new System.Drawing.Size(this.Size.Width, 14);
            length.BackColor = Color.Transparent;
            length.ForeColor = Color.White;
            length.OutlineForeColor = Color.Black;
            this.Controls.Add(length);

            if (selectedMovies.Contains(movie))
            {
                sBoxImg.Visible = true;
            }
        }
Exemplo n.º 2
0
 public ActionResult Edit(ManageMovieViewModel model, System.Web.HttpPostedFileBase file)
 {
     if (!ModelState.IsValid)
     {
         return(View(model));
     }
     if (file != null && file.ContentLength > 0)
     {
         var fileName = System.IO.Path.Combine(Request.MapPath("~/Content/Movie/"), System.IO.Path.GetFileName(file.FileName));
         file.SaveAs(fileName);
         model.Avatar = System.IO.Path.GetFileName(file.FileName);
         string oldAvatar = _db.tbl_Movie.SingleOrDefault(m => m.movie_Id == model.Id).movie_Avatar;
         if (oldAvatar != "Movie_Default.png")
         {
             ImageManager.Delete(Server.MapPath("~/Content/Movie/" + oldAvatar));
         }
     }
     else
     {
         //MR_DataClassesDataContext _db = new MR_DataClassesDataContext();
         MRDataEntities _db = new MRDataEntities();
         model.Avatar = _db.tbl_Movie.SingleOrDefault(m => m.movie_Id == model.Id).movie_Avatar;
     }
     MovieManager.Edit(model);
     return(RedirectToAction("Index", new { id = model.Id }));
 }
Exemplo n.º 3
0
        public ActionResult CreateMovie(ManageMovieViewModel movie, System.Web.HttpPostedFileBase file)
        {
            if (!ModelState.IsValid)
            {
                return(View(movie));
            }
            if (file != null && file.ContentLength > 0)
            {
                var fileName = System.IO.Path.Combine(Request.MapPath("~/Content/Movie/"), System.IO.Path.GetFileName(file.FileName));
                file.SaveAs(fileName);
                movie.Avatar = System.IO.Path.GetFileName(file.FileName);
            }
            //MR_DataClassesDataContext _db = new MR_DataClassesDataContext();
            MRDataEntities _db = new MRDataEntities();

            if ((bool)_db.tbl_UserAccount.SingleOrDefault(u => u.user_Account == CookieHepler.GetCookie("user")).user_IsAdmin)
            {
                movie.Status = 2;
            }
            else
            {
                movie.Status = 0;
            }
            movie.Create = AccountManager.GetId(CookieHepler.GetCookie("user"));
            string newId = MovieManager.CreateMovie(movie);

            return(RedirectToAction("Index", new { id = newId }));
        }
Exemplo n.º 4
0
 public ActionResult Create(CreateMovieViewModel movie)
 {
     if (!ModelState.IsValid)
     {
         return(View(movie));
     }
     foreach (var item in movie.DoubanID.Split('\n'))
     {
         if (item.Trim().Length == 0)
         {
             continue;
         }
         JObject json = HtmlDecoder.GetJson("https://api.douban.com/v2/movie/subject/" + item.Replace("https://movie.douban.com/subject/", "").Replace("/", ""));
         JToken  msg;
         if (json.TryGetValue("msg", out msg))
         {
             ModelState.AddModelError("", string.Format("{0} {1} {2}", "添加编号为", item, "的电影 失败"));
         }
         else
         {
             ModelState.AddModelError("", string.Format("{0} {1} {2}", "添加编号为", item, "的电影 成功"));
             MovieManager.CreateJson(json, Server.MapPath("~/Content/Movie/"), AccountManager.GetId(CookieHepler.GetCookie("user")));
         }
     }
     return(View());
 }
Exemplo n.º 5
0
        public void MovieManager_GetMoviesWithTitle_WhenTitleIsEmpty_Throws()
        {
            // Arrange
            string emptyTitle   = string.Empty;
            var    mockGateway  = new Mock <IImdbMovieService>(MockBehavior.Strict);
            var    movieManager = new MovieManager(mockGateway.Object);

            mockGateway
            .Setup(g => g.GetMovieWithTitle(emptyTitle))
            .Returns <string>(title =>
            {
                // You don't ever want to do this (implement logic in your mocks)
                // This is just to show that you can do it this way in case you
                // have to
                if (title.Length == 0)
                {
                    throw new MovieTitleNullOrEmptyException($"The title: {emptyTitle} is not a valid Title");
                }
                else
                {
                    return(GetExpectedMovieByTitle(title));
                }
            });

            // Act
            try
            {
                var actualMovies = movieManager.GetMovieWithTitle(emptyTitle);
                throw new XunitException("We were expecting a MovieTitleNullOrEmptyException, but no exception was thrown");
            }
            catch (MovieTitleNullOrEmptyException e)
            {
                Assert.Contains("not a valid Title", e.Message);
            }
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            List <Movie>  movies       = new List <Movie>();
            IMovieManager movieManager = new MovieManager();

            var scraped = ScraperBuilder.Builder()
                          .WithDefaultLoadersParsers()
                          .WithDefaultScrapedDataManager()
                          .Build()
                          .Scrape();

            foreach (var scrapedItem in scraped)
            {
                var movie = movieManager.Create(scrapedItem);

                var showtimeManager = new ShowtimeManager(movie, new DateBuilder());
                showtimeManager.UpdateShowtimes(scrapedItem);

                movies.Add(movie);
            }

            try
            {
                // sample of scraped data can be found in ./scrapedData.json
                var json = JsonConvert.SerializeObject(movies, Formatting.Indented);
            }
            catch (Exception e)
            {
                LogHelper.Error("Program", e.ToString());
                throw;
            }
        }
Exemplo n.º 7
0
        public override void Start()
        {
            var primary = MediaElements[0];

            primary.Source = new Uri(MovieManager.GetRandomAssetUrl());
            _logger.Debug($"Playing media {primary.Source}");
        }
Exemplo n.º 8
0
        // GET: Movie/Edit/5
        public ActionResult Edit(int id)
        {
            if (Authenticate.IsAuthenticated())
            {
                ViewBag.Title = "Edit";
                MovieGenresDirectorsRatingsFormats mgdrf = new MovieGenresDirectorsRatingsFormats();
                mgdrf.Movie     = MovieManager.LoadByID(id);
                mgdrf.Directors = DirectorManager.Load();
                mgdrf.Genres    = GenreManager.Load();
                mgdrf.Ratings   = RatingManager.Load();
                mgdrf.Formats   = FormatManager.Load();

                IEnumerable <int> existingGenreIds = new List <int>();
                mgdrf.Movie.Genres = MovieManager.LoadGenres(id);
                mgdrf.GenreIds     = mgdrf.Movie.Genres.Select(a => a.Id);

                //put genres in session
                Session["genreids"] = mgdrf.GenreIds;
                return(View(mgdrf));
            }
            else
            {
                return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url }));
            }
        }
Exemplo n.º 9
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //accedo all'assembly del cliente e recupero la lista di stringhe che rappresenta il CSV
            var moviesCsv = MovieManager.GetMovies();

            //Creo una classe che rappresenta un film, quindi ha le stesse property che troverò nel CSV
            //Istanzio una lista di Movie che popolerò con i dati del CSV e che mi servirà
            //Come sorgente dati per la mia datagridview
            var movies = new List <Movie>();

            //Esempio di riga del CSV
            //tarantino;le iene;1996;thriller;13.45

            //Itero le righe del mio CSV per popolare la lista movies
            foreach (var item in moviesCsv)
            {
                //ogni riga è in formato CSV quindi devo dividerla in sottostringhe
                //usando il carattere di delimitazione fornito
                var splittedItem = item.Split(';');
                //aggiungo alla mia lista un nuovo oggetto popolando correttamente le sue property
                var movie = new Movie();
                movie.Regista = splittedItem[0];
                movie.Titolo  = splittedItem[1];
                movie.Anno    = int.Parse(splittedItem[2]);
                movie.Genere  = splittedItem[3];
                movie.Prezzo  = double.Parse(splittedItem[4]);
                movies.Add(movie);
            }
            //Associo la mia lista di oggetti di tipo Movie alla datagridView come sorgente dati
            dataGridView1.DataSource = movies;
        }
Exemplo n.º 10
0
        public ActionResult Edit(int id)
        {
            Movie movie = new Movie();

            using (manager = new MovieManager())
            {
                movie = manager.GetById(id);
            }
            if (movie == null)
            {
                return(HttpNotFound());
            }
            else
            {
                MovieViewModel vm = new MovieViewModel();
                using (GenreManager genreManager = new GenreManager()) { vm.PossibleGenres = genreManager.GetAll(); }
                using (RatingManager ratingManager = new RatingManager()) { vm.PossibleRatings = ratingManager.GetAll(); }
                using (DirectorManager directorManager = new DirectorManager()) { vm.PossibleDirectors = directorManager.GetAll(); }
                using (FormatManager formatManager = new FormatManager()) { vm.PossibleFormats = formatManager.GetAll(); }
                //vm.MovieId = movie.Id;
                vm.Movie            = movie;
                vm.MovieDescription = movie.Description;
                vm.MovieCost        = movie.Cost;
                vm.MovieTitle       = movie.Title;
                vm.ImagePath        = movie.ImagePath;

                vm.CurrentGenres = new List <int>();
                foreach (var a in movie.Genres)
                {
                    vm.CurrentGenres.Add(a.Id);
                }
                return(View(vm));
            }
        }
Exemplo n.º 11
0
 public UIMovie()
 {
     InitializeComponent();
     _directorService = new DirectorManager(new DirectorDal());
     _movieService    = new MovieManager(new MovieDal());
     _actorService    = new ActorManager(new ActorDal());
 }
Exemplo n.º 12
0
        public ActionResult Edit(EditMovieVM model)
        {
            var selectedGenres = model.Genres.Where(x => x.IsChecked).Select(x => x.ID).ToList();

            MovieManager.Edit(model.ID, model.Title, model.ReleaseDate, model.RunningTimeMinutes, selectedGenres);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 13
0
        public ActionResult Edit(int id)
        {
            var movie = MovieManager.GetByID(id);
            var model = new EditMovieVM()
            {
                ID                 = movie.ID,
                ReleaseDate        = movie.ReleaseDate,
                RunningTimeMinutes = movie.RunningTime,
                Title              = movie.Title
            };
            var movieGenres       = GenreManager.GetForMovie(id);
            var allGenres         = GenreManager.GetAll();
            var checkBoxListItems = new List <CheckBoxListItem>();

            foreach (var genre in allGenres)
            {
                checkBoxListItems.Add(new CheckBoxListItem()
                {
                    ID        = genre.ID,
                    Display   = genre.Name,
                    IsChecked = movieGenres.Where(x => x.ID == genre.ID).Any()
                });
            }
            model.Genres = checkBoxListItems;
            return(View(model));
        }
Exemplo n.º 14
0
        public ActionResult Index()
        {
            MovieIndexVM model = new MovieIndexVM();

            model.Movies = MovieManager.GetAll();
            return(View(model));
        }
Exemplo n.º 15
0
        public ActionResult Refresh(string id)
        {
            if (!MovieManager.Exist(id))
            {
                return(RedirectToAction("NotFound", "Error"));
            }
            RefreshMovieViewModel refresh = new RefreshMovieViewModel();

            tbl_Movie tblmovie = _db.tbl_Movie.SingleOrDefault(s => s.movie_Id == id);

            refresh.Old = new ManageMovieViewModel(tblmovie);

            JObject json = HtmlDecoder.GetJson("https://api.douban.com/v2/movie/subject/" + tblmovie.movie_DoubanID);
            JToken  msg;

            if (json.TryGetValue("msg", out msg))
            {
                refresh.New    = new ManageMovieViewModel();
                refresh.New.Id = refresh.Old.Id;
            }
            else
            {
                tblmovie       = MovieManager.JsonToMovie(json, Server.MapPath("~/Content/Movie/"));
                refresh.New    = new ManageMovieViewModel(tblmovie);
                refresh.New.Id = refresh.Old.Id;
            }
            TempData["New"] = refresh.New;

            return(View(refresh));
        }
Exemplo n.º 16
0
 //Hides the loading bar on start
 private void Start()
 {
     this.transform.localScale = new Vector3(0, 1, 1);
     actorManager = ActorManager.Instance;
     movieManager = MovieManager.Instance;
     loading      = false;
 }
Exemplo n.º 17
0
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);

            if (value == null)
            {
                return(null);
            }
            if (string.IsNullOrEmpty(value.AttemptedValue))
            {
                return(null);
            }

            int movieId;

            if (!int.TryParse(value.AttemptedValue, out movieId))
            {
                return(null);
            }

            var movieManager = new MovieManager();
            var movie        = movieManager.GetMovie(movieId);

            return(movie);
        }
Exemplo n.º 18
0
 public ShopController(BasketManager _basketRepo, UserManager _userRepo, MovieManager _movieRepo, PaymentHistoryManager _paymentRepo)
 {
     BasketRepo  = _basketRepo;
     UserRepo    = _userRepo;
     MovieRepo   = _movieRepo;
     PaymentRepo = _paymentRepo;
 }
Exemplo n.º 19
0
        //private MovieDbContext db = new MovieDbContext();

        // GET: Movies
        public ActionResult Index()
        {
            //return View(db.Movies.ToList());

            //new
            return(View(MovieManager.GetList()));
        }
Exemplo n.º 20
0
        // GET: Movie/Edit/5
        public ActionResult Edit(int id)
        {
            if (Authenticate.IsAuthenticated())
            {
                ViewBag.Title = "Edit";

                MovieGenresDirectorsRatingsFormats mgdrf = new MovieGenresDirectorsRatingsFormats();

                mgdrf.Movie        = MovieManager.LoadById(id);
                mgdrf.RatingList   = RatingManager.Load();
                mgdrf.FormatList   = FormatManager.Load();
                mgdrf.GenreList    = GenreManager.Load();
                mgdrf.DirectorList = DirectorManager.Load();

                mgdrf.Movie.Genres  = MovieManager.LoadGenres(id);
                mgdrf.GenreIds      = mgdrf.Movie.Genres.Select(g => g.Id);
                Session["genreids"] = mgdrf.GenreIds;


                return(View(mgdrf));
            }
            else
            {
                return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url }));
            }
        }
        public override void Start()
        {
            var randomAssetUrl = MovieManager.GetRandomAssetUrl();

            SetSourceForAllMediaElements(new Uri(randomAssetUrl));

            if (Settings.Instance.PlayInLoop)
            {
                foreach (var mediaElement in MediaElements)
                {
                    mediaElement.UnloadedBehavior = MediaState.Manual;
                }

                MediaElements[0].MediaEnded += (sender, args) => {
                    _logger.Debug("Replaying on all screens");
                    RestartAllMediaElements();
                };
            }
            else
            {
                MediaElements[0].MediaEnded += (sender, args) => {
                    var newSource = new Uri(MovieManager.GetRandomAssetUrl());
                    SetSourceForAllMediaElements(newSource);
                    _logger.Debug($"Playing new url {newSource} on all screens");
                };
            }
        }
Exemplo n.º 22
0
        // GET: Movie/Edit/5
        public ActionResult Edit(int id)
        {
            if (Authenticate.IsAuthenticated())
            {
                MovieGenresDirectorsRatingsFormats mgdrf = new MovieGenresDirectorsRatingsFormats();

                mgdrf.Movie        = MovieManager.LoadById(id);
                mgdrf.DirectorList = DirectorManager.Load();
                mgdrf.RatingList   = RatingManager.Load();
                mgdrf.FormatList   = FormatManager.Load();
                mgdrf.Genres       = GenreManager.Load(); // Load them all

                // Deal with the selected ones
                mgdrf.Movie.Genres = MovieManager.LoadGenres(id);
                mgdrf.GenreIds     = mgdrf.Movie.Genres.Select(a => a.Id); // Select the ids

                // Put them into session
                Session["genreids"] = mgdrf.GenreIds;

                return(View(mgdrf));
            }
            else
            {
                return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url }));
            }
        }
Exemplo n.º 23
0
        public ActionResult Create(MovieGenresDirectorsRatingsFormats mgdrf)
        {
            try
            {
                if (mgdrf.File != null)
                {
                    mgdrf.Movie.ImagePath = mgdrf.File.FileName;
                    string target = Path.Combine(Server.MapPath("~/images"), Path.GetFileName(mgdrf.File.FileName));

                    if (!System.IO.File.Exists(target))
                    {
                        mgdrf.File.SaveAs(target);
                        ViewBag.Message = "File Uploaded Successfullly...";
                    }
                    else
                    {
                        ViewBag.Message = "File already exists...";
                    }
                }

                MovieManager.Insert(mgdrf.Movie);
                mgdrf.GenreIds.ToList().ForEach(a => MovieGenreManager.Add(mgdrf.Movie.Id, a));
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
                return(View(mgdrf));
            }
        }
Exemplo n.º 24
0
        public MovieController()
        {
            var kernel = new StandardKernel();

            kernel.Load(new MovieModule());
            manager = kernel.Get <MovieManager>();
        }
Exemplo n.º 25
0
        public void TestSurLaRecuperationDesFichiersVideos_When_LeRepertoireEtLesFichiersExistent_Then_DonneLaListe()
        {
            #region ARRANGE

            string nomFilm = "phantom-thread-french-webrip-1080p-2018";

            #endregion

            #region ACT

            MovieManager manager = new MovieManager("TRUEFRENCH", "FRENCH", "FR");
            IEnumerable <MovieInformation> result = manager.GetMoviesInformations(_pathFilmsTest, TypeVideo.Movie);

            #endregion

            #region ASSERT

            Assert.AreEqual(result.Count(), 4, "Il doit y avoir 4 films dans la liste");

            var listeTemp = result.ToList();
            MovieInformation movieTest = listeTemp[3];
            Assert.AreEqual(movieTest.Annee, "2018");
            Assert.AreEqual(movieTest.Langage, "FRENCH");
            Assert.AreEqual(movieTest.Qualite, "webrip");
            Assert.AreEqual(movieTest.Resolution, "1080p");
            Assert.AreEqual(movieTest.Titre, "PHANTOM THREAD");


            #endregion
        }
Exemplo n.º 26
0
        public ActionResult Details(int id)
        {
            List <Movie> movies   = MovieManager.GetMovies();
            Movie        theMovie = movies.FirstOrDefault(m => m.Id == id);

            return(View(theMovie));
        }
Exemplo n.º 27
0
        // GET: Movie
        public ActionResult Index()
        {
            List <MovieModel> movies = new List <MovieModel>();

            movies = MovieManager.GetMovies().Select(m => MovieModel.FromData(m)).ToList();
            return(View(movies));
        }
        public void GetAllMovie()
        {
            IMovieManager manager = new MovieManager();
             var result = manager.GetAllMovies();

             Assert.AreEqual(result.Count, 10);
        }
Exemplo n.º 29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        LiteralControl lt = new LiteralControl();

        Int64  mvId;
        String movieName;
        String imgPath;
        Double price;

        MovieManager Mvmgr = new MovieManager();
        Movie        mv    = new Movie();

        string movietype = Request.QueryString["type"].ToString();


        List <Movie> columnData = Mvmgr.LoadMovie(movietype);

        foreach (Movie mv1 in columnData)
        {
            mvId      = Convert.ToInt64(mv1.movieId);
            movieName = mv1.name;
            price     = Convert.ToDouble(mv1.price);
            imgPath   = mv1.imagepath;


            lt.Text += "<div class='w3-col m3' style='margin:5px 5px 5px'><div class='w3-card-4 w3-dark-grey'><div class='w3-container w3-center'><h5>" + movieName + "</h5><img src = '" + imgPath + "' alt= 'Avatar' style='width:80%'><h6>Price: " + price + "</h6><button id ='buy_" + mvId + "' onclick='redirect(this);' class='w3-button w3-green'>Buy</button><button id ='add_cart_" + mvId + "' onclick='setCart(this);' class='w3-button w3-blue'>Add To Cart</button></div></div></div>";
            MovieList.Controls.Add(lt);
        }
    }
Exemplo n.º 30
0
        protected async override Task OnInitializedAsync()
        {
            // Récupération de la liste de films.
            var allMovies = await MovieManager.GetMovies();

            if (allMovies.Any())
            {
                var tempMovies = allMovies.OrderByDescending(x => x.DateAdded).ToList();

                MoviesOrdered = tempMovies.Count >= 6
                                        ? tempMovies.Take(6)
                                        : tempMovies.Take(tempMovies.Count);
            }

            // Récupération des dessins animés.
            var allAnimes = await MovieManager.GetDessinAnimes();

            if (allAnimes.Any())
            {
                var temp = allAnimes.OrderByDescending(x => x.DateAdded).ToList();

                AnimesOrdered = temp.Count >= 6
                                        ? temp.Take(6)
                                        : temp.Take(temp.Count);
            }
        }
        public void GetMovie()
        {
            IMovieManager manager = new MovieManager();
             var result = manager.GetMovie(1);

             Assert.AreEqual(result.Id, 1);
             Assert.AreEqual(result.Name, "Avengers - Age of Ultron");
        }
        public void GetAllMoviePaging()
        {
            IMovieManager manager = new MovieManager();
             var result = manager.GetAllMoviesCustom(2,3);

             Assert.AreEqual(result.Count, 3);
             Assert.AreEqual(result[0].Name, "The Imitation Game");
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        MovieManager mm = new MovieManager();

        gvMovies.DataSource = mm.getMovies();
        gvMovies.DataBind();
        updatePanel2.Update();
    }
    protected void btnGetMovie_Click(object sender, EventArgs e)
    {
        MovieManager mm = new MovieManager();

        gvMovies.DataSource = mm.getMoviesByTitle(txtTitle.Text);
        gvMovies.DataBind();
        updatePanel2.Update();
    }
        public void DeleteMovie()
        {
            IMovieManager manager = new MovieManager();
             Common.Movie movie = new Common.Movie
             {
                 Id = 11,
                 Name = "MovieName",
                 Description = "SomeDescription",
                 Rating = 4.0,
                 URL = "http://someurl/img.png"
             };
             bool result1 = manager.AddMovie(movie);
             bool result = manager.DeleteMovie(11);

             Assert.IsTrue(result);
             Common.Movie newMovie = manager.GetMovie(11);
             Assert.AreEqual(newMovie, null);
        }
Exemplo n.º 36
0
        public TagsForm(MovieManager manager)
        {
            InitializeComponent();
            foreach (Selectable<Genre> genre in manager.getAllSearchTags())
            {
                TagItem box = new TagItem(genre);
                box.Text = genre.item.name;
                box.Checked = genre.selected;
                box.AutoCheck = false;
                if (box.genre.notThat)
                {
                    box.ForeColor = Color.Red;
                }
                else
                {
                    box.ForeColor = Color.Black;
                }
                box.MouseClick += (s, e) =>
                {
                    changed = true;
                    if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                    {
                        box.genre.notThat = !box.genre.notThat;
                        if (box.genre.notThat)
                        {
                            box.ForeColor = Color.Red;
                        }
                        else
                        {
                            box.ForeColor = Color.Black;
                        }

                    }
                    else
                    {
                        box.Checked = !box.Checked;
                        box.genre.selected = box.Checked;
                    }

                };

                flowLayoutPanel1.Controls.Add(box);
            }
        }
        public void UpdateMovie()
        {
            IMovieManager manager = new MovieManager();
             Common.Movie movie = new Common.Movie
             {
                 Id = 10,
                 Name = "MovieName",
                 Description = "SomeDescription",
                 Rating = 4.0,
                 URL = "http://someurl/img.png"
             };
             bool result = manager.UpdateMovie(movie);
             Common.Movie newMovie = manager.GetMovie(10);

             Assert.IsTrue(result);
             Assert.AreEqual(newMovie.Name, "MovieName");
        }