Exemple #1
0
        void fillStatistics(UserSearchDTO user)
        {
            List <StatisticItemViewModel> items = new List <StatisticItemViewModel>();

            if (user.Statistics != null)
            {
                addStatistic(items, string.Format(Strings.UserStatistics_TrainingDaysCountText, user.Statistics.TrainingDaysCount), Achievements.GetTrainingDaysCount(user), Achievements.GetTrainingDaysInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_WorkoutPlansText, user.Statistics.WorkoutPlansCount), Achievements.GetWorkoutPlansCount(user), Achievements.GetWorkoutPlansInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_SupplementsDefinitionsText, user.Statistics.WorkoutPlansCount), Achievements.GetSupplementsDefinitionsCount(user), Achievements.GetSupplementsDefinitionsInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_FriendsCountText, user.Statistics.FriendsCount), Achievements.GetFriendsCount(user), Achievements.GetFriendsInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_FollowersCountText, user.Statistics.FollowersCount), Achievements.GetFollowersCount(user), Achievements.GetFollowersInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_VotesCountText, user.Statistics.VotingsCount), Achievements.GetVotingsCount(user), Achievements.GetVotingsInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_BlogCommentsCountText, user.Statistics.TrainingDayCommentsCount), Achievements.GetTrainingDayCommentsCount(user), Achievements.GetBlogCommentsInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_MyBlogCommentsCount, user.Statistics.MyTrainingDayCommentsCount), Achievements.GetMyTrainingDayCommentsCount(user), Achievements.GetMyBlogCommentsInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_StrengthTrainingEntriesCount, user.Statistics.StrengthTrainingEntriesCount), Achievements.GetStrengthTrainingEntriesCount(user), Achievements.GetStrengthTrainingEntriesInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_SizeEntriesCount, user.Statistics.SizeEntriesCount), Achievements.GetSizeEntriesCount(user), Achievements.GetSizeEntriesInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_SupplementsEntriesCount, user.Statistics.SupplementEntriesCount), Achievements.GetSupplementsEntriesCount(user), Achievements.GetSupplementEntriesInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_BlogEntriesCount, user.Statistics.BlogEntriesCount), Achievements.GetBlogEntriesCount(user), Achievements.GetBlogEntriesInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_A6WEntriesCount, user.Statistics.A6WEntriesCount), Achievements.GetA6WEntriesCount(user), Achievements.GetA6WEntriesInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_A6WFullCyclesCount, user.Statistics.A6WFullCyclesCount), Achievements.GetA6WFullCyclesCount(user), Achievements.GetA6WFullCyclesInfo());
                if (user.IsMe() || UserContext.Current.ProfileInformation.Licence.CurrentAccountType == AccountType.Administrator)
                {//show last login date only when we view another user. We user ToCalendar to hide a time of login - we show only the date
                    addStatistic(items, string.Format(Strings.UserStatistics_LastEntryDate, user.Statistics.LastEntryDate != null ? user.Statistics.LastEntryDate.Value.ToCalendarDate() : string.Empty));
                    //lvStatistics.Items.Add(string.Format(Strings.UserStatistics_LastLoginDate, user.Statistics.LastLoginDate != null ? user.Statistics.LastLoginDate.Value.ToCalendarDate() : string.Empty));
                }
                //lvStatistics.Items.Add(string.Format(Strings.UserStatistics_LastEntryDate, user.Statistics.LastEntryDate != null ? user.Statistics.LastEntryDate.Value.ToCalendarDate() : string.Empty));
                //addStatistic(items, string.Format(Strings.UserStatistics_LastEntryDate, user.Statistics.LastEntryDate != null ? user.Statistics.LastEntryDate.Value.ToCalendarDate() : string.Empty));
            }
            lvStatistics.ItemsSource = items;
        }
Exemple #2
0
 void fillStatistics(UserSearchDTO user)
 {
     lvStatistics.Items.Clear();
     if (user.Statistics != null)
     {
         addStatistic(string.Format(ApplicationStrings.UserStatistics_TrainingDaysCountText, user.Statistics.TrainingDaysCount), Achievements.GetTrainingDaysCount(user), Achievements.GetTrainingDaysInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_WorkoutPlansText, user.Statistics.WorkoutPlansCount), Achievements.GetWorkoutPlansCount(user), Achievements.GetWorkoutPlansInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_FriendsCountText, user.Statistics.FriendsCount), Achievements.GetFriendsCount(user), Achievements.GetFriendsInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_FollowersCountText, user.Statistics.FollowersCount), Achievements.GetFollowersCount(user), Achievements.GetFollowersInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_VotesCountText, user.Statistics.VotingsCount), Achievements.GetVotingsCount(user), Achievements.GetVotingsInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_BlogCommentsCountText, user.Statistics.BlogCommentsCount), Achievements.GetBlogCommentsCount(user), Achievements.GetBlogCommentsInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_MyBlogCommentsCount, user.Statistics.MyBlogCommentsCount), Achievements.GetMyBlogCommentsCount(user), Achievements.GetMyBlogCommentsInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_StrengthTrainingEntriesCount, user.Statistics.StrengthTrainingEntriesCount), Achievements.GetStrengthTrainingEntriesCount(user), Achievements.GetStrengthTrainingEntriesInfo());
         addStatistic(string.Format(DomainModelStrings.UserStatistics_SizeEntriesCount, user.Statistics.SizeEntriesCount), Achievements.GetSizeEntriesCount(user), Achievements.GetSizeEntriesInfo());
         addStatistic(string.Format(DomainModelStrings.UserStatistics_SupplementsEntriesCount, user.Statistics.SupplementEntriesCount), Achievements.GetSupplementsEntriesCount(user), Achievements.GetSupplementEntriesInfo());
         addStatistic(string.Format(DomainModelStrings.UserStatistics_BlogEntriesCount, user.Statistics.BlogEntriesCount), Achievements.GetBlogEntriesCount(user), Achievements.GetBlogEntriesInfo());
         addStatistic(string.Format(DomainModelStrings.UserStatistics_A6WEntriesCount, user.Statistics.A6WEntriesCount), Achievements.GetA6WEntriesCount(user), Achievements.GetA6WEntriesInfo());
         addStatistic(string.Format(DomainModelStrings.UserStatistics_A6WFullCyclesCount, user.Statistics.A6WFullCyclesCount), Achievements.GetA6WFullCyclesCount(user), Achievements.GetA6WFullCyclesInfo());
         if (!user.IsMe() && UserContext.CurrentProfile.Role == Role.Administrator)
         {//show last login date only when we view another user. We user ToCalendar to hide a time of login - we show only the date
             lvStatistics.Items.Add(string.Format(DomainModelStrings.UserStatistics_LastLoginDate, user.Statistics.LastLoginDate != null? user.Statistics.LastLoginDate.Value.ToCalendarDate(): string.Empty));
         }
         lvStatistics.Items.Add(string.Format(DomainModelStrings.UserStatistics_LastEntryDate, user.Statistics.LastEntryDate != null? user.Statistics.LastEntryDate.Value.ToCalendarDate(): string.Empty));
     }
 }
Exemple #3
0
        public void Fill(ProfileInformationDTO user, bool isActive)
        {
            this.user = user;
            if (user != null)
            {
                mainGrid.Visibility = Visibility.Visible;
                profileListEntry.Fill(user.User);
                NavigationService.SetText(txtAbout, user.AboutInformation);

                fillProfileStatus(user);

                if (user.User.IsMe())
                {
                    btnInvitationsCountStatus.Content = string.Format(Strings.usrUserInfo_InvitationsCount, user.Invitations.Count);

                    if (UserContext.Current.SessionData.LastLoginDate.HasValue)
                    {
                        lblLastLoggedTime.Text = string.Format(Strings.usrUserInfo_LastLogin, UserContext.Current.SessionData.LastLoginDate.Value.ToLocalTime().ToRelativeDate());
                    }
                    fillMessagesStatus();
                    btnInvitationsCountStatus.SetVisible(user.Invitations.Count > 0);
                    lblLastLoggedTime.SetVisible(user.LastLogin.HasValue);
                    lblProfileNotActivated.SetVisible(!user.IsActivated);
                    btnAccountType.Content = EnumLocalizer.Default.Translate(UserContext.Current.ProfileInformation.Licence.CurrentAccountType);
                    tbPoints.Text          = UserContext.Current.ProfileInformation.Licence.BAPoints.ToString();

//                    bool profileConfWizard = UserContext.Current.Settings.GetProfileConfigurationWizardShowed(UserContext.Current.CurrentProfile.GlobalId);
//#if RELEASE
//                    profileConfWizard=true;
//#endif
//                    btnProfileConfigurationWizard.SetVisible(!profileConfWizard);
                }
                grAccountType.SetVisible(User.IsMe());
                grInfo.SetVisible(User.IsMe());
                //grStatus.Collapse(User.IsMe());
                Grid.SetRowSpan(grStatistics, User.IsMe()?1:2);
                lblLastLoggedTime.SetVisible(User.IsMe() && UserContext.Current.SessionData.LastLoginDate.HasValue);
                fillStatistics(User);
                fillAwards(User);
                grAbout.SetVisible(!User.IsMe() && !string.IsNullOrEmpty(user.AboutInformation));
                rowAbout.Collapse(!User.IsMe() && !string.IsNullOrEmpty(user.AboutInformation));
            }
            else
            {
                ClearscrollViewer();
            }
        }