Esempio n. 1
0
        private void booksDeleteButton_Click(object sender, EventArgs e)
        {
            databaseController dbc          = new databaseController();
            string             selectedBook = bookslistBox.SelectedItem.ToString();//exception needs to be handled

            selectedBook = selectedBook.Trim();
            string[] BookID = selectedBook.Split('|');
            selectedBook = BookID[1].Trim();
            int    total_pages  = Convert.ToInt32(BookID[2].Trim());
            int    id_b         = Convert.ToInt32(BookID[0].Trim());
            string publish_date = BookID[4].Trim();
            int    rating       = Convert.ToInt32(BookID[3].Trim());
            string summary      = BookID[5].Trim();

            int publisher_id = Convert.ToInt32(BookID[6].Trim());
            int location_id  = Convert.ToInt32(BookID[7].Trim());


            int id_g = 0;

            Books       b  = new Books(id_b, selectedBook, summary, year, lost, genre_id);
            Book_Genres bg = new Book_Genres(id_b, id_g);

            dbc.DeleteBooksGenres(bg);

            Book_Authors ba = new Book_Authors(id_b, id_g);

            dbc.DeleteBooksAuthors(ba);

            dbc.DeleteBooks(b);
            bookslistBox.Items.Clear();
            OutputBooks();
        }