Esempio n. 1
0
        public IHttpActionResult GetUnCheckedList()
        {
            try
            {
                var request = new AuthRequest();
                if (!request.IsAdminLoggin)
                {
                    return(Unauthorized());
                }

                var unCheckedList          = new List <object>();
                var userCountListUnChecked = CheckManager.GetUserCountListUnChecked(request.AdminPermissions);

                if (userCountListUnChecked.Count > 0)
                {
                    var dict = new Dictionary <int, int>();

                    foreach (var pair in userCountListUnChecked)
                    {
                        var siteId = pair.Key;
                        var count  = pair.Value;
                        if (dict.ContainsKey(siteId))
                        {
                            dict[siteId] = dict[siteId] + count;
                        }
                        else
                        {
                            dict[siteId] = count;
                        }
                    }

                    foreach (var siteId in dict.Keys)
                    {
                        var count = dict[siteId];
                        if (!SiteManager.IsExists(siteId))
                        {
                            continue;
                        }

                        unCheckedList.Add(new
                        {
                            Url = PageContentSearch.GetRedirectUrlCheck(siteId),
                            SiteManager.GetSiteInfo(siteId).SiteName,
                            Count = count
                        });
                    }
                }

                return(Ok(new
                {
                    Value = unCheckedList
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
        public IHttpActionResult Main(string userName)
        {
            var request = new AuthRequest();

            if (!request.IsAdminLoggin)
            {
                return(Unauthorized());
            }

            var list          = new List <object>();
            var unCheckedList = CheckManager.GetUserCountListUnChecked(request.AdminPermissions);

            if (unCheckedList.Count <= 0)
            {
                return(Ok(list));
            }

            var dict = new Dictionary <int, int>();

            foreach (var pair in unCheckedList)
            {
                var siteId = pair.Key;
                var count  = pair.Value;
                if (dict.ContainsKey(siteId))
                {
                    dict[siteId] = dict[siteId] + count;
                }
                else
                {
                    dict[siteId] = count;
                }
            }

            foreach (var siteId in dict.Keys)
            {
                var count = dict[siteId];
                if (!SiteManager.IsExists(siteId))
                {
                    continue;
                }

                list.Add(new
                {
                    Url = PageContentSearch.GetRedirectUrlCheck(siteId),
                    SiteManager.GetSiteInfo(siteId).SiteName,
                    Count = count
                });
            }

            return(Ok(list));
        }
        public IHttpActionResult GetUnCheckedList()
        {
            try
            {
                var request = new AuthenticatedRequest();
                if (!request.IsAdminLoggin)
                {
                    return(Unauthorized());
                }

                var unCheckedList = new List <object>();

                if (request.AdminPermissionsImpl.IsConsoleAdministrator)
                {
                    foreach (var siteInfo in SiteManager.GetSiteInfoList())
                    {
                        var count = ContentManager.GetCount(siteInfo, false);
                        if (count > 0)
                        {
                            unCheckedList.Add(new
                            {
                                Url = PageContentSearch.GetRedirectUrlCheck(siteInfo.Id),
                                siteInfo.SiteName,
                                Count = count
                            });
                        }
                    }
                }
                else if (request.AdminPermissionsImpl.IsSystemAdministrator)
                {
                    foreach (var siteId in TranslateUtils.StringCollectionToIntList(request.AdminInfo.SiteIdCollection))
                    {
                        var siteInfo = SiteManager.GetSiteInfo(siteId);
                        if (siteInfo == null)
                        {
                            continue;
                        }

                        var count = ContentManager.GetCount(siteInfo, false);
                        if (count > 0)
                        {
                            unCheckedList.Add(new
                            {
                                Url = PageContentSearch.GetRedirectUrlCheck(siteInfo.Id),
                                siteInfo.SiteName,
                                Count = count
                            });
                        }
                    }
                }

                return(Ok(new
                {
                    Value = unCheckedList
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }