Ejemplo n.º 1
0
        private void bookList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                string id        = bookList.Rows[e.RowIndex].Cells["ID"].Value.ToString();
                bool   available = bool.Parse(bookList.Rows[e.RowIndex].Cells["availablebool"].Value.ToString());
                if (!available)
                {
                    MessageBox.Show("Sorry. This book is not available");
                    return;
                }
                BookControl bc = new BookControl();
                bc.borrowBook(int.Parse(id), LoginInfo.LoggedInId);
                MessageBox.Show(bc.Message);
                loadData();
            }
        }