/*Problem 5. Simple Search for Books. */
 static void Main()
 {
     XmlDocument xmlDoc = new XmlDocument();
     xmlDoc.Load("..\\..\\test6.xml");
     string title = xmlDoc.GetChildText("/query/title");
     string author = xmlDoc.GetChildText("/query/author");
     string isbn = xmlDoc.GetChildText("/query/isbn");
     var books = BookstoreDAL.FindBooksByTitleAndAuthorAndISBN(title, author, isbn);
     if (books.Count > 0)
     {
         Console.WriteLine("{0} {1} found:", books.Count, books.Count != 1 ? "books":"book");
         foreach (var book in books)
         {
             Console.WriteLine("{0} --> {1} {2}", book.Key, book.Value == 0 ? "no" : book.Value.ToString(), book.Value != 1 ? "reviews" : "review");
         }
     }
     else
     {
         Console.WriteLine("Nothing found");
     }
 }
Exemplo n.º 2
0
 public static void Main(string[] args)
 {
     XmlDocument xmlDoc = new XmlDocument();
     xmlDoc.Load("../../simple-query.xml");
     string title = xmlDoc.GetChildText("/query/title");
     string author = xmlDoc.GetChildText("/query/author");
     string isbn = xmlDoc.GetChildText("/query/isbn");
     var books = BookstoreDAL.FindBooksByTitleAuthorAndIsbn(title, author, isbn);
     if (books.Count > 0)
     {
         Console.WriteLine("{0} books found:", books.Count);
         foreach (var book in books)
         {
             Console.WriteLine("{0} --> {1} reviews", book.Title, book.Reviews.Count);
         }
     }
     else
     {
         Console.WriteLine("Nothing found");
     }
 }
 static void Main()
 {
     XmlDocument xmlDoc = new XmlDocument();
     xmlDoc.Load("../../simple-query.xml");
     string authorname = xmlDoc.GetChildText("/query/author");
     string title = xmlDoc.GetChildText("/query/title");
     string isbn = xmlDoc.GetChildText("/query/isbn");
     var books =
         BookstoreDAL.FindBookByTitleAuthorOrISBN(authorname, title, isbn);
     if (books.Count > 0)
     {
         foreach (var book in books)
         {
             Console.WriteLine("{0} books found:");
             Console.WriteLine("{0} --> ", book.Title);
         }
     }
     else
     {
         Console.WriteLine("Nothing found");
     }
 }
Exemplo n.º 4
0
        public static void FindBooks(string filePath)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(filePath);

            string title = xmlDoc.GetChildText("query/title");
            string authorName = xmlDoc.GetChildText("query/author");
            string isbn = xmlDoc.GetChildText("query/isbn");

            List<Book> books = BookstoreDAL.FindBooksByTitleAuthorIsbn(title, authorName, isbn);
            if (books.Count > 0)
            {
                Console.WriteLine("{0} books found:", books.Count());
                foreach (Book book in books)
                {
                    Console.WriteLine(book.Title);
                }
            }
            else
            {
                Console.WriteLine("Nothing found");
            }
        }