Пример #1
0
        public string GetStatisticsMessage(List <bool> i_AlbumsFilters, List <bool> i_EventsFilters, List <bool> i_PostsFilters)
        {
            StringBuilder stillCalculatingSomeStatistics = new StringBuilder();
            StringBuilder statistics = new StringBuilder();

            if (isAtLeastOneFilterChecked(i_AlbumsFilters))
            {
                if (AlbumsStatistics.IsAlbumsStatsiticsCalculated)
                {
                    statistics.Append(AlbumsStatistics.GetAlbumsStatisticsString(i_AlbumsFilters));
                }
                else
                {
                    stillCalculatingSomeStatistics.Append("Still calculating albums statistics" + Environment.NewLine);
                }
            }

            if (isAtLeastOneFilterChecked(i_EventsFilters))
            {
                if (EventsStatistics.IsEventsStatsiticsCalculated)
                {
                    statistics.Append(EventsStatistics.GetEventsStatisticsString(i_EventsFilters));
                }
                else
                {
                    stillCalculatingSomeStatistics.Append("Still calculating events statistics" + Environment.NewLine);
                }
            }

            if (isAtLeastOneFilterChecked(i_PostsFilters))
            {
                if (PostsStatistics.IsPostsStatsiticsCalculated)
                {
                    statistics.Append(PostsStatistics.GetPostsStatisticsString(i_PostsFilters));
                }
                else
                {
                    stillCalculatingSomeStatistics.Append("Still calculating Posts statistics" + Environment.NewLine);
                }
            }

            if (stillCalculatingSomeStatistics.Length != 0)
            {
                stillCalculatingSomeStatistics.Append("Please wait...");
                throw new Exception(stillCalculatingSomeStatistics.ToString());
            }

            return(statistics.ToString());
        }