Пример #1
0
        /// <summary>
        /// Sends the user to the new form to add a new book
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddBook_Click(object sender, EventArgs e)
        {
            frmBook newBook = new frmBook();

            newBook.Show();
            this.Hide();
        }
Пример #2
0
        private void lblEditBook_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            String edit = "Edit";


            DialogResult dialogResult = MessageBox.Show("Would you like to edit the book information for the book " + dgvBooks.CurrentRow.Cells[1].Value.ToString() + "?", "Edit Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            //if they choose yes, refresh the form
            if (dialogResult == DialogResult.Yes)
            {
                Book editBook = new Book(Int32.Parse(dgvBooks.CurrentRow.Cells[0].Value.ToString()), dgvBooks.CurrentRow.Cells[1].Value.ToString(), dgvBooks.CurrentRow.Cells[2].Value.ToString(),
                                         dgvBooks.CurrentRow.Cells[3].Value.ToString(), Int32.Parse(dgvBooks.CurrentRow.Cells[4].Value.ToString()), Int32.Parse(dgvBooks.CurrentRow.Cells[5].Value.ToString()),
                                         dgvBooks.CurrentRow.Cells[6].Value.ToString(), dgvBooks.CurrentRow.Cells[7].Value.ToString(), "",
                                         Int32.Parse(dgvBooks.CurrentRow.Cells[8].Value.ToString()), Int32.Parse(dgvBooks.CurrentRow.Cells[9].Value.ToString()));

                this.Hide();
                frmBook frmBook = new frmBook(edit, editBook);
                frmBook.Show();
            }
        }