示例#1
0
        private void btnreturn_Click(object sender, EventArgs e)
        {
            Book myBook = (Book)lstbooks.SelectedItem;

            myBook.copies++;
            BookFile.SaveBook(myBook, cwid, "edit");
            LoadList();
        }
示例#2
0
        private void btndelete_Click(object sender, EventArgs e)
        {
            Book         myBook       = (Book)lstbooks.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
文件: frmedit.cs 项目: gpkeylor/pa6
        private void btnsave_Click(object sender, EventArgs e)
        {
            myBook.title  = txttitledata.Text;
            myBook.author = txtauthordata.Text;
            myBook.genre  = txtgenredata.Text;
            myBook.copies = int.Parse(txtcopiesavailabledata.Text);
            myBook.isbn   = txtISBNdata.Text;
            myBook.length = int.Parse(txtlengthdata.Text);
            myBook.cover  = txtcoverdata.Text;
            myBook.cwid   = cwid;

            BookFile.SaveBook(myBook, cwid, mode);
            MessageBox.Show("Content was saved.", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
示例#4
0
 private void LoadList()
 {
     myBooks             = BookFile.GetAllBooks(cwid);
     lstbooks.DataSource = myBooks;
 }