Ejemplo n.º 1
0
 //AccountInterface accountInterface;
 public SharedController(GameInterface iGame, CharacterInterface iChar, RestrictionsInterface iRest, EventInterface iEvent)
 {
     gameInterface = iGame;
     charInterface = iChar;
     restrictionsInterface = iRest;
     eventInterface = iEvent;
 }
Ejemplo n.º 2
0
 public EventsController(EventInterface iEvent, GameInterface iGame, CharacterInterface iChar, AccountInterface iAcct)
 {
     eventInterface = iEvent;
     charInterface = iChar;
     gameInterface = iGame;
     accountInterface = iAcct;
 }
Ejemplo n.º 3
0
        public bool IsCharacterInDemandForEvent(int eventID, int charID)
        {
            CharacterInterface charInterface = new CharacterInterface(LeetRaidsDB);
            MemCharacter memChar = charInterface.GetCharacterByID(charID);
            Event evt = GetEventInfoByID(eventID);
            //First of all is the character on the same server
            if (memChar.ServerID != evt.ServerID)
            {
                return false;
            }

            //OK, so does he belong to a role that isn't restricted
            Role[] roles = charInterface.GetRolesByCharacterID(charID).ToArray();
            int restrictedRoleCount = 0;
            foreach(Role r in roles)
            {
                if(IsRoleRestricted(eventID, r.RoleID)) {restrictedRoleCount++;}
            }
            if(restrictedRoleCount >= roles.Length) {return false;}

            //Is her part of a class that isnt restricted?
            //TODO: Add Class Restriction

            return true;
        }
Ejemplo n.º 4
0
        public IEnumerable<Role> GetRestrictedRolesThatAreFull(int eventID)
        {
            CharacterInterface charinterface = new CharacterInterface(LeetRaidsDB);

            Event evtInfo = GetEventInfoByID(eventID);

            List<RoleCount> roles = (from r in LeetRaidsDB.Roles
                                  where r.GameID == evtInfo.GameID
                                     select new RoleCount() { RoleID = r.RoleID, Count = 0 }).ToList(); ;

            foreach (RoleCount r in roles)
            {
                r.Count = GetAllEventAttendees(eventID).Where(attn => attn.RoleID == r.RoleID).ToList().Count;
            }

            IEnumerable<Role> restrictedRoles = from roleRestr in GetRoleRestrictionsByEvent(eventID)
                                                where roleRestr.Quantity > 0 && roleRestr.Quantity <= roles.Where(r => r.RoleID == roleRestr.RoleID).SingleOrDefault().Count
                                                select charinterface.GetRoleByID(roleRestr.RoleID);
            return restrictedRoles;
        }
Ejemplo n.º 5
0
        public IEnumerable<Role> GetRestrictedRoles(int eventID)
        {
            CharacterInterface charinterface = new CharacterInterface(LeetRaidsDB);
            IEnumerable<Role> restrictedRoles = from roleRestr in GetRoleRestrictionsByEvent(eventID)
                                                select charinterface.GetRoleByID(roleRestr.RoleID);

            return restrictedRoles;
        }
Ejemplo n.º 6
0
        public MemCharacter GetEventCreatorsCharacter(int memberID, int eventID)
        {
            MemCharacter memChar = null;
            EventAttendee attn = GetAllEventAttendees(eventID).Where(x => x.MemberID == memberID).SingleOrDefault();
            if (attn != null)
            {
                memChar = new CharacterInterface(LeetRaidsDB).GetCharacterByID(attn.CharacterID);
            }

            return memChar;
        }
Ejemplo n.º 7
0
        public List<string> AddNewEventAttendeesBulk(int[] charIDs, int eventID, int statusID)
        {
            List<string> charsNotAdded = new List<string>();
            Event eventInfo = GetEventInfoByID(eventID);
            List<EventAttendee> validCharactersAsAttendees = new List<EventAttendee>();

            CharacterInterface charInterface = new CharacterInterface(LeetRaidsDB);
            foreach (int charID in charIDs)
            {
                MemCharacter memChar = charInterface.GetCharacterByID(charID);
                //Does character belong to the right Game/Server AND isnt a current attendee
                if (memChar.GameID == eventInfo.GameID && memChar.ServerID == eventInfo.ServerID && !IsMemberAlreadyAttendee(eventID, memChar.MemberID))
                {
                    validCharactersAsAttendees.Add(
                    new EventAttendee()
                    {
                        CharacterID = memChar.CharacterID,
                        EventID = eventInfo.EventID,
                        MemberID = memChar.MemberID,
                        Note = null,
                        RoleID = null,
                        Status = statusID
                    });
                }
                else
                {
                    charsNotAdded.Add(memChar.CharacterName);
                }
            }

            if (validCharactersAsAttendees.Count > 0)
            {
                LeetRaidsDB.EventAttendees.InsertAllOnSubmit(validCharactersAsAttendees);
                LeetRaidsDB.SubmitChanges();
            }

            return charsNotAdded;
        }
Ejemplo n.º 8
0
 public CharacterController(CharacterInterface iChar, GameInterface iGame, EventInterface iEvent)
 {
     characterInterface = iChar;
     gameInterface = iGame;
     eventInterface = iEvent;
 }
Ejemplo n.º 9
0
 public AccountController(AccountInterface currentAccountInterface, GameInterface currentGameInterface, CharacterInterface currentCharInterface)
 {
     accountInterface = currentAccountInterface;
     gameInterface = currentGameInterface;
     charInterface = currentCharInterface;
 }
        public List<SearchCharacterResult> SearchCharactersWithEventRestricitons(int gameID, string name, int? classID, int? roleID, int? factionID, int? serverID, int? levelMin, int? levelMax, Event eventInfo)
        {
            CharacterInterface charInterface = new CharacterInterface(LeetRaidsDB);
            List<SearchCharacterResult> characters = charInterface.SearchCharacters(gameID, name, classID, roleID, factionID, serverID, levelMin, levelMax).ToList();

            return AddEventRestrictionsToCharacterInfo(characters, eventInfo);
        }
Ejemplo n.º 11
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;
        }