public Book GetBookByID(int id) { string Query = "EXEC GetBookByID @BookID = @id"; List <KeyValuePair <string, string> > Params = new List <KeyValuePair <string, string> >(); Params.Add(new KeyValuePair <string, string>("id", id.ToString())); DataSet Result = this.ExecuteSQL(Query, Params); Book B = null; if (Result != null) { B = DataSetParser.DataSetToBook(Result, 0); } return(B); }
public List <Book> GetAllBooks() { string Query = "EXEC GetAllBooks"; List <KeyValuePair <string, string> > Params = new List <KeyValuePair <string, string> >(); DataSet Results = this.ExecuteSQL(Query, Params); List <Book> Books = new List <Book>(); if (Results != null) { for (int i = 0; i < Results.Tables[0].Rows.Count; i++) { Book b = DataSetParser.DataSetToBook(Results, i); Books.Add(b); } } return(Books); }
public List <Book> GetUserBacklog(int id) { string Query = "EXEC GetUserBacklog @UserId = @id"; List <KeyValuePair <string, string> > Params = new List <KeyValuePair <string, string> >(); Params.Add(new KeyValuePair <string, string>("id", id.ToString())); DataSet Results = this.ExecuteSQL(Query, Params); List <Book> Books = new List <Book>(); if (Results != null) { for (int i = 0; i < Results.Tables[0].Rows.Count; i++) { Book b = DataSetParser.DataSetToBook(Results, i); Books.Add(b); } } return(Books); }