예제 #1
0
        //adds a copy available back to the book you are returning
        private void btnReturn_Click(object sender, EventArgs e)
        {
            Book myBook = (Book)lstBooks.SelectedItem;

            //adds a copy
            myBook.copies++;

            //saves book
            BookFile.SaveBook(myBook, cwid, "edit");

            //reloads list and displays new data
            LoadList();
        }
예제 #2
0
        //updating objects and saving it to a database
        private void btnSave_Click(object sender, EventArgs e)
        {
            //updating object
            myBook.title  = txtTitleData.Text;
            myBook.author = txtAuthorData.Text;
            myBook.genre  = txtGenreData.Text;
            myBook.copies = int.Parse(txtCopiesData.Text);
            myBook.isbn   = txtIsbnData.Text;
            myBook.cover  = txtCoverData.Text;
            myBook.length = int.Parse(txtLengthData.Text);
            myBook.cwid   = cwid;

            //saving record to data base
            BookFile.SaveBook(myBook, cwid, mode);

            //message box letting them know the book has been saved
            MessageBox.Show("Content was saved.", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //close the edit form
            this.Close();
        }