Пример #1
0
        private MicroserviceInformation GetFinesInformation(StatisticContext context)
        {
            var        FineStatistic = context.Statistics.Where(x => x.ServerName == ServerName.FINES).ToList();
            List <int> ArrayTime     = new List <int>(24);

            for (int i = 0; i < 24; i++)
            {
                ArrayTime.Add(0);
            }
            List <int> arrayType = new List <int>(3);

            for (int i = 0; i < 3; i++)
            {
                arrayType.Add(0);
            }

            foreach (var item in FineStatistic)
            {
                int num = (int)item.RequestType;
                if (num == 1)
                {
                    arrayType[0] += 1;
                }
                if (num == 2)
                {
                    arrayType[1]++;
                }
                if (num == 3)
                {
                    arrayType[2]++;
                }

                //string q = item.Detail.ToString();
                //string[] w = q.Split(' ');
                //if (w[0] == "PUT")
                //{
                //    arrayType[0] += 1;
                //}
                //if (w[0] == "POST")
                //{
                //    arrayType[1]++;
                //}
                //if (w[0] == "DELETE")
                //{
                //    arrayType[2]++;
                //}
                ArrayTime[item.Time.Value.Hour]++;
            }
            MicroserviceInformation Information = new MicroserviceInformation();

            Information.StatTime = ArrayTime;
            Information.StatType = arrayType;
            return(Information);
        }
Пример #2
0
        private MicroserviceInformation GetUsersInformation(StatisticContext context)
        {
            var        UserStatistic = context.Statistics.Where(x => x.ServerName == ServerName.USERS).ToList();
            List <int> ArrayTime     = new List <int>(24);

            for (int i = 0; i < 24; i++)
            {
                ArrayTime.Add(0);
            }
            List <int> arrayType = new List <int>(3);

            for (int i = 0; i < 3; i++)
            {
                arrayType.Add(0);
            }

            foreach (var item in UserStatistic)
            {
                int num = (int)item.RequestType;
                if (num == 1)
                {
                    arrayType[0] += 1;
                }
                if (num == 2)
                {
                    arrayType[1]++;
                }
                if (num == 3)
                {
                    arrayType[2]++;
                }

                ArrayTime[item.Time.Value.Hour]++;
            }
            MicroserviceInformation Information = new MicroserviceInformation();

            Information.StatTime = ArrayTime;
            Information.StatType = arrayType;
            return(Information);
        }