Exemple #1
0
        protected List <Moderator> GetModerators()
        {
            var moderators = this.Get <DataBroker>().GetAllModerators();

            var modsSorted = new List <Moderator>();

            foreach (var mod in moderators)
            {
                if (mod.IsGroup)
                {
                    continue;
                }

                var sortedMod = new Moderator
                {
                    Name        = mod.Name,
                    ModeratorID = mod.ModeratorID,
                    Email       = mod.Email,
                    Block       = new UserBlockFlags(mod.BlockFlags),
                    Avatar      = mod.Avatar,
                    AvatarImage = mod.AvatarImage,
                    DisplayName = mod.DisplayName,
                    Style       = mod.Style
                };

                // Check if Mod is already in modsSorted
                if (modsSorted.Find(s => s.Name.Equals(sortedMod.Name) && s.ModeratorID.Equals(sortedMod.ModeratorID))
                    != null)
                {
                    continue;
                }

                // Get All Items from that MOD
                var modList     = moderators.Where(m => m.Name.Equals(sortedMod.Name)).ToList();
                var forumsCount = modList.Count;

                sortedMod.ForumIDs = new ModeratorsForums[forumsCount];

                for (var i = 0; i < forumsCount; i++)
                {
                    var forumsId = new ModeratorsForums
                    {
                        ForumID = modList[i].ForumID, ForumName = modList[i].ForumName
                    };

                    sortedMod.ForumIDs[i] = forumsId;
                }

                modsSorted.Add(sortedMod);
            }

            return(modsSorted);
        }
Exemple #2
0
        protected List <SimpleModerator> GetModerators()
        {
            var moderators = this.Get <DataBroker>().GetAllModerators();

            var modsSorted = new List <SimpleModerator>();

            moderators.Where(m => !m.IsGroup).ForEach(
                mod =>
            {
                var sortedMod = mod;

                // Check if Mod is already in modsSorted
                if (modsSorted.Find(
                        s => s.Name.Equals(sortedMod.Name) && s.ModeratorID.Equals(sortedMod.ModeratorID)) != null)
                {
                    return;
                }

                // Get All Items from that MOD
                var modList     = moderators.Where(m => m.Name.Equals(sortedMod.Name)).ToList();
                var forumsCount = modList.Count;

                sortedMod.ForumIDs = new ModeratorsForums[forumsCount];

                for (var i = 0; i < forumsCount; i++)
                {
                    var forumsId = new ModeratorsForums
                    {
                        ForumID = modList[i].ForumID, ForumName = modList[i].ForumName
                    };

                    sortedMod.ForumIDs[i] = forumsId;
                }

                modsSorted.Add(sortedMod);
            });

            return(modsSorted);
        }
Exemple #3
0
        protected List<Moderator> GetModerators()
        {
            var moderators = this.Get<YafDbBroker>().GetAllModerators();

            var modsSorted = new List<Moderator>();

            foreach (SimpleModerator mod in moderators)
            {
                if (mod.IsGroup)
                {
                    continue;
                }

                var sortedMod = new Moderator
                    {
                        Name = mod.Name,
                        ModeratorID = mod.ModeratorID,
                        Email = mod.Email,
                        Avatar = mod.Avatar,
                        AvatarImage = mod.AvatarImage,
                        DisplayName = mod.DisplayName,
                        Style = mod.Style
                    };

                // Check if Mod is already in modsSorted
                if (modsSorted.Find(s => s.Name.Equals(sortedMod.Name) && s.ModeratorID.Equals(sortedMod.ModeratorID))
                    != null)
                {
                    continue;
                }

                // Get All Items from that MOD
                var modList = moderators.Where(m => m.Name.Equals(sortedMod.Name)).ToList();
                var forumsCount = modList.Count();

                sortedMod.ForumIDs = new ModeratorsForums[forumsCount];

                for (int i = 0; i < forumsCount; i++)
                {
                    var forumsId = new ModeratorsForums
                        { ForumID = modList[i].ForumID, ForumName = modList[i].ForumName };

                    sortedMod.ForumIDs[i] = forumsId;
                }

                modsSorted.Add(sortedMod);
            }

            return modsSorted;
        }