예제 #1
0
        protected void btnCheck_Click(object sender, EventArgs e)
        {
            if (txtBorrowerNumber.Text != null)
            {
                int borrowNumber;
                if (DAO.checkInt(txtBorrowerNumber.Text) == false)
                {
                    lblError.Text = "Borrower number must be a integer!";
                    txtBorrowerNumber.Focus();
                    return;
                }
                borrowNumber = int.Parse(txtBorrowerNumber.Text);
                Borrower b = BorrowerDAO.GetBorrower(borrowNumber);
                if (b == null)
                {
                    lblError.Text = String.Format("Borrower number {0} does't exist!", txtBorrowerNumber.Text);
                    txtBorrowerNumber.Focus();
                    return;
                }


                txtName.Text = b.Name;
                //check borrowed >= 5 books
                if (BorrowDAO.GetBorrowedCopies(int.Parse(txtBorrowerNumber.Text)).Rows.Count >= 5)
                {
                    lblError.Text = "You borrowed 5 books, so you can't borrow any more!";
                    return;
                }

                ObjectDataSource1.FilterExpression = "borrowerNumber = " + txtBorrowerNumber.Text;
                GridView1.DataBind();
                displayButtons(2);
                /*ObjectDataSource1.DataBind();*/
            }
            else
            {
                lblError.Text = "Borrower number required!";
            }
        }
예제 #2
0
 public BorrowLogic()
 {
     borrowDAO = new BorrowDAO();
 }
예제 #3
0
 public int update(BorrowDTO borrow)
 {
     return(BorrowDAO.update(borrow));
 }
예제 #4
0
 public int delete(string borrowid)
 {
     return(BorrowDAO.delete(borrowid));
 }
예제 #5
0
 public int insert(BorrowDTO borrow)
 {
     return(BorrowDAO.insert(borrow));
 }
예제 #6
0
 public DataTable findWithBookID(String bookid)
 {
     return(BorrowDAO.findWithBookID(bookid));
 }
예제 #7
0
 public DataTable findWithReaderID(String readerid)
 {
     return(BorrowDAO.findWithReaderID(readerid));
 }
예제 #8
0
 public DataTable readAll()
 {
     return(BorrowDAO.readAll());
 }