Exemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var addFrm = new AddBookForm();

            addFrm.AddBook      += AddFrm_AddBook;
            addFrm.stockkeeperid = stockkeeperid;
            this.Hide();
            addFrm.ShowDialog();
            this.Show();
        }
Exemplo n.º 2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (gvBooks.SelectedRows.Count > 0)
            {
                BookDTO book = new BookDTO();
                book.BookID        = (string)gvBooks.SelectedRows[0].Cells["masach"].Value;
                book.Title         = (string)gvBooks.SelectedRows[0].Cells["tensach"].Value;
                book.Author        = (string)gvBooks.SelectedRows[0].Cells["tacgia"].Value;
                book.PublishedYear = (string)(gvBooks.SelectedRows[0].Cells["nsx"].Value + "");
                book.Publisher     = (string)gvBooks.SelectedRows[0].Cells["nxb"].Value;
                book.Receipt       = (DateTime)gvBooks.SelectedRows[0].Cells["ngaynhap"].Value;
                book.Price         = float.Parse(gvBooks.SelectedRows[0].Cells["gia"].Value + "");
                book.StockkeeperID = (string)gvBooks.SelectedRows[0].Cells["nvtiepnhan"].Value;
                book.Type          = (int)gvBooks.SelectedRows[0].Cells["loai"].Value;

                var updateForm = new AddBookForm();
                updateForm.update        = true;
                updateForm.stockkeeperid = stockkeeperid;
                updateForm.book          = book;
                updateForm.UpdateBook   += UpdateForm_UpdateBook;

                updateForm.ShowDialog();
            }
        }