示例#1
0
        private void Dgvlist_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            BtnDelete.Visible = true;
            Btnupdate.Visible = true;

            int idbook = Convert.ToInt32(Dgvlist.Rows[e.RowIndex].Cells[0].Value);

            selectedbooks = _context.booksInfoes.Find(idbook);
            Txtbn.Text    = selectedbooks.books_name;
            Txtba.Text    = selectedbooks.books_author_name;
            Dtbp.Text     = (selectedbooks.books_publication_date).ToString();
            Txtbp.Text    = (selectedbooks.books_price).ToString();
            Txtbq.Text    = (selectedbooks.books_quantity).ToString();
        }
示例#2
0
        public void Add()
        {
            booksInfo bk = new booksInfo
            {
                books_name             = Txtbkname.Text,
                books_author_name      = Txtbkauthor.Text,
                books_publication_date = Txtbkpb.Value,
                books_price            = Convert.ToInt32(Txtbkprice.Text.ToString()),
                books_quantity         = Convert.ToInt32(Txtbkquantity.Text.ToString())
            };


            this._context.booksInfoes.Add(bk);
            this._context.SaveChanges();
            MessageBox.Show("Book added", MessageBoxButtons.OK.ToString());
        }