Beispiel #1
0
        public void UpdateBooks()
        {
            UserBookDataAccess   userBookDataAccess   = new UserBookDataAccess();
            UserFriendDataAccess userFriendDataAccess = new UserFriendDataAccess();
            int wantBookCount = userBookDataAccess.GetUserReadorWantCountBook(App.UserEmail, ReadWantEnum.Want);
            int readBookCount = userBookDataAccess.GetUserReadorWantCountBook(App.UserEmail, ReadWantEnum.Read);
            int friendsCount  = userFriendDataAccess.CountFriends(App.UserEmail);

            wantLabel.Text    = wantBookCount.ToString();
            readLabel.Text    = readBookCount.ToString();
            FriendsLabel.Text = friendsCount.ToString();

            if (wantBookCount == 0 && readBookCount == 0)
            {
                GridStacklayout.IsVisible   = false;
                NoBookStacklayout.IsVisible = true;
            }
            else
            {
                GridStacklayout.IsVisible   = true;
                NoBookStacklayout.IsVisible = false;
                wantGrid.Children.Clear();
                readGrid.Children.Clear();
                for (int a = wantGrid.RowDefinitions.Count - 1; a > 0; a--)
                {
                    wantGrid.RowDefinitions.RemoveAt(a);
                }
                for (int a = readGrid.RowDefinitions.Count - 1; a > 0; a--)
                {
                    readGrid.RowDefinitions.RemoveAt(a);
                }
                GetAllBooksToProfilePage(wantGrid, ReadWantEnum.Want);
                GetAllBooksToProfilePage(readGrid, ReadWantEnum.Read);
            }
        }
Beispiel #2
0
        public ProfilePage()
        {
            InitializeComponent();
            UserDataAccess       userDataAccess       = new UserDataAccess();
            UserFriendDataAccess userFriendDataAccess = new UserFriendDataAccess();
            UserBookDataAccess   userBookDataAccess   = new UserBookDataAccess();
            User userClass = userDataAccess.GetUserByEmail(App.UserEmail);

            userName.Text = userClass.UserName;
            int wantBookCount = userBookDataAccess.GetUserReadorWantCountBook(App.UserEmail, ReadWantEnum.Want);
            int readBookCount = userBookDataAccess.GetUserReadorWantCountBook(App.UserEmail, ReadWantEnum.Read);
            int friendsCount  = userFriendDataAccess.CountFriends(App.UserEmail);

            wantLabel.Text    = wantBookCount.ToString();
            readLabel.Text    = readBookCount.ToString();
            FriendsLabel.Text = friendsCount.ToString();

            if (userClass.UserPhoto != "" && userClass.UserPhoto != null)
            {
                if (userClass.UserPhoto.StartsWith("File"))
                {
                    ProfilePhotoImage.Source = userClass.UserPhoto.Replace("File: ", "");
                }
                else
                {
                    ProfilePhotoImage.Source = userClass.UserPhoto.Replace("Uri: ", "");
                }
            }

            wantGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            wantGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            readGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            readGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            if (wantBookCount == 0 && readBookCount == 0)
            {
                GridStacklayout.IsVisible   = false;
                NoBookStacklayout.IsVisible = true;
            }
            else
            {
                GridStacklayout.IsVisible   = true;
                NoBookStacklayout.IsVisible = false;
                GetAllBooksToProfilePage(wantGrid, ReadWantEnum.Want);
                GetAllBooksToProfilePage(readGrid, ReadWantEnum.Read);
            }
        }