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!"; } }
public BorrowLogic() { borrowDAO = new BorrowDAO(); }
public int update(BorrowDTO borrow) { return(BorrowDAO.update(borrow)); }
public int delete(string borrowid) { return(BorrowDAO.delete(borrowid)); }
public int insert(BorrowDTO borrow) { return(BorrowDAO.insert(borrow)); }
public DataTable findWithBookID(String bookid) { return(BorrowDAO.findWithBookID(bookid)); }
public DataTable findWithReaderID(String readerid) { return(BorrowDAO.findWithReaderID(readerid)); }
public DataTable readAll() { return(BorrowDAO.readAll()); }