Esempio n. 1
0
        public void loadData()
        {
            lbUser.Text = this.fullname;
            BookForUserData dao = new BookForUserData();

            dtAvailable = dao.GetAllBook();
            dvgAvailableBook.DataSource = null;
            dvgAvailableBook.DataSource = dtAvailable;
            listBorrowBook          = dao.GetBorrowBook(this.username);
            dvgBorrowing.DataSource = null;
            dvgBorrowing.DataSource = listBorrowBook;
            txtId.DataBindings.Clear();
            txtName.DataBindings.Clear();
            txtPrice.DataBindings.Clear();
            txtId.DataBindings.Add("Text", dtAvailable, "BookID");
            txtName.DataBindings.Add("Text", dtAvailable, "name");
            txtPrice.DataBindings.Add("Text", dtAvailable, "price");
        }
Esempio n. 2
0
        private void btnBorrow_Click(object sender, EventArgs e)
        {
            List <tempBook> list = this.getTempBook;
            BookForUserData dao  = new BookForUserData();

            foreach (tempBook item in list)
            {
                bool result = dao.isBorrowBook(item.bookID, this.username);
            }
            listBorrowBook              = dao.GetBorrowBook(this.username);
            dvgBorrowing.DataSource     = null;
            dvgBorrowing.DataSource     = listBorrowBook;
            selectedBook                = new List <tempBook>();
            dvgSelected.DataSource      = null;
            dvgSelected.DataSource      = selectedBook;
            dvgAvailableBook.DataSource = null;
            dvgAvailableBook.DataSource = dtAvailable;
        }
Esempio n. 3
0
        private void btnReturn_Click(object sender, EventArgs e)
        {
            string          bookId = dvgBorrowing.CurrentRow.Cells[0].Value.ToString();
            BookForUserData dao    = new BookForUserData();
            bool            result = dao.returnBook(this.username, bookId);

            if (result)
            {
                MessageBox.Show("Return Succesful!");
                dtAvailable = dao.GetAllBook();
                dvgAvailableBook.DataSource = null;
                dvgAvailableBook.DataSource = dtAvailable;
                listBorrowBook          = dao.GetBorrowBook(this.username);
                dvgBorrowing.DataSource = null;
                dvgBorrowing.DataSource = listBorrowBook;
            }
            else
            {
                MessageBox.Show("Fail!");
            }
        }
Esempio n. 4
0
        private void btnReturnAll_Click(object sender, EventArgs e)
        {
            bool            result = false;
            BookForUserData dao    = new BookForUserData();

            foreach (tempBook book in listBorrowBook)
            {
                result = dao.returnBook(this.username, book.bookID);
            }
            if (result)
            {
                MessageBox.Show("Return All Success!");
                dvgAvailableBook.DataSource = null;
                dvgAvailableBook.DataSource = dtAvailable;
                listBorrowBook          = dao.GetBorrowBook(this.username);
                dvgBorrowing.DataSource = null;
                dvgBorrowing.DataSource = listBorrowBook;
            }
            else
            {
                MessageBox.Show("Fail!");
            }
        }