Пример #1
0
        public StatisticResult ConvertToSingleSerie()
        {
            StatisticResult result = new StatisticResult();

            if (series.Count > 0)
            {
                result.series = new List <StatisticSerie>();
                result.series.Add(new StatisticSerie()
                {
                    Label = string.Empty
                });
                for (int i = 0; i < series.Count; i++)
                {
                    if (series[i].Values.Count > 0)
                    {
                        result.series[0].Values.Add(new StatisticValueStringInt()
                        {
                            X = series[i].Label, Y = ((StatisticValueDateTimeInt)series[i].Values[0]).Y
                        });
                    }
                }
            }

            return(result);
        }
Пример #2
0
        public static StatisticTotal GetObjectCountCommunityTotal(Guid?parentID, GroupBy groupBy)
        {
            StatisticTotal total = new StatisticTotal(parentID);

            if ((groupBy & GroupBy.None) == GroupBy.None)
            {
                StatisticResult result = GetObjectCountCommunityMembers(DateTime.Now.AddDays(-1).GetStartOfDay(), DateTime.Now, GroupBy.None, Granularity.None, parentID, null);
                result = result.ConvertToSingleSerie();
                total.Results.Add(result);
            }
            if ((groupBy & GroupBy.Sex) == GroupBy.Sex)
            {
                StatisticResult result = GetObjectCountCommunityMembers(DateTime.Now.AddDays(-1).GetStartOfDay(), DateTime.Now, GroupBy.Sex, Granularity.None, parentID, null);
                result = result.ConvertToSingleSerie();
                total.Results.Add(result);
            }
            if ((groupBy & GroupBy.Age) == GroupBy.Age)
            {
                StatisticResult result = GetObjectCountCommunityMembers(DateTime.Now.AddDays(-1).GetStartOfDay(), DateTime.Now, GroupBy.Age, Granularity.None, parentID, null);
                result = result.ConvertToSingleSerie();
                total.Results.Add(result);
            }
            if ((groupBy & GroupBy.Type) == GroupBy.Type)
            {
                total.Results.Add(GetObjectTotalCommunityObjects(parentID, null));
            }

            return(total);
        }