public List<SearchCharacterResult> AddEventRestrictionsToCharacterInfo(List<SearchCharacterResult> characters, Event eventInfo)
        {
            RestrictionsInterface restrictionsInterface = new RestrictionsInterface(LeetRaidsDB);
            foreach (SearchCharacterResult c in characters)
            {
                c.Restriction = restrictionsInterface.EnforceEventRestrictionOnCharacter(eventInfo, c.CharacterInfo);
            }

            return characters;
        }
Exemplo n.º 2
0
        public List<MemFriend> GetFriendsForMemberWithEventRestrictions(int memberID, Event eventInfo)
        {
            CharacterInterface charInterface = new CharacterInterface(LeetRaidsDB);
            //EventInterface eventInterface = new EventInterface(LeetRaidsDB);

            List<MemFriend> friends = (from friend in LeetRaidsDB.MemFriends
                                                           where friend.MemberID == memberID
                                                           select friend).ToList();

            //Add in complete data
            foreach (MemFriend f in friends)
            {
                f.CompleteCharData = charInterface.GetCompleteCharacterByID(f.FriendCharacterID);
            }

            RestrictionsInterface restrictionInterface = new RestrictionsInterface(LeetRaidsDB);
            foreach (MemFriend friend in friends)
            {
                RestrictionReason restriction = restrictionInterface.EnforceEventRestrictionOnCharacter(eventInfo, friend.CompleteCharData);

                friend.Restricted = restriction.Restricted;
                friend.Reason = restriction.Restricted_Reason;
            }
                                       

            #region Old Filter which just removes user, doesn't say why

                                                           //select new MemFriendWithEventRestriction()
                                                           //{
                                                           //    MemberID = friend.MemberID,
                                                           //    AddDateTime = friend.AddDateTime,
                                                           //    FriendCharacterID = friend.FriendCharacterID,
                                                           //    HighlightOnList = false,
                                                           //    MemFriendsID = friend.MemFriendsID,
                                                           //    Note = friend.Note,
                                                           //}).ToList();
            //if (charFilter == null) { charFilter = new int[0]; }

            //List<MemFriend> friends = (from friend in LeetRaidsDB.MemFriends
            //                           join friendChar in LeetRaidsDB.MemCharacters on friend.FriendCharacterID equals friendChar.CharacterID
            //                           where friend.MemberID == memberID 
            //                           && friendChar.GameID == (gameIDFilter ?? friendChar.GameID)
            //                           && friendChar.ServerID == (serverIDFilter ?? friendChar.ServerID)
            //                           && !charFilter.Contains(friend.FriendCharacterID)
            //                           select friend).ToList();
            #endregion
            
            return friends;
        }