Esempio n. 1
0
        public IActionResult Index()
        {
            var stats = new AdminStats();

            stats.NumIssuedCertificates  = _certContext.PublicCertificates.Count();
            stats.NumRevokedCertificates = _certContext.PublicCertificates.Count(c => c.IsRevoked);
            stats.CurrentSerialNum       = _certContext.PublicCertificates
                                           .Select(c => c.SerialNr)
                                           .OrderByDescending(s => s)
                                           .FirstOrDefault();

            return(View(stats));
        }
Esempio n. 2
0
    public void ShowStats()
    {
        string              url   = Driver.GetServerUrl();
        AdminStats          stats = new AdminStats(url, Driver.GetCredentials(new Uri(url), null));
        AdminRepositoryInfo info  = stats.QueryRepositoryInformation();

        Console.WriteLine("Files:           " + info.FileCount);
        Console.WriteLine("Folders:         " + info.FolderCount);
        Console.WriteLine("Groups:          " + info.GroupCount);
        Console.WriteLine("Pending Changes: " + info.PendingChangeCount);
        Console.WriteLine("Shelvesets:      " + info.ShelvesetCount);
        Console.WriteLine("Users:           " + info.UserCount);
        Console.WriteLine("Workspaces:      " + info.WorkspaceCount);
    }
        public async Task <IActionResult> Index()
        {
            System.Collections.Generic.List <VendorOrders> Orders = await _context.VendorOrders.ToListAsync();

            System.Collections.Generic.List <Vendor> Vendors = await _context.Vendor.ToListAsync();

            System.Collections.Generic.List <Supplies> Supplies = await _context.Supplies.ToListAsync();

            System.Collections.Generic.List <Fee> Fees = await _context.Fee.ToListAsync();

            AdminStats admstats = new AdminStats
            {
                Totalorders   = Orders.Count(),
                TotalVendors  = Vendors.Count(),
                TotalFees     = Fees.Count(),
                Totalsupplies = Supplies.Count()
            };

            foreach (VendorOrders order in Orders)
            {
                if (order.Status.Equals("Placed"))
                {
                    admstats.OrdersPlaced++;
                }
                else if (order.Status.Equals("Received"))
                {
                    admstats.OrdersReceived++;
                }
                else if (order.Status.Equals("Shipped") && admstats.OrdersShipping.Count <= 5)
                {
                    admstats.OrdersShipping.Add(order);
                }
            }



            return(View(admstats));
        }
Esempio n. 4
0
        public AdminStatsResponse FetchAdminStats(string username, string password)
        {
            var resp = new AdminStatsResponse();

            try
            {
                Classes.Admin.Authorize(username, password);
            }
            catch (Exception err)
            {
                resp.Error = err.Message;
                return resp;
            }

            var stats = new AdminStats();
            Photo[] pendingPhotos = Config.CommunityFaceControlSystem.EnableCommunityFaceControl
                ? Photo.FetchNonApproved(true) : Photo.FetchNonApproved();
            stats.PendingPhotos = pendingPhotos != null ? pendingPhotos.Length : 0;
            ProfileAnswer[] pendingAnswers = ProfileAnswer.FetchNonApproved();
            stats.PendingAnswers = pendingAnswers != null ? pendingAnswers.Length : 0;
            resp.Stats = stats;
            return resp;
        }
        public List <AdminStats> AdminStatistics([FromBody] Analytics_Input analytics_Input)
        {
            //List < List < UserStats >> total_stats = new List<List<UserStats>>();

            List <AdminStats> admin_stats = new List <AdminStats>();

            GraphController use = new GraphController();

            Authorization auth = new Authorization(analytics_Input.extra);

            var result = auth.service.Data.Ga.Get("ga:" + analytics_Input.ga_id, analytics_Input.from_date, analytics_Input.to_date, analytics_Input.session + ",ga:newUsers");

            result.Dimensions = "ga:date, " + analytics_Input.country;
            result.Filters    = "ga:medium=@referral";
            try {
                var response = result.Execute();
                if (response.TotalResults != 0)
                {
                    foreach (var row in response.Rows)
                    {
                        AdminStats temp = new AdminStats()
                        {
                            date = new DateTime(), earning = 0.0, day = "", premium = 0, non_premium = 0, total_traffic = 0, total_earning = 0, country_stats = new List <CountryStats>()
                        };
                        // UserStats temp = user_stats.Last<UserStats>();


                        temp = admin_stats.FirstOrDefault(x => x.day == row[0]);

                        if (temp == null)
                        {
                            temp = new AdminStats()
                            {
                                date = new DateTime(), earning = 0.0, day = "", premium = 0, non_premium = 0, total_traffic = 0, total_earning = 0, country_stats = new List <CountryStats>()
                            };
                        }
                        if (!(temp.day.Equals(row[0])))
                        {
                            AdminStats stats = new AdminStats()
                            {
                                date = new DateTime(), earning = 0.0, day = "", premium = 0, non_premium = 0, total_traffic = 0, total_earning = 0, country_stats = new List <CountryStats>()
                            };

                            stats.day  = row[0];
                            stats.date = dateConverter(row[0]);
                            if (row[1].Equals("Canada"))
                            {
                                stats.premium += long.Parse(row[2]);
                                stats.earning += use.GetEarned(row[2], "premium");

                                stats.total_traffic += long.Parse(row[2]);
                            }
                            else
                            {
                                stats.non_premium   += long.Parse(row[2]);
                                stats.earning       += use.GetEarned(row[2], "non-premium");
                                stats.total_traffic += long.Parse(row[2]);
                            }

                            CountryStats cFind = new CountryStats()
                            {
                                country = row[1], sessions = "0", newSessions = "0"
                            };


                            cFind.sessions    = (Int64.Parse(cFind.sessions) + Int64.Parse(row[2])).ToString();
                            cFind.newSessions = (Int64.Parse(cFind.newSessions) + Int64.Parse(row[3])).ToString();
                            stats.country_stats.Add(cFind);
                            admin_stats.Add(stats);
                        }
                        else
                        {
                            admin_stats.Remove(temp);
                            CountryStats cTemp = new CountryStats();
                            if (row[1].Equals("Canada"))
                            {
                                temp.premium       += long.Parse(row[2]);
                                temp.earning       += use.GetEarned(row[2], "premium");
                                temp.total_traffic += long.Parse(row[2]);
                            }
                            else
                            {
                                temp.non_premium   += long.Parse(row[2]);
                                temp.earning       += use.GetEarned(row[2], "non-premium");
                                temp.total_traffic += long.Parse(row[2]);
                            }

                            CountryStats cFind = new CountryStats()
                            {
                                country = row[1], sessions = "0", newSessions = "0"
                            };

                            cFind.sessions    = (Int64.Parse(row[2])).ToString();
                            cFind.newSessions = (Int64.Parse(row[3])).ToString();
                            temp.country_stats.Add(cFind);
                            admin_stats.Add(temp);
                        }
                    }
                }
            }
            catch (Exception e)
            { }
            return(admin_stats);
        }