public MainWindow() { CheckingDataBase(); InitializeComponent(); Reloading += LoadingLastAddedMovies; Reloading(); }
public DeleteCategoryWindow(ReloadMovies reload) { InitializeComponent(); LoadCategories(); this.Reloading = reload; MoviesExist = false; }
public MovieWindow(int idMovie, ReloadMovies reload) { this.Reloading = reload; InitializeComponent(); this.idMovie = idMovie; LoadMovie(); }
public AddMovieCategoryWindow(ReloadMovies reloading) { InitializeComponent(); ReadCategories(); DefaultTextBox = "Podaj nazwę kategorii"; this.Reloading = reloading; }
public NewMovieWindow(ReloadMovies reload) { Reloading = reload; InitializeComponent(); LoadCategories(); IsAnyError = false; }
private void AddCategoryButton_Click(object sender, RoutedEventArgs e) { Reloading += LoadCategories; AddMovieCategoryWindow AddMovie = new AddMovieCategoryWindow(Reloading); AddMovie.ShowDialog(); }
public SearchWindow(string nSearchContent, ReloadMovies reload) { InitializeComponent(); this.Reloading = reload; this.SearchContent = nSearchContent; Search_TextBox.Text = this.SearchContent; SearchDatabase(this.SearchContent); }
public MovieWindow(int idMovie, ReloadMovies reload, SearchWindow Search) { this.Search = Search; this.Reloading = reload; InitializeComponent(); this.idMovie = idMovie; LoadMovie(); }
public EditMovieWindow(int nIdMovie, ReloadMovies reload, MovieWindow movie) { this.Moviewindow = movie; this.Reloading = reload; this.IdMovie = nIdMovie; InitializeComponent(); LoadCategories(); LoadMovie(); }
private void EditMovie_Button_Click(object sender, RoutedEventArgs e) { try { CheckingFormData(); IsAnyError = false; } catch (Exception ex) { IsAnyError = true; ExceptionInfo.Visibility = Visibility.Visible; ExceptionInfo.Foreground = System.Windows.Media.Brushes.Red; ExceptionInfo.Content = ex.Message; } if (IsAnyError == false) { CategoryList selected = new CategoryList(MovieCategories.SelectedValue.ToString()); int index = ListOfCategories.FindIndex(a => a.CategoryName == selected.CategoryName); using (SQLiteConnection DatabaseConnection = new SQLiteConnection("Data Source=database.sqlite3")) { DatabaseConnection.Open(); string query = "UPDATE Movies SET Title = @Title, Year = @Year, ProductionCountry = @Country, Description = @Description, idCategory = @IdCategory, Name = @Name, Forename = @Forename, imgsource = @img WHERE idMovie = @id"; using (SQLiteCommand Command = new SQLiteCommand(query, DatabaseConnection)) { Command.Parameters.AddWithValue("@id", IdMovie); Command.Parameters.AddWithValue("@Title", MovieTitle.Text); Command.Parameters.AddWithValue("@Year", MovieYear.Text); Command.Parameters.AddWithValue("@Country", MovieCountry.Text); Command.Parameters.AddWithValue("@Description", Desciption.Text); Command.Parameters.AddWithValue("@IdCategory", ListOfCategories[index].IdCategory); Command.Parameters.AddWithValue("@Name", Directorname[0]); Command.Parameters.AddWithValue("@Forename", Directorname[1]); Command.Parameters.AddWithValue("@img", ImgByteArr); Command.ExecuteNonQuery(); Reloading += Moviewindow.LoadMovie; Reloading(); Reloading -= Moviewindow.LoadMovie; MessageBox.Show("Edytowano Film"); this.Close(); } } } }