public Filmovi() { InitializeComponent(); FilmDAO fDAO = new FilmDAO(); this.DataContext = fDAO.getAll(); ComboBox1.ItemsSource = fDAO.getAll(); ComboBox2.ItemsSource = fDAO.getAll(); PrehrambeniProduktDao pDAO = new PrehrambeniProduktDao(); ListBox1.ItemsSource = pDAO.getAll(); ComboBox3.ItemsSource = pDAO.getAll(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { FilmDAO fDAO = new FilmDAO(); if (TextBox1.Text == String.Empty || TextBox2.Text == String.Empty) return; Film f = new Film(TextBox1.Text, Convert.ToInt32(TextBox2.Text)); fDAO.update(f); this.DataContext = fDAO.getAll(); ComboBox1.ItemsSource = fDAO.getAll(); ComboBox2.ItemsSource = fDAO.getAll(); TextBox1.Clear(); TextBox2.Clear(); }
private void Button_Click(object sender, RoutedEventArgs e) { FilmDAO fDAO = new FilmDAO(); if (Naziv.Text == String.Empty || Sifra.Text == String.Empty) return; Film f = new Film(Naziv.Text, Convert.ToInt32(Sifra.Text)); fDAO.create(f); this.DataContext = fDAO.getAll(); ComboBox1.ItemsSource = fDAO.getAll(); ComboBox2.ItemsSource = fDAO.getAll(); Naziv.Clear(); Sifra.Clear(); }
private void Button_Click_2(object sender, RoutedEventArgs e) { if (ComboBox2.SelectedIndex != -1) { FilmDAO fDAO = new FilmDAO(); Film f = ComboBox2.SelectedItem as Film; fDAO.delete(f); this.DataContext = fDAO.getAll(); ComboBox1.ItemsSource = fDAO.getAll(); ComboBox2.ItemsSource = fDAO.getAll(); } }