예제 #1
0
        public void GetAllBooksToProfilePage(Grid grid, ReadWantEnum readWant)
        {
            //Console.WriteLine("UpdateBook: " + wantGrid.RowDefinitions.Count + " " + readGrid.RowDefinitions.Count);
            UserBookDataAccess userBookDataAccess = new UserBookDataAccess();
            BookDataAccess     bookDataAccess     = new BookDataAccess();
            List <String>      bookList           = userBookDataAccess.GetUserReadorWantBook(App.UserEmail, readWant);

            int column = 0;
            int row    = 0;

            for (int a = 0; a < bookList.Count; a++)
            {
                Book  bookClass = bookDataAccess.GetBookByName(bookList[a]);
                Image bookImage = new Image {
                    HeightRequest = 300, Source = bookClass.BookPhoto
                };
                var tapGestureRecognizer = new TapGestureRecognizer();
                tapGestureRecognizer.Tapped += (s, e) => {
                    ImageTapped(bookImage.Source.ToString().Replace("Uri: ", ""));
                };
                bookImage.GestureRecognizers.Add(tapGestureRecognizer);
                if (column == 0)
                {
                    if (row != 0)
                    {
                        Console.WriteLine("Added Line " + grid.ToString());
                        grid.RowDefinitions.Add(new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Star)
                        });
                    }
                    grid.Children.Add(bookImage, column, row);
                    column = 1;
                }
                else
                {
                    grid.Children.Add(bookImage, column, row);
                    column = 0;
                    row++;
                }
            }
        }
예제 #2
0
 public List <String> GetUserReadorWantBook(string Email, ReadWantEnum readWant)
 {
     return((from book in db.Table <UserBook>() where book.Email == Email && book.ReadWant == readWant orderby book.DateTime descending select book.BookName).ToList());
 }
예제 #3
0
        public int GetUserReadorWantCountBook(string Email, ReadWantEnum readWant)
        {
            List <UserBook> userBooks = (from book in db.Table <UserBook>() where book.Email == Email && book.ReadWant == readWant select book).ToList();

            return(userBooks.Count);
        }