コード例 #1
0
 public MainWindow()
 {
     CheckingDataBase();
     InitializeComponent();
     Reloading += LoadingLastAddedMovies;
     Reloading();
 }
コード例 #2
0
 public DeleteCategoryWindow(ReloadMovies reload)
 {
     InitializeComponent();
     LoadCategories();
     this.Reloading = reload;
     MoviesExist    = false;
 }
コード例 #3
0
 public MovieWindow(int idMovie, ReloadMovies reload)
 {
     this.Reloading = reload;
     InitializeComponent();
     this.idMovie = idMovie;
     LoadMovie();
 }
コード例 #4
0
 public AddMovieCategoryWindow(ReloadMovies reloading)
 {
     InitializeComponent();
     ReadCategories();
     DefaultTextBox = "Podaj nazwę kategorii";
     this.Reloading = reloading;
 }
コード例 #5
0
 public NewMovieWindow(ReloadMovies reload)
 {
     Reloading = reload;
     InitializeComponent();
     LoadCategories();
     IsAnyError = false;
 }
コード例 #6
0
        private void AddCategoryButton_Click(object sender, RoutedEventArgs e)
        {
            Reloading += LoadCategories;
            AddMovieCategoryWindow AddMovie = new AddMovieCategoryWindow(Reloading);

            AddMovie.ShowDialog();
        }
コード例 #7
0
 public SearchWindow(string nSearchContent, ReloadMovies reload)
 {
     InitializeComponent();
     this.Reloading      = reload;
     this.SearchContent  = nSearchContent;
     Search_TextBox.Text = this.SearchContent;
     SearchDatabase(this.SearchContent);
 }
コード例 #8
0
 public MovieWindow(int idMovie, ReloadMovies reload, SearchWindow Search)
 {
     this.Search    = Search;
     this.Reloading = reload;
     InitializeComponent();
     this.idMovie = idMovie;
     LoadMovie();
 }
コード例 #9
0
 public EditMovieWindow(int nIdMovie, ReloadMovies reload, MovieWindow movie)
 {
     this.Moviewindow = movie;
     this.Reloading   = reload;
     this.IdMovie     = nIdMovie;
     InitializeComponent();
     LoadCategories();
     LoadMovie();
 }
コード例 #10
0
 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();
             }
         }
     }
 }