private void btnCopyAdd_Click(object sender, EventArgs e) { Button btn = (Button)sender; if (btn.Text == "Add") { if (!isCopySelected()) { return; } txtCopyBookNumber.Text = dataGridView1.SelectedRows[0].Cells["bookNumber"].Value.ToString(); c = new Copy(int.Parse(txtCopyBookNumber.Text), CopyDAO.GetBookNumberMax() + 1, CopyDAO.GetSequenceNumberMax() + 1, 'A', 0); displayCopy(); displayCopyButtons(2); } else { c.Price = double.Parse(txtPrice.Text); CopyDAO.Insert(c); ViewCopies(); displayCopyButtons(1); } }