Example #1
0
 private void _addDescription_Click(object sender, EventArgs e)
 {
     if (_filmCB2.SelectedIndex < 0 || _filmDescriptionTB.Text == string.Empty)
     {
         return;
     }
     FilmDescription filmDescription = new FilmDescription {
         id = idsOfFilms.ElementAt(_filmCB2.SelectedIndex), Description = _filmDescriptionTB.Text
     };
     var responce = elasticClient.IndexDocument(filmDescription);
 }
Example #2
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            MainInfoFilm    newMainInfoFilm    = new MainInfoFilm();
            Creators        newCreators        = new Creators();
            BudgetAndFees   newBudgetAndFees   = new BudgetAndFees();
            FilmDescription newFilmDescription = new FilmDescription();
            RentalData      newRentalData      = new RentalData();
            AgeLimit        newAgeLimit        = new AgeLimit();


            newMainInfoFilm.Name              = tbName.Text;
            newMainInfoFilm.CountryCreator    = tbCountryCreator.Text;
            newMainInfoFilm.Operator          = tbOperator.Text;
            newMainInfoFilm.Genres            = tbGenres.Text;
            newMainInfoFilm.idCreators        = newCreators.ID;
            newMainInfoFilm.idFilmDescription = newFilmDescription.ID;
            newMainInfoFilm.idBudgetAndFees   = newBudgetAndFees.ID;
            newMainInfoFilm.idRentalData      = newRentalData.ID;
            newMainInfoFilm.idAgeLimit        = newAgeLimit.ID;
            MemoryStream      stream  = new MemoryStream();
            JpegBitmapEncoder encoder = new JpegBitmapEncoder();

            encoder.Frames.Add(BitmapFrame.Create((BitmapImage)imgLoad.Source));
            encoder.Save(stream);
            newMainInfoFilm.ImageMovie = stream.ToArray();

            var currentType = dbContext.db.AgeLimit.FirstOrDefault(item => item.MPAA == cmbMPAA.Text);

            newMainInfoFilm.ID = currentType.ID;

            newBudgetAndFees.Budget        = Convert.ToInt32(tbBudget.Text);
            newBudgetAndFees.WorldwideFees = Convert.ToInt32(tbWorldwideFees.Text);

            newCreators.Director = tbDirector.Text;
            newCreators.Producer = tbProducer.Text;

            newRentalData.PremiereInRussia = (DateTime)tbPremiereInRussia.SelectedDate;
            newRentalData.PremiereInWorld  = (DateTime)tbPremiereInWorld.SelectedDate;

            newFilmDescription.Description = tbDescription.Text;

            dbContext.db.BudgetAndFees.Add(newBudgetAndFees);

            dbContext.db.Creators.Add(newCreators);
            dbContext.db.AgeLimit.Add(newAgeLimit);
            dbContext.db.RentalData.Add(newRentalData);
            dbContext.db.FilmDescription.Add(newFilmDescription);
            dbContext.db.MainInfoFilm.Add(newMainInfoFilm);

            dbContext.db.SaveChanges();

            MessageBox.Show("Вы успешно добавили данные", "Уведомление", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Example #3
0
        public void TestClassPersonne()
        {
            List <FilmDescription> ListofMovie1 = new List <FilmDescription>();
            List <FilmDescription> ListofMovie2 = new List <FilmDescription>();

            FilmDescription film1 = new FilmDescription();
            FilmDescription film2 = new FilmDescription("Alien vs Predator", DateTime.Today);
            FilmDescription film3 = new FilmDescription("Alien vs Predator 2", DateTime.Today);

            ListofMovie2.Add(film1);
            ListofMovie2.Add(film2);
            ListofMovie2.Add(film3);

            Personne pers  = new Personne();
            Personne pers2 = new Personne("Ben", 21);
            Personne pers3 = new Personne("Ben", 21, ListofMovie1, ListofMovie2, ListofMovie1);
        }