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

            selectedAuthor = selectedAuthor.Trim();
            string[] AuthorID = selectedAuthor.Split('|');
            selectedAuthor = AuthorID[1].Trim();
            string surname    = AuthorID[2].Trim();
            string middlename = AuthorID[3].Trim();
            int    id_a       = Convert.ToInt32(AuthorID[0].Trim());

            selectedAuthor = authorsNameTextBox.Text;
            surname        = authorsSurnameTextBox.Text;
            middlename     = authorsMiddlenameTextBox.Text;
            MessageBox.Show(Convert.ToString(id_a));
            MessageBox.Show(selectedAuthor);
            MessageBox.Show(surname);
            MessageBox.Show(middlename);
            Authors aut = new Authors(id_a, selectedAuthor, surname);

            dbc.DeleteAuthors(aut);
            authorsListbox.Items.Clear();
            OutputAuthors();
        }