Наследование: MonoBehaviour
Пример #1
0
 public static List<Film> getAllFilms()
 {
     List<Film> films = new List<Film>();
     SqlConnection con = new SqlConnection(_ConnectionString);
     SqlCommand cmd = new SqlCommand("SELECT * FROM films", con);
     using (con)
     {
         con.Open();
         //The reader is filled using the command object which goes over the connection.
         SqlDataReader reader = cmd.ExecuteReader();
         if (reader.HasRows)
         {
             while (reader.Read())
             {
                 //this loops through all the modules that are returned to create a module object and put it in the list.
                 Film f = new Film((int)reader["ID"], (string)reader["Title"], (int)reader["Year"], (string)reader["Synopsis"]);
                 films.Add(f);
             }
         }
         else
         {
             return null;
         }
     }
     return films;
 }
Пример #2
0
    public static Film getFilm(Int32 filmID)
    {
        Film f = new Film();

        SqlConnection con = new SqlConnection(_ConnectionString);
        SqlCommand cmd = new SqlCommand("SELECT * FROM films WHERE ID='" + filmID + "'", con);

        using (con)
        {
            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    f.id = (int)reader["ID"];
                    f.title = (string)reader["Title"];
                    f.year = (int)reader["Year"];
                    f.synopsis = (string)reader["Synopsis"];
                }
            }
            else
            {
                return null;
            }
        }
        return f;
    }
Пример #3
0
        private static string GetExternalFilmImdbRating(Film film)
        {

            // --------------------------- IMDB ---------------------------

            var searchQuery = ImdbRepository.GetFilmSearchQuery(film);

            var imdbObject = ImdbRepository.GetImdbObjectFromSeachQuery(searchQuery);

            if (ImdbRepository.IsFilmValidImdbMatch(film, imdbObject))
                return imdbObject.imdbRating;

            if (!string.IsNullOrEmpty(film.OriginalTitle))
                imdbObject = ImdbRepository.GetImdbObjectFromSeachQuery(film.OriginalTitle);

            if (ImdbRepository.IsFilmValidImdbMatch(film, imdbObject))
                return imdbObject.imdbRating;

            // --------------------------- END IMDB ------------------------

            // Here we can try other sources if available

            return string.Empty;

        }
Пример #4
0
 public bool Equals(Film other) {
     if (ReferenceEquals(null, other)) {
         return false;
     }
     if (ReferenceEquals(this, other)) {
         return true;
     }
     return Equals(other.Id, Id) && Equals(other.Bezeichnung, Bezeichnung);
 }
Пример #5
0
        public PartialViewResult FilmDetail(int id)
        {
            Film flm = new Film();
            flm = _serviceFilm.GetById(id);
            flm.Actors = _serviceFilm.GetById(id).Actors.ToList();
            flm.Directors = _serviceFilm.GetById(id).Directors.ToList();
            flm.Writers = _serviceFilm.GetById(id).Writers.ToList();
            flm.Producers = _serviceFilm.GetById(id).Producers.ToList();
            flm.FilmTypes = _serviceFilm.GetById(id).FilmTypes.ToList();

            return PartialView("Partial/_FilmDetail", flm);
        }
Пример #6
0
        public void Main(string[] args)
        {
            Film StarWars = new Film( String.Format("Star Wars The Force Awakens"), new DateTime(2015, 12, 18)  );
            // StarWars.NewFilm);
            Debug.WriteLine(StarWars.FilmInfo);

            StarWars.ChangeReleaseDate = new DateTime(2015, 12, 19);

            if (CheckReleaseDate(StarWars.ReleaseDate))
                Debug.WriteLine(StarWars.FilmInfo);
            else
                Debug.WriteLine(string.Format("The date is incorrect!"));
        }
        public ActionResult Create(Film film, int[] Cat, string[] part)
        {
            if (ModelState.IsValid)
            {
                film.CreatedDate = film.ModifiedDate = DateTime.Now;
                film.Categories = GetCategory(Cat);
                film.FilmParts = GetPart(part, film.SEOName);
                if (part.Length > 0)
                    film.ImageUrl = string.Format("http://i1.ytimg.com/vi/{0}/mqdefault.jpg", part[0]);
                db.Films.Add(film);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(film);
        }
Пример #8
0
        public ActionResult FilmAdd(Film film, string txtPublishDate, HttpPostedFileBase File)
        {
            if (Session["account"] != null)
            {
                DateTime dt = Convert.ToDateTime(txtPublishDate);

                film.PublishDate = dt;

                if (File != null)
                {
                    File.SaveAs(Server.MapPath("~/FilmPosters/") + File.FileName);
                    film.PosterImgPath = "/FilmPosters/" + File.FileName;
                }

                _serviceFilm.Insert(film);

                return RedirectToAction("FilmListele", "Film");
            }
            else
                return RedirectToAction("Login", "User");
        }
Пример #9
0
 /// <summary>
 /// écrit les acteurs du film
 /// </summary>
 /// <param name="film">film</param>
 /// <returns>liste de réprésentation xml d'acteurs</returns>
 private IEnumerable <XElement> WriteActeurs(Film film)
 {
     return(film.Acteurs.Select(acteur => new XElement(XMLTags.ACTEUR, new XAttribute(XMLTags.NOM, acteur.Nom)
                                                       , new XAttribute(XMLTags.PRENOM, acteur.Prenom))));
 }
Пример #10
0
 public void ConstructorShouldThrowExceptionIfStockNegaative()
 {
     //Arrange
     //Act
     Film film = new Film("Jurassic Park", new DateTime(1984, 1, 20), -5, Genre.Science_Fiction);
 }
Пример #11
0
 public void InsertFilm(Film film)
 {
     context.Film.Add(film);
 }
Пример #12
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Random rd = new Random();
            string[] types = { "Korku", "Macera", "Gerilim", "Drama", "Polisiye", "Romantik", "Komedi" };

            List<Film> LSTFilm = new List<Film>();
            for (int i = 0; i < 10; i++)
            {
                Film Newfilm = new Film();
                Newfilm.Name = FakeData.NameData.GetCompanyName();
                Newfilm.PublishDate = FakeData.DateTimeData.GetDatetime();
                Newfilm.ImdbPoint = FakeData.NumberData.GetNumber(1, 9);
                Newfilm.PosterImgPath = "../../images/r" + FakeData.TextData.GetNumeric(1) + ".jpg";
                Newfilm.Website = FakeData.NetworkData.GetDomain();

                List<FilmType> LSTFlmtyp = new List<FilmType>();
                for (int k = 0; k < 6; k++)
                {
                    FilmType newflmtyp = new FilmType();
                    newflmtyp.TypeName = types[k];
                    newflmtyp.Movies = LSTFilm;

                    LSTFlmtyp.Add(newflmtyp);
                    _serviceFilmType.Insert(newflmtyp);
                }
                Newfilm.FilmTypes = LSTFlmtyp;

                List<Actor> LSTActr = new List<Actor>();
                for (int k = 0; k < 5; k++)
                {
                    Actor act = new Actor();
                    act.Name = FakeData.NameData.GetFirstName();
                    act.Surname = FakeData.NameData.GetSurname();
                    act.BirthDate = FakeData.DateTimeData.GetDatetime();
                    act.ImagePath = "../../images/gridallbum" + FakeData.TextData.GetNumeric(1) + ".jpg";
                    act.Movies = LSTFilm;

                    LSTActr.Add(act);
                    _serviceActor.Insert(act);
                }
                Newfilm.Actors = LSTActr;

                List<Director> LSTDrt = new List<Director>();
                for (int m = 0; m < 5; m++)
                {
                    Director drt = new Director();
                    drt.Name = FakeData.NameData.GetFirstName();
                    drt.Surname = FakeData.NameData.GetSurname();
                    drt.BirthDate = FakeData.DateTimeData.GetDatetime();
                    drt.ImagePath = "../../images/gridallbum" + FakeData.TextData.GetNumeric(1) + ".jpg";
                    drt.Movies = LSTFilm;

                    LSTDrt.Add(drt);
                    _serviceDirector.Insert(drt);
                }
                Newfilm.Directors = LSTDrt;

                List<Writer> LSTWrt = new List<Writer>();
                for (int m = 0; m < 5; m++)
                {
                    Writer wrt = new Writer();
                    wrt.Name = FakeData.NameData.GetFirstName();
                    wrt.Surname = FakeData.NameData.GetSurname();
                    wrt.BirthDate = FakeData.DateTimeData.GetDatetime();
                    wrt.ImagePath = "../../images/gridallbum" + FakeData.TextData.GetNumeric(1) + ".jpg";
                    wrt.Movies = LSTFilm;

                    LSTWrt.Add(wrt);
                    _serviceWriter.Insert(wrt);
                }
                Newfilm.Writers = LSTWrt;

                List<Producer> LSTPrd = new List<Producer>();
                for (int m = 0; m < 5; m++)
                {
                    Producer prd = new Producer();
                    prd.ChairManName = FakeData.NameData.GetFullName();
                    prd.CompanyName = FakeData.NameData.GetCompanyName();
                    prd.FormDate = FakeData.DateTimeData.GetDatetime();
                    prd.CompanyAddress = FakeData.PlaceData.GetAddress();
                    prd.WebSite = FakeData.NetworkData.GetDomain();
                    prd.Movies = LSTFilm;

                    LSTPrd.Add(prd);
                    _serviceProducer.Insert(prd);
                }
                Newfilm.Producers = LSTPrd;

                LSTFilm.Add(Newfilm);
                _serviceFilm.Insert(Newfilm);
            }

            for (int i = 0; i < 5; i++)
            {
                User usr = new User();
                usr.Name = FakeData.NameData.GetFirstName();
                usr.Surname = FakeData.NameData.GetSurname();
                usr.BirthDate = FakeData.DateTimeData.GetDatetime();
                usr.Email = FakeData.NetworkData.GetEmail();
                usr.ImagePath = "../../images/gridallbum" + FakeData.TextData.GetNumeric(1) + ".jpg";
                usr.Password = "******";
                usr.Role = (ProjectTemplate.Core.Enums.Role)(rd.Next(0, 1));
                _serviceUser.Insert(usr);
            }

            MessageBox.Show("Veri Eklendi");
            dataGridView1.DataSource = _serviceFilm.GetAll();
        }
Пример #13
0
        private void btToevoegbevestig_Click(object sender, RoutedEventArgs e)
        {
            if (!toevoegAct)
            { Film nieuweFilm = new Film();
                layoutActive();
                toevoegAct = true;
                filmsOb.Add(nieuweFilm);
                lbFilms.SelectedItem = nieuweFilm;
            }
            else
            {
                if (!CheckOpFouten())
                {
                    toevoegAct = false;
                    layoutOriginal();
                }
                else
                    MessageBox.Show("Er zijn nog fouten aanwezig, kan niet toevoegen", "Toevoegen", MessageBoxButton.OK, MessageBoxImage.Error);

            }
        }
Пример #14
0
 public CardForm(Film film)
 {
     InitializeComponent();
     this.film = film;
 }
Пример #15
0
 public EditFilmPage(Film film)
 {
     BindingContext = new EditFilmPageViewModel(film);
     InitializeComponent();
 }
        public ActionResult CreateFilm(AddFilmViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model = new AddFilmViewModel
                {
                    FilmGenres = db.FilmGenres.Select(x =>
                                                      new SelectListItem
                    {
                        Text  = x.Name,
                        Value = x.Id.ToString()
                    }).ToList(),

                    Creators = db.Creators.Select(x =>
                                                  new SelectListItem
                    {
                        Text  = x.Name,
                        Value = x.Id.ToString()
                    }).ToList(),
                };

                return(View(model));
            }

            if (db.Films.Any(x => x.Title == model.Title))
            {
                model = new AddFilmViewModel
                {
                    FilmGenres = db.FilmGenres.Select(x =>
                                                      new SelectListItem
                    {
                        Text  = x.Name,
                        Value = x.Id.ToString()
                    }).ToList(),

                    Creators = db.Creators.Select(x =>
                                                  new SelectListItem
                    {
                        Text  = x.Name,
                        Value = x.Id.ToString()
                    }).ToList(),
                };

                ModelState.AddModelError(string.Empty, "Ten tytuł jest już używany dla innego filmu.");

                return(View(model));
            }

            var    fileName  = Path.GetFileNameWithoutExtension(model.ImageFile.FileName);
            string extension = Path.GetExtension(model.ImageFile.FileName);

            fileName    = fileName + DateTime.Now.ToString("yymmssfff") + extension;
            model.Image = "~/Content/img/" + fileName;
            fileName    = Path.Combine(Server.MapPath("~/Content/img/"), fileName);
            model.ImageFile.SaveAs(fileName);

            Film film = new Film();

            film.Duration    = model.Duration;
            film.Title       = model.Title;
            film.Description = model.Description;
            film.Image       = model.Image;
            film.Deleted     = model.Deleted;

            var filmGenre = db.FilmGenres.FirstOrDefault(c => c.Id == model.FilmGenre);

            film.FilmGenre = filmGenre;
            var creator = db.Creators.FirstOrDefault(c => c.Id == model.Creator);

            film.Creator = creator;

            db.Films.Add(film);
            db.SaveChanges();

            ModelState.Clear();
            return(RedirectToAction("FilmList"));
        }
        //List<Film> films = new List<Film>();
        //List<Actor> actors = new List<Actor>();
        static void Main(string[] args)
        {
            const string f = "smallactors.txt";

            //Film oscar = new Film();
            //Film globe = new Film();
            //Film best = new Film();

            List<Film> films = new List<Film>();
            List<Actor> actors = new List<Actor>();

            //List<Film> A = new List<Film> { oscar };
            //List<Film> B = new List<Film> { oscar, globe };
            //List<Film> C = new List<Film> { globe, best };

            //Actor jim = new Actor("jim", A, false);
            //Actor jane = new Actor("jane", B, false);
            //Actor joe = new Actor("joe", C, false);

            using (StreamReader r = new StreamReader(f))
            {
                string line;
                bool newactor = true;
                Actor currentActor = new Actor();
                Film currentFilm = new Film();

                while ((line = r.ReadLine()) != null)
                {
                    if (line == "")
                    {
                        newactor = true;
                        continue;
                    }

                    if (newactor == true)
                    {
                        currentActor = new Actor(line, new List<Film>());
                        actors.Add(currentActor);
                        newactor = false;
                    }
                    else
                    {
                        currentFilm = films.Find(delegate(Film film) { return film.name.Equals(line); });
                        if (currentFilm == null)
                        {
                            currentFilm = new Film(line, new List<Actor>());
                            films.Add(currentFilm);
                        }

                        currentFilm.cast.Add(currentActor);
                        currentActor.films.Add(currentFilm);
                    }
                }

                foreach (Film film in films)
                {
                    Console.WriteLine(film.name);
                    foreach (Actor actor in film.cast)
                        Console.WriteLine(actor.name);
                    Console.ReadLine();

                }
                foreach (Actor actor in actors)
                {
                    Console.WriteLine(actor.name);
                    foreach (Film film in actor.films)
                        Console.WriteLine(film.name);
                    Console.ReadLine();
                }
                Console.ReadLine();
            }

            //oscar.cast.Add(jim);
            //oscar.cast.Add(jane);
            //globe.cast.Add(jane);
            //globe.cast.Add(joe);
            //best.cast.Add(joe);
            //jim.name = "jim";
            //jane.name = "jane";
            //jim.films.Add(oscar);
            //jane.films.Add(oscar);
            //oscar.cast.Add(jim);
            //oscar.cast.Add(jane);

            //oscar.name = "The last Crusade";
            //if (oscar.findActor("joe"))
            //    Console.WriteLine("good");
            //else
            //    Console.WriteLine("bad");
        }
        static void Main(string[] args)
        {
            //takes our sample file and indexes it into film and actor objects
            const string f = "smallactors.txt";
            List<Film> films = new List<Film>();
            List<Actor> actors = new List<Actor>();
            using (StreamReader r = new StreamReader(f))
            {
                string line;
                bool newactor = true;
                Actor currentActor = new Actor();
                Film currentFilm = new Film();
                int indx = 0;
                bool checkID = false;

                while ((line = r.ReadLine()) != null)
                {
                    if (line == "")
                    {
                        newactor = true;
                        continue;
                    }

                    if (newactor == true)
                    {
                        currentActor = new Actor(line, new List<Film>());
                        actors.Add(currentActor);
                        newactor = false;
                    }
                    else
                    {
                        if (checkID == false)
                            {
                                currentFilm = new Film(line, new List<Actor>());
                                checkID = true;
                                continue;
                            }
                            if (checkID == true)
                            {
                                indx = Convert.ToInt32(line);
                                if (indx >= films.Count)
                                {
                                    films.Add(currentFilm);
                                }
                                films[indx].cast.Add(currentActor);
                                currentActor.films.Add(films[indx]);
                                checkID = false;
                            }
                    }
                }

                //foreach (Film film in films)
                //{
                //    Console.WriteLine(film.name);
                //    foreach (Actor actor in film.cast)
                //        Console.WriteLine(actor.name);
                //    Console.ReadLine();

                //}
                int x = 0;
                foreach (Actor actor in actors)
                {

                    Console.WriteLine(x + ".)" + actor.name);
                    x++;
                    //foreach (Film film in actor.films)
                    //Console.WriteLine(film.name);
                    //Console.ReadLine();
                }
                //USER INTERFACE
                string input1;
                string input2;
                Console.WriteLine("Select the first actor by it's corresponding number");
                input1 = Console.ReadLine();
                Console.WriteLine("Select the second actor by it's corresponding number");
                input2 = Console.ReadLine();

                string[] words = input1.Split(' ');
                input1 = words[1]+", "+words[0];
                Actor test = actors.Find(item => item.name == input1);

                if (test == null)
                {
                    int minDist = 1000;
                    int tempDist = 0;
                    Actor tempActor = new Actor();
                    Actor bestMatch = new Actor();

                    for (int i = 0; i < actors.Count; i++)
                    {

                        tempDist = tempActor.DamerauLevenshteinDistance(input1, actors[i].name);
                        if (tempDist < minDist)
                        {
                            minDist = tempDist;
                            bestMatch = actors[i];
                        }
                    }
                    test = bestMatch;
                }

                words = input2.Split(' ');
                input2 = words[1] + ", " + words[0];
                Actor queryActor = new Actor();
                queryActor.name = input2;

                Actor test2 = actors.Find(item => item.name == input2);
                if (test2 == null)
                {
                    int minDist = 1000;
                    int tempDist = 0;
                    Actor tempActor = new Actor();
                    Actor bestMatch = new Actor();

                    for (int i = 0; i < actors.Count; i++)
                    {

                        tempDist = tempActor.DamerauLevenshteinDistance(input2, actors[i].name);
                        if (tempDist < minDist)
                        {
                            minDist = tempDist;
                            bestMatch = actors[i];
                        }
                    }
                    test2 = bestMatch;
                }

                if (test.DegreeOfSeparation(test2, 1) != -1)
                {

                    Console.WriteLine("good");
                }
                else
                    Console.WriteLine("bad");

                Console.ReadLine();
            }
        }
Пример #19
0
 public void UpdateFilm(Film film)
 {
     context.Entry(film).State = EntityState.Modified;
 }
Пример #20
0
 /// <summary>
 /// écrit les genres du film
 /// </summary>
 /// <param name="film">film</param>
 /// <returns>liste de réprésentation xml des genres</returns>
 private IEnumerable <XElement> WriteGenres(Film film)
 {
     return(film.Genres.Select(genre => new XElement(XMLTags.GENRE, genre.NomGenre)));
 }
 public void UpdateFilm(Film film)
 {
     throw new NotImplementedException();
 }
Пример #22
0
 public ActionResult Create(Film film)
 {
     service.Add(film);
     service.Commit();
     return(RedirectToAction("Index"));
 }
Пример #23
0
 public static Lån SkapaNytt(Vän låntagare, Film film)
 {
     return new Lån(låntagare, film);
 }
Пример #24
0
 public void AddFilm(Film film)
 {
     film.Id = Guid.NewGuid();
     films.Add(film);
 }
Пример #25
0
    public static Int32 insertNewFilm(Film newFilm)
    {
        //create a new connection using the connection string in the web.config
        SqlConnection con = new SqlConnection(_ConnectionString);

        //Create a new command object that holds the SQL statement we want to run.
        SqlCommand cmd = new SqlCommand("INSERT into films (Title, Year, Synopsis) VALUES('" + newFilm.title + "', '"
            + newFilm.year +"','" + newFilm.synopsis + "'); " + "SELECT CAST(Scope_Identity() as int)", con);
        Int32 returnID = 0;
        using (con)
        {
            try
            {
                con.Open();
                returnID = (Int32)cmd.ExecuteScalar();
            }
            catch (Exception ex)
            {
                LastError = ex.Message;
            }
        }
        return returnID;
    }
Пример #26
0
 public void Delete(Film entity)
 {
     _filmRepository.Delete(entity);
 }
 public Lån HittaLånAv(Film film)
 {
     return _utlåningsregister.HittaLånAv(film: film);
 }
Пример #28
0
 public void Update(Film entity, int[] categoryIds)
 {
     _filmRepository.Update(entity, categoryIds);
 }
Пример #29
0
 public FilmViewModel()
 {
     film   = new Film();
     dict   = new Dictionary <string, bool>();
     actors = new MyObservableCollection <ActorViewModel>();
 }
Пример #30
0
 public FilmViewModel(Film film)
 {
     actors    = new MyObservableCollection <ActorViewModel>();
     this.film = film;
 }
Пример #31
0
 public void Update(Film entity)
 {
     filmRepository.Update(entity);
 }
Пример #32
0
 public void UpdateFilm(Film film)
 {
 }
Пример #33
0
 public abstract void saveData(Film film, string xmlFile);
Пример #34
0
        /// <summary>
        /// Sauvegarde un film en base
        /// </summary>
        /// <param name="film">le film à sauvegarder</param>
        /// <returns></returns>
        public async Task SaveFilm(Film film)
        {
            var isCreate = film.Id == 0;

            //si création, récup d'un nouvel ID
            if (isCreate)
            {
                film.Id = await GetNewIdFilm();
            }
            else
            {
                //si modif, on efface les tables de jointures genre/ personne du film
                await RemoveGenreFilm(film);
                await RemovePersonneFilm(film);

                //et on efface l'id de la collection éventuelle à laquelle il peut appartenir
                if (film.IdCollection > 0)
                {
                    await SupprimerFilmCollection(film.Id);
                }
            }

            //Création des genres s'ils n'existent pas, puis jointure avec le film
            foreach (var genre in film.Genres)
            {
                if (genre.Id == 0)
                {
                    var newGenre = await AddGenre(genre);

                    genre.Id = newGenre.Id;
                }

                var joinFilmGenre = new GenreFilm
                {
                    Id      = await GetNewIdGenreFilm(),
                    IdFilm  = film.Id,
                    IdGenre = genre.Id
                };
                await Bdd.AjouterDonnee(joinFilmGenre);
            }

            //Création de la liste des acteurs
            if (film.Acteurs != null && film.Acteurs.Count > 0)
            {
                foreach (var personne in film.Acteurs)
                {
                    var res = await SearchPersonne(personne.Nom);

                    if (res == null)
                    {
                        var newPersonne = await AddPersonne(personne);

                        personne.Id = newPersonne.Id;
                    }
                    else
                    {
                        personne.Id = res.Id;
                    }
                    var personneFilm = new PersonneFilm
                    {
                        Id         = await GetNewIdPersonneFilm(),
                        IdFilm     = film.Id,
                        IdPersonne = personne.Id,
                        Role       = (int)TypePersonneEnum.ACTEUR
                    };
                    await Bdd.AjouterDonnee(personneFilm);
                }
            }

            //Création de la liste des producteurs
            if (film.Producteurs != null && film.Producteurs.Count > 0)
            {
                foreach (var personne in film.Producteurs)
                {
                    var res = await SearchPersonne(personne.Nom);

                    if (res == null)
                    {
                        var newPersonne = await AddPersonne(personne);

                        personne.Id = newPersonne.Id;
                    }
                    else
                    {
                        personne.Id = res.Id;
                    }
                    var personneFilm = new PersonneFilm
                    {
                        Id         = await GetNewIdPersonneFilm(),
                        IdFilm     = film.Id,
                        IdPersonne = personne.Id,
                        Role       = (int)TypePersonneEnum.PRODUCTEUR
                    };
                    await Bdd.AjouterDonnee(personneFilm);
                }
            }

            //Création de la liste des réalisateurs
            if (film.Realisateurs != null && film.Realisateurs.Count > 0)
            {
                foreach (var personne in film.Realisateurs)
                {
                    var res = await SearchPersonne(personne.Nom);

                    if (res == null)
                    {
                        var newPersonne = await AddPersonne(personne);

                        personne.Id = newPersonne.Id;
                    }
                    else
                    {
                        personne.Id = res.Id;
                    }
                    var personneFilm = new PersonneFilm
                    {
                        Id         = await GetNewIdPersonneFilm(),
                        IdFilm     = film.Id,
                        IdPersonne = personne.Id,
                        Role       = (int)TypePersonneEnum.REALISATEUR
                    };
                    await Bdd.AjouterDonnee(personneFilm);
                }
            }

            //Création du film en base
            if (isCreate)
            {
                await Bdd.AjouterDonnee(film);
            }
            else
            {
                await Bdd.UpdateDonnee(film);
            }

            //si le film doit appartenir à une collection, lien avec cette dernière
            if (!string.IsNullOrEmpty(film.NomCollection))
            {
                await AjouterFilmCollection(film);
            }
        }
Пример #35
0
 /// <summary>
 /// écrit les réalisateurs du film
 /// </summary>
 /// <param name="film">film</param>
 /// <returns>liste de réprésentation xml des réalisateurs</returns>
 private IEnumerable <XElement> WriteRealisateurs(Film film)
 {
     return(film.Realisateurs.Select(realisateur => new XElement(XMLTags.REALISATEUR, new XAttribute(XMLTags.NOM, realisateur.Nom)
                                                                 , new XAttribute(XMLTags.PRENOM, realisateur.Prenom))));
 }
Пример #36
0
        /// <summary>
        /// Met en place les infos du film
        /// </summary>
        /// <param name="film">le film à modifier</param>
        /// <param name="chargePersonne">indique si il faut charger les personnes</param>
        /// <param name="chargerImage">indique si il faut charger les images </param>
        /// <returns>le film modifié</returns>
        private async Task <Film> SetInfosFilm(Film film, bool chargePersonne, bool chargerImage)
        {
            //init
            film.Acteurs      = new List <Personne>();
            film.Producteurs  = new List <Personne>();
            film.Realisateurs = new List <Personne>();
            film.Genres       = new List <Genre>();

            if (chargePersonne)
            {
                //Acteurs
                var listeActeurs = await Bdd.Connection.Table <PersonneFilm>().Where(x => x.IdFilm == film.Id && x.Role == (int)TypePersonneEnum.ACTEUR).ToListAsync();

                foreach (var acteur in listeActeurs)
                {
                    if (acteur.IdPersonne > 0)
                    {
                        var personne = await Bdd.Connection.Table <Personne>().Where(x => x.Id == acteur.IdPersonne).FirstAsync();

                        if (personne != null)
                        {
                            personne.Role     = TypePersonneEnum.ACTEUR;
                            personne.NomScene = acteur.NomScene;
                            film.Acteurs.Add(personne);
                        }
                    }
                }

                //Producteurs
                var listeProd = await Bdd.Connection.Table <PersonneFilm>().Where(x => x.IdFilm == film.Id && x.Role == (int)TypePersonneEnum.PRODUCTEUR).ToListAsync();

                foreach (var producteur in listeProd)
                {
                    if (producteur.IdPersonne > 0)
                    {
                        var personne = await Bdd.Connection.Table <Personne>().Where(x => x.Id == producteur.IdPersonne).FirstAsync();

                        if (personne != null)
                        {
                            personne.Role = TypePersonneEnum.PRODUCTEUR;
                            film.Producteurs.Add(personne);
                        }
                    }
                }

                //Réalisateur
                var listeReal = await Bdd.Connection.Table <PersonneFilm>().Where(x => x.IdFilm == film.Id && x.Role == (int)TypePersonneEnum.REALISATEUR).ToListAsync();

                foreach (var realisateur in listeReal)
                {
                    if (realisateur.IdPersonne > 0)
                    {
                        var personne = await Bdd.Connection.Table <Personne>().Where(x => x.Id == realisateur.IdPersonne).FirstAsync();

                        if (personne != null)
                        {
                            personne.Role = TypePersonneEnum.REALISATEUR;
                            film.Realisateurs.Add(personne);
                        }
                    }
                }
            }


            //Genre
            var listeGenre = await Bdd.Connection.Table <GenreFilm>().Where(x => x.IdFilm == film.Id).ToListAsync();

            foreach (var genre in listeGenre)
            {
                var genr = await Bdd.Connection.Table <Genre>().Where(x => x.Id == genre.IdGenre).FirstAsync();

                if (genr != null)
                {
                    film.Genres.Add(genr);
                }
            }

            //affiche
            if (chargerImage && film.Affiche != null && film.Affiche.Length > 0)
            {
                film.AfficheImage = await ObjectUtils.ConvertBytesToBitmap(film.Affiche);
            }
            else
            {
                film.AfficheImage = new BitmapImage(ContexteStatic.UriAfficheDefaut);
            }
            film.AfficheImage = ObjectUtils.ResizedImage(film.AfficheImage, (int)ContexteStatic.MaxSizeXAffiche,
                                                         (int)ContexteStatic.MaxSizeYAffiche);
            return(film);
        }
Пример #37
0
        // GET: Bilet
        public ActionResult Index(int id)
        {
            Film f = db.Film.Where(x => x.filmID == id).SingleOrDefault();

            return(View(f));
        }
Пример #38
0
 public void CreateFilm(Film film) => _inner.CreateFilm(film);
 public void AddFilm(Film filmToAdd)
 {
     throw new NotImplementedException();
 }
Пример #40
0
 public void UpdateFilm(Film film) => _inner.UpdateFilm(film);
Пример #41
0
 public Film Create(Film film)
 {
     _Films.InsertOne(film);
     return(film);
 }
Пример #42
0
 public void DeleteFilm(Film film) => _inner.DeleteFilm(film);
Пример #43
0
    public static int updateFilm(Int32 filmID, Film f)
    {
        //create a new connection using the connection string in the web.config
        SqlConnection con = new SqlConnection(_ConnectionString);

        //Create a new command object that holds the SQL statement we want to run.
        SqlCommand cmd = new SqlCommand("UPDATE films SET title='"
            + f.title + "', year='" + f.year + "', synopsis='" + f.synopsis + "' WHERE ID='" + filmID + "'", con);
        int res = -1;
        using (con)
        {
            try
            {
                con.Open();
                res = (Int32)cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                LastError = ex.Message;
            }
        }
        return res;
    }
Пример #44
0
 public void Create(Film entity) => _inner.Create(entity);
 public void RegistreraLån(Film film, Vän låntagare)
 {
     throw new System.NotImplementedException();
 }
Пример #46
0
 public void Update(Film entity) => _inner.Update(entity);
Пример #47
0
        private void btVerwijdAnnuleer_Click(object sender, RoutedEventArgs e)
        {
            if (toevoegAct)
            {
                toevoegAct = false;
                Film removeFilm = new Film();
                removeFilm = (Film)lbFilms.SelectedItem;
                filmsOb.Remove(removeFilm);
                NieuweFilms.Remove(removeFilm);
                OudeFilms.Remove(removeFilm);
                layoutOriginal();
                lbFilms.SelectedIndex = 0;

            }
            else
            {
                if (MessageBox.Show("Ben je zeker dat je deze film wil verwijderen", "Verwijderen", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
                {
                    Film oudeFilm = new Film();
                    oudeFilm = (Film)lbFilms.SelectedItem;
                    filmsOb.Remove(oudeFilm);
                }
            }
        }
Пример #48
0
 public void Delete(Film entity) => _inner.Delete(entity);
 public void RegistreraLån(Film film, Vän låntagare)
 {
     _utlåningsregister.RegistreraLån(film, låntagare);
 }
Пример #50
0
 public static List<string> GetFilmGenreNames(Film filmToSearchOn)
 {
     return filmToSearchOn.GenreFilmIndexes.Select(index => index.Genre.Name).ToList();
 }
Пример #51
0
 public Seans(Film film, DateTime dataGodzina)
 {
     this.film = film;
     this.dataGodzina = dataGodzina;
 }
 public Lån HittaLånAv(Film film)
 {
     throw new System.NotImplementedException();
 }
Пример #53
0
        public ActionResult FilmEdit(Film film)
        {
            if (Session["account"] != null)
            {
                if (ModelState.IsValid)
                {
                    Film guncellenenFilm = _serviceFilm.GetById(film.Id);
                    guncellenenFilm.Name = film.Name;
                    guncellenenFilm.PublishDate = film.PublishDate;
                    guncellenenFilm.ImdbPoint = film.ImdbPoint;
                    guncellenenFilm.Website = film.Website;

                    _serviceFilm.Update(guncellenenFilm);
                }

                return RedirectToAction("FilmListele", "Film");
            }
            else
                return RedirectToAction("Login", "User");
        }
Пример #54
0
 public void Create(Film entity)
 {
     filmRepository.Create(entity);
 }
Пример #55
0
 public UpdateFilmMessage(int id, Film film)
 {
     this.Id   = id;
     this.Film = film;
 }
Пример #56
0
 public Lån(Vän låntagare, Film film)
 {
     Låntagare = låntagare;
     Film = film;
 }
Пример #57
0
 public static Film ReadMovieFromCollection(this string title)
 {
     Film = (from flick in Context.Films
             where flick.Title == title
             select flick).ToList().FirstOrDefault();
     return Film;
 }
Пример #58
0
        private void btToevoegbevestig_Click(object sender, RoutedEventArgs e)
        {
            if (!toevoegAct)
            {
                layoutInstel();
                toevoegAct = true;
            }
            else
            {
                if (!CheckOpFouten())
                {
                    Film nieuweFilm = new Film();
                    nieuweFilm.BandNr = Convert.ToInt32(bandNrTextBox.Text);
                    nieuweFilm.Titel = titelTextBox.Text;
                    nieuweFilm.GenreNr = Convert.ToInt32(genreNrCbBox.SelectedValue);
                    nieuweFilm.InVoorraad = Convert.ToInt32(inVoorraadTextBox.Text);
                    nieuweFilm.UitVoorraad = Convert.ToInt32(uitVoorraadTextBox.Text);
                    nieuweFilm.Prijs = Convert.ToDecimal(uitVoorraadTextBox.Text);
                    nieuweFilm.TotaalVerhuurd = Convert.ToInt32(totaalVerhuurdTextBox.Text);
                    filmsOb.Add(nieuweFilm);
                }

            }
        }