Beispiel #1
0
        private void txtYorum_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (!string.IsNullOrEmpty(txtYorum.Text))
                {
                    try
                    {
                        Rating rating = new Rating();
                        rating.Comment    = txtYorum.Text;
                        rating.Point      = pointControl();
                        rating.CreateDate = DateTime.Now;
                        rating.FilmID     = FilmFilterForm.filmFiltreDTONesne.FilmID;
                        rating.UserID     = LoginForm._userID;

                        _ratingService.AddRatingService(rating);
                        dataGridView1.DataSource = null;
                        dataGridView1.DataSource = _ratingService.FilmRatingRatingService(FilmFilterForm.filmFiltreDTONesne.FilmID);
                        txtYorum.Clear();
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    MessageBox.Show("Lütfen Birşeyler Yaz!");
                    txtYorum.Clear();
                }
            }
        }
Beispiel #2
0
        private void btnEkle_Click(object sender, EventArgs e)
        {
            Film yenifilm = new Film();

            yenifilm.PosterUrl   = path;
            yenifilm.FilmName    = txtFilmAdi.Text;
            yenifilm.ReleaseDate = dateTimePicker1.Value;
            yenifilm.FilmSummary = txtBio.Text;
            yenifilm.CreateDate  = DateTime.Now;
            yenifilm.LanguageID  = Convert.ToInt16(cbDil.SelectedValue);
            FilmServices.AddFilmService(yenifilm);


            //Film film = FilmServices.GetByIdFilmService(yenifilm.FilmID);
            yenifilm.Category.Add(categoryService.GetByIdCategoryService(Convert.ToInt16(cbKategori.SelectedValue)));
            yenifilm.Country.Add(countryService.GetByIdCountryService(Convert.ToInt16(cbUlke.SelectedValue)));

            for (int i = 0; i < lstOyuncu.SelectedItems.Count; i++)
            {
                yenifilm.Actor.Add(actorService.GetByIDActorService(Convert.ToUInt16(lstOyuncu.SelectedItems[i].Tag)));
            }

            for (int i = 0; i < lstYonetmen.SelectedItems.Count; i++)
            {
                yenifilm.Director.Add(directorService.GetByIdDirectorService(Convert.ToUInt16(lstYonetmen.SelectedItems[i].Tag)));
            }

            if (FilmServices.UpdateFilmService(yenifilm) > 0) //Film eklendiğinde
            {
                MessageBox.Show(yenifilm.FilmName + " Filmi Başarıyla Eklendi");
                FİlmleriListVieweDoldur();
            }
            else
            {
                MessageBox.Show("Hata. Eklenemedi");
            }
            Rating yeniRating = new Rating();

            yeniRating.Comment    = "Admin Yorum";
            yeniRating.CreateDate = DateTime.Now;
            yeniRating.Point      = 3;
            yeniRating.FilmID     = yenifilm.FilmID;
            yeniRating.UserID     = LoginForm._userID; //this user is always admin
            RatingService.AddRatingService(yeniRating);
        }