예제 #1
0
        protected void SaveUserBook(BookData b, int userID)
        {
            try
            {

                Database.InsertRecord("INSERT Book(AuthorId, AuthorName, BookTitle, ISBN13, ISBN10, PublisherName, SubjectIDs) VALUES (@AuthorId, @AuthorName, @BookTitle, @ISBN13, @ISBN10, @PublisherName, @SubjectIDs);",
                        new SqlParameter("@AuthorId", (b.data[0].author_data[0].id as string)),
                        new SqlParameter("@AuthorName", (b.data[0].author_data[0].name as string ?? string.Empty)),
                        new SqlParameter("@BookTitle", (b.data[0].title as string ?? string.Empty)),
                        new SqlParameter("@ISBN13", b.data[0].isbn13 as string),
                        new SqlParameter("@ISBN10", b.data[0].isbn10 as string),
                        new SqlParameter("@PublisherName", (b.data[0].publisher_name as string ?? string.Empty)),
                        new SqlParameter("@SubjectIDs", (b.data[0].subject_ids[0] as string ?? string.Empty)));
                
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            Database.InsertRecord("INSERT Collection(ISBN13, userID) VALUES (@ISBN13, @UserID);",
        new SqlParameter("@ISBN13", (b.data[0].isbn13 as string)),
        new SqlParameter("@UserID", userID));
            btnAddBook.Text = "Done!";
            btnAddBook.Enabled = false;
            hlSearch.Visible = true;
            hlCollection.Visible = true;
        }
예제 #2
0
        protected void CreateTable(string inIsbn)
        {
            bookData = IsbnApiClient.GetIsbnInfoForBook(inIsbn);
            //litBookSearchData.Text += "http://isbndb.com/api/v2/json/T3GGKVH2/books?q=science<br/><br/>";
            int searchIteration = 0;

            

            row = new TableRow();
            cell = new TableCell();
            //tRow = new TableRow();
            //tCell = new TableCell();
            //thcNumber = new TableHeaderCell();
            thcISBN10 = new TableHeaderCell();
            thcISBN13 = new TableHeaderCell();
            thcPublisher = new TableHeaderCell();
            thcTitle = new TableHeaderCell();
            thcAuthor = new TableHeaderCell();
            thcSummary = new TableHeaderCell();

            //thcNumber.Text = "#";
            thcISBN10.Text = "ISBN-10";
            thcISBN13.Text = "ISBN-13";
            thcPublisher.Text = "Publisher";
            thcTitle.Text = "Title";
            thcAuthor.Text = "Author";
            thcSummary.Text = "Summary";

            //row.Cells.Add(thcNumber);
            row.Cells.Add(thcISBN10);
            row.Cells.Add(thcISBN13);
            row.Cells.Add(thcPublisher);
            row.Cells.Add(thcTitle);
            row.Cells.Add(thcAuthor);
            row.Cells.Add(thcSummary);

            tblBook.Rows.Add(row);

            foreach (Datum b in bookData.data)

            {
                tRow = new TableRow();
                //lnkButton = new LinkButton();
                //tCell = new TableCell();
                isbnCell = new TableCell();
                isbn13Cell = new TableCell();
                publisherCell = new TableCell();
                titleCell = new TableCell();
                authorCell = new TableCell();
                summaryCell = new TableCell();
                collectionCell = new TableCell();

                //tCell.Text = searchIteration.ToString();
                isbnCell.Text = b.isbn10;
                isbn13Cell.Text = b.isbn13;
                publisherCell.Text = b.publisher_name;
                titleCell.Text = b.title;
                //authorCell.Text = "author";
                if (b.author_data.Count > 0)
                {
                    authorCell.Text = b.author_data[0].name;
                }
                else
                {
                    authorCell.Text = string.Empty;
                }

                summaryCell.Text = b.summary;
                
                //tRow.Cells.Add(tCell);
                tRow.Cells.Add(isbnCell);
                tRow.Cells.Add(isbn13Cell);
                tRow.Cells.Add(publisherCell);
                tRow.Cells.Add(titleCell);
                tRow.Cells.Add(authorCell);
                tRow.Cells.Add(summaryCell);
                tRow.Cells.Add(collectionCell);
                tblBook.Rows.Add(tRow);
                searchIteration++;
            }
        }
예제 #3
0
        protected void SaveBook(BookData b)
        {
            try
            {

            Database.InsertRecord("INSERT Book(AuthorId, AuthorName, BookTitle, ISBN13, ISBN10, PublisherName, SubjectIDs) VALUES (@AuthorId, @AuthorName, @BookTitle, @ISBN13, @ISBN10, @PublisherName, @SubjectIDs);",
                    new SqlParameter("@AuthorId", (b.data[0].author_data[0].id as string)),
                    new SqlParameter("@AuthorName", (b.data[0].author_data[0].name as string ?? string.Empty)),
                    new SqlParameter("@BookTitle", (b.data[0].title as string ?? string.Empty)),
                    new SqlParameter("@ISBN13", b.data[0].isbn13 as string),
                    new SqlParameter("@ISBN10", b.data[0].isbn10 as string),
                    new SqlParameter("@PublisherName", (b.data[0].publisher_name as string ?? string.Empty)),
                    new SqlParameter("@SubjectIDs", (b.data[0].subject_ids[0] as string ?? string.Empty)));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }