コード例 #1
0
ファイル: MssqlBookContext.cs プロジェクト: JesseBoogaard/OBC
        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);
        }
コード例 #2
0
ファイル: MssqlBookContext.cs プロジェクト: JesseBoogaard/OBC
        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);
        }
コード例 #3
0
ファイル: MssqlBookContext.cs プロジェクト: JesseBoogaard/OBC
        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);
        }