public BookForPage GetBookForPage(int id) { BookForPage Book = new BookForPage(); sqlConnection = new SqlConnection(connectionString); sqlConnection.Open(); SqlCommand command = new SqlCommand("select * from [UserBook] INNER JOIN [Book] on [Book].ISBN = [UserBook].ISBN INNER JOIN [User] on [UserBook].[User] = [User].Login where [UserBook].[Id] = @id", sqlConnection); command.Parameters.AddWithValue("id", id); sqlReader = command.ExecuteReader(); sqlReader.Read(); Book.Title = Convert.ToString(sqlReader["Name"]); Book.Genre = Convert.ToString(sqlReader["Genre"]); Book.ImagePath = Convert.ToString(sqlReader["Image"]); Book.Description = Convert.ToString(sqlReader["Description"]); Book.User = Convert.ToString(sqlReader["User"]); Book.Email = Convert.ToString(sqlReader["Email"]); Book.Trade = Convert.ToString(sqlReader["Trade"]); Book.Authors = GetAuthorBook(Convert.ToString(sqlReader["ISBN"])); return(Book); }
public BookPage(int id) { InitializeComponent(); SQLBook SQLBook = new SQLBook(); BookForPage bookForPage = SQLBook.GetBookForPage(id); TitleTextBox.Text = bookForPage.Title; BookImage.Source = new BitmapImage(new Uri(bookForPage.ImagePath)); AuthorBlock.Text = bookForPage.Authors; GenreLable.Content += bookForPage.Genre; TredeBlock.Text = bookForPage.Trade; TredeBox.Text = bookForPage.Trade; DescriptionBlock.Text = bookForPage.Description; DescriptionBox.Text = bookForPage.Description; EmailLable.Content = bookForPage.Email; }
public BookPage(int id, string user) { InitializeComponent(); SQLBook SQLBook = new SQLBook(); BookForPage bookForPage = SQLBook.GetBookForPage(id); TitleTextBox.Text = bookForPage.Title; BookImage.Source = new BitmapImage(new Uri(bookForPage.ImagePath)); AuthorBlock.Text = bookForPage.Authors; GenreLable.Content += bookForPage.Genre; TredeBlock.Text = bookForPage.Trade; TredeBox.Text = bookForPage.Trade; DescriptionBlock.Text = bookForPage.Description; DescriptionBox.Text = bookForPage.Description; EmailLable.Content = bookForPage.Email; UserLable.Content = user; IdLable.Content = id; TredeBox.Visibility = Visibility.Visible; DescriptionBox.Visibility = Visibility.Visible; ButtonStack.Visibility = Visibility.Visible; }