예제 #1
0
        public ViewResult InviteFriends(InviteModel model)
        {
            string selectedCharacters = Request["SelectedCharacter"];
            if (!String.IsNullOrEmpty(selectedCharacters))
            {
                int[] friendsToAdd = selectedCharacters.Split(new char[] { ',' }).Select(charID => Convert.ToInt32(charID)).ToArray();

                if (friendsToAdd.Length > 0)
                {
                    List<string> friendsNotAdded = eventInterface.AddNewEventAttendeesBulk(friendsToAdd, CurrentEvent.EventID, (int)ATTENDEE_STATUS.INVITED)
                                                   .Select(x => String.Format("Couldn't invite {0}, there was a conflict.", x)).ToList();

                    RegisterErrorsWithModel("friendInviteFailure", friendsNotAdded);

                    if (friendsNotAdded.Count < friendsToAdd.Length)
                    {
                        ViewData["FriendAddSuccessMsg"] = "<p><strong>Friends where successfully added</string></p>";
                    }
                }
            }

            //Rebind all this shit
            model.FriendsList = accountInterface.GetFriendsForMemberWithEventRestrictions(MemberInfo.MemberID, CurrentEvent);
            foreach (MemFriend friend in model.FriendsList)
            {
                friend.HighlightOnList = !friend.Restricted; //First evaluate is the character is restricted
                if (!friend.Restricted) //Second evaluate Role/Class/ETc.
                {
                    friend.HighlightOnList = eventInterface.IsCharacterInDemandForEvent(CurrentEvent.EventID, friend.FriendCharacterID);
                }
            }
            model.EventInfo = CurrentEvent;
            model.Event_GameName = gameInterface.GetGameByID(CurrentEvent.GameID).GameName;
            model.Event_ServerName = gameInterface.GetServer((int)CurrentEvent.ServerID).Name;
            model.EventRestritions = eventInterface.GetEventRestriction(CurrentEvent.EventID) ?? new EventRestriction(); //Return a new instance of restrictions beacuse every field should be null anyways
            return View("Invite", model);
        }
예제 #2
0
        public ViewResult Invite()
        {
            InviteModel model = new InviteModel();
            model.FriendsList = accountInterface.GetFriendsForMemberWithEventRestrictions(MemberInfo.MemberID, CurrentEvent);
            foreach (MemFriend friend in model.FriendsList)
            {
                friend.HighlightOnList = !friend.Restricted; //First evaluate is the character is restricted
                if (!friend.Restricted) //Second evaluate Role/Class/ETc.
                {
                    friend.HighlightOnList = eventInterface.IsCharacterInDemandForEvent(CurrentEvent.EventID, friend.FriendCharacterID);
                }
            }
            model.EventInfo = CurrentEvent;
            model.Event_GameName = gameInterface.GetGameByID(CurrentEvent.GameID).GameName;
            model.Event_ServerName = gameInterface.GetServer((int)CurrentEvent.ServerID).Name;
            model.EventRestritions = eventInterface.GetEventRestriction(CurrentEvent.EventID) ?? new EventRestriction(); //Return a new instance of restrictions beacuse every field should be null anyways

            return View(model);
        }