Exemplo n.º 1
0
        public FilmType GetType()
        {
            VideoContext contex = new VideoContext();
            FilmType     Type   = contex.FilmTypes.Where(c => c.Type == comboBox1.Text).FirstOrDefault();

            return(Type);
        }
Exemplo n.º 2
0
        private void textBox3_MouseClick(object sender, MouseEventArgs e)
        {
            GenresID = new List <int>();
            if (textBox3.Text != null)
            {
                VideoContext contex = new VideoContext();
                String       s      = textBox3.Text;
                String[]     words  = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (String genre in words)
                {
                    GenresID.Add(contex.Genres.Where(g => g.Name == genre).FirstOrDefault().GenreID);
                }
                InputJenre form = new InputJenre(GenresID, textBox4.Text);
                form.ShowDialog();
                if (form.GetGenres() != null && form.GetType() != null)
                {
                    Genres = form.GetGenres();
                    Type   = form.GetType();
                }

                textBox3.Text = "";
            }
            else
            {
                InputJenre form = new InputJenre(null, null);
                form.ShowDialog();
                if (form.GetGenres() != null && form.GetType() != null)
                {
                    Genres = form.GetGenres();
                    Type   = form.GetType();
                }
            }
            if (Type != null && Genres != null)
            {
                foreach (Genre c in Genres)
                {
                    textBox3.Text += c.Name + " ";
                }
                textBox4.Text = Type.Type;
            }
        }
Exemplo n.º 3
0
 public InputFilm(Film film)
 {
     InitializeComponent();
     if (film != null)
     {
         this.Film = film;
         VideoContext contex = new VideoContext();
         var          genres = contex.FimsGenres.Where(g => g.FilmID == Film.FilmID);
         openFileDialog1          = new OpenFileDialog();
         openFileDialog1.FileName = Film.Image;
         FilmType inType = contex.FilmTypes.Where(t => t.TypeID == Film.TypeID).FirstOrDefault();
         Type       = inType;
         this.TypeF = film.Type.ToString();
         GenresID   = new List <int>();
         foreach (FilmGenres g in genres)
         {
             //Genre genre = contex.Genres.Where(c => c.GenreID == g.GenreID).FirstOrDefault();
             GenresID.Add(g.GenreID);
         }
     }
 }