예제 #1
0
 public bool InsertBookAuthor(BookAuthor bookAuthor)
 {
     SqlParameter[] Params = new SqlParameter[]
     {
         new SqlParameter("@BookID", bookAuthor.BookID),
         new SqlParameter("@AuthorID", bookAuthor.AuthorID )
     };
     return DataProvider.ExecuteNonQuery("sp_InsertBook_Author", CommandType.StoredProcedure,
         Params);
 }
예제 #2
0
        public List<BookAuthor> GetBookAuthors(int BookID)
        {
            List<BookAuthor> bookAuthors = null;

            SqlParameter[] Params = { new SqlParameter("@BookID", BookID) };
            using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_ViewBookAuthors",
                CommandType.StoredProcedure, Params))
            {
                if (table.Rows.Count > 0)
                {
                    bookAuthors = new List<BookAuthor>();
                    foreach (DataRow row in table.Rows)
                    {
                        BookAuthor bookAuthor = new BookAuthor();
                        bookAuthor.BookID = Convert.ToInt32(row["BookID"]);
                        bookAuthor.AuthorID = Convert.ToInt32(row["AuthorID"]);
                        bookAuthors.Add(bookAuthor);
                    }
                }
            }
            return bookAuthors;
        }
예제 #3
0
 public bool DeleteBookAuthor(BookAuthor bookAuthor)
 {
     BookAuthorHandler myHandler = new BookAuthorHandler(); return myHandler.DeleteBookAuthor(bookAuthor);
 }
예제 #4
0
 public bool InsertBookAuthor(BookAuthor bookAuthor)
 {
     BookAuthorHandler myHandler = new BookAuthorHandler(); return myHandler.InsertBookAuthor(bookAuthor);
 }
예제 #5
0
        public BookAuthor TrailInsertBook(Book book)
        {
            BookAuthor bookAuthor = new BookAuthor();
            SqlParameter[] Params = new SqlParameter[]
            {
                new SqlParameter("@ProductID", book.ProductID),
                new SqlParameter("@BookTitle", book.BookTitle),
                new SqlParameter("@Synopsis", book.Synopsis),
                new SqlParameter("@ISBN", book.ISBN),
                new SqlParameter("@BookCategoryID", book.BookCategoryID),
                new SqlParameter("@PublisherID", book.PublisherID),
                new SqlParameter("@SupplierID", book.SupplierID),
                new SqlParameter("@CoverImage", book.CoverImage)
            };
            using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_Insert_Book", CommandType.StoredProcedure, Params))
            {

                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];
                    bookAuthor.BookID = Convert.ToInt32(row["BookID"]);
                }
            }
            return bookAuthor;
        }