public int logIN(string username, string password) { try { int result = 0; string query = "select * from tbl_Librarian where username = '******';"; Classes.Database db = new Classes.Database(); DataTable tbl = db.retriveData(query); foreach (DataRow row in tbl.Rows) { if (row["libpassword"].ToString() == password) { if (row["libtype"].ToString() == "Admin ") { result = 1; } else { result = 2; } } } return(result); } catch (Exception ex) { throw ex; } }
public DataTable fill_book(int mem, int book) { dt = new Classes.Database(); string query = "SELECT * FROM tbl_Borrow WHERE mem_id =" + mem + "AND book_id = " + book + ";"; return(dt.retriveData(query)); }
public DataTable searchmem(int memid) { string query = @"select * from tbl_Member where mem_ID = " + memid; try { dt = new Classes.Database(); return(dt.retriveData(query)); } catch (Exception ex) { throw ex; } }
public DataTable findb_book(int mem) { try { // Db Connection dt = new Classes.Database(); string query = "SELECT tbl_borrow.book_id,book_name,fine_day FROM tbl_Borrow,tbl_Books WHERE mem_id =" + mem + " AND pending= 'YES' AND tbl_borrow.book_id = tbl_Books.book_ID;"; return(dt.retriveData(query)); } catch (Exception ex) { throw ex; } }
public DataTable searchLibrarian(string keywords) { Classes.Database dt = new Classes.Database(); string query = @"SELECT * From tbl_Librarian WHERE libFirstName = '" + keywords + "' OR libFirstName LIKE '%" + keywords + "%' " + "libLastName = '" + keywords + "' OR libLastName LIKE '%" + keywords + "%' ;"; try { dt = new Classes.Database(); return(dt.retriveData(query)); } catch (Exception ex) { throw ex; } }
public DataTable searchbk(int bkid) { string query = @"select * from tbl_Books where book_ID = " + bkid; // query to select by book id try { dt = new Classes.Database(); return(dt.retriveData(query)); // return the data as a data table } catch (Exception ex) { throw ex; } }
public DataTable bookSearch(string choice, string keywords) { //string query = "SELECT * From tbl_Books WHERE @combo = '@input' OR @combo like '%@input%' "; string query = @"SELECT book_name AS Name, auther AS Auther, genre AS Genre, bklocation AS Location, bkstatus AS Status" + " From tbl_Books WHERE " + choice + " = '" + keywords + "'" + "OR " + choice + " LIKE '%" + keywords + "%';"; // Query to get Book List When the user search for the Book try { dt = new Classes.Database(); return(dt.retriveData(query)); // Return the List of Books as a Data Table according to the keywords and by book name or auther } catch (Exception ex) { throw ex; } }
private Boolean pending_yes(int memid) { try { dt = new Classes.Database(); string query = "SELECT * FROM tbl_Borrow WHERE mem_id =" + memid + "AND pending = 'YES';"; Boolean pending; DataTable tbl = dt.retriveData(query); if (tbl.Rows.Count >= 2) { pending = true; } else { pending = false; } return(pending); } catch (Exception) { throw; } }
private Boolean alredy_borrowed(int bookid) { string query = @"select * from tbl_Books where book_ID = " + bookid + " AND bkstatus ='Unavailable'"; try { dt = new Classes.Database(); Boolean borrowed; DataTable tbl = dt.retriveData(query); if (tbl.Rows.Count == 1) { borrowed = true; } else { borrowed = false; } return(borrowed); } catch (Exception ex) { throw ex; } }