コード例 #1
0
        private void ButtonReturn_Click(object sender, EventArgs e)
        {
            Book myBook = (Book)listBooks.SelectedItem;

            myBook.copies++;
            BookFile.SaveBook(myBook, cwid, "edit");
            LoadList();
        }
コード例 #2
0
        private void ButtonDelete_Click(object sender, EventArgs e)
        {
            Book myBook = (Book)listBooks.SelectedItem;

            DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete?", "Delete", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                BookFile.DeleteBook(myBook, cwid);
                LoadList();
            }
        }
コード例 #3
0
ファイル: formEdit.cs プロジェクト: kjdrouin/fall2019-pa-6
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            myBook.title  = textTitle.Text;
            myBook.author = textAuthor.Text;
            myBook.genre  = textGenre.Text;
            myBook.copies = int.Parse(textCopies.Text);
            myBook.length = int.Parse(textLength.Text);
            myBook.isbn   = textISBN.Text;
            myBook.cover  = textCover.Text;
            myBook.cwid   = cwid;

            BookFile.SaveBook(myBook, cwid, mode);

            MessageBox.Show("Content Saved", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);

            this.Close();
        }
コード例 #4
0
 private void LoadList()
 {
     myBooks = BookFile.GetAllBooks(cwid);
     listBooks.DataSource = myBooks;
 }