Пример #1
0
        public void AddMember(Mobile m)
        {
            if (!Members.Contains(m))
            {
                if (m.Guild != null && m.Guild != this)
                {
                    ((Guild)m.Guild).RemoveMember(m);
                }

                Members.Add(m);
                m.Guild = this;

                EventSink.InvokeJoinGuild(new JoinGuildEventArgs(m, this));

                m.GuildFealty = null;

                if (m is PlayerMobile)
                {
                    ((PlayerMobile)m).GuildRank = RankDefinition.Lowest;
                }

                Guild guild = m.Guild as Guild;

                if (guild != null)
                {
                    guild.InvalidateWarNotoriety();
                }
            }
        }
        /// <summary>
        ///     Expands the distribution list into a set of user emails.
        /// </summary>
        private void TryExpandDistributionList(EmailAddress address)
        {
            if (Members == null)
            {
                Members = new ObservableCollection <string>();
            }

            if (address.MailboxType == MailboxType.PublicGroup)
            {
                var groupResults = Service.ExpandGroup(address);

                foreach (var email in groupResults)
                {
                    LoggingViewModel.Instance.Logger.Write(string.Concat("TryExpanDistributionList ", email));
                    TryExpandDistributionList(email);
                }
            }
            else
            {
                if (!Members.Contains(address.Address))
                {
                    Members.Add(address.Address);
                }
            }
        }
Пример #3
0
            private async Task RegisterOverridesAsync(IMethod method)
            {
                bool anyDef = false;

                lock (syncRoot)
                {
                    foreach (var baseMethod in method.BaseMethods)
                    {
                        if (Members.Contains(baseMethod))
                        {
                            // One of this method's base methods defines this method.
                            // Break now and just define the method.
                            anyDef = true;
                            break;
                        }

                        // Add this method to the override set of every base method. If
                        // and when the base method is defined, it will also define all
                        // methods in the override set.
                        HashSet <IMethod> overrideSet;
                        if (!overrides.TryGetValue(baseMethod, out overrideSet))
                        {
                            overrides[baseMethod] = overrideSet = new HashSet <IMethod>();
                        }
                        overrideSet.Add(method);
                    }
                }
                if (anyDef)
                {
                    await DefineAsync(method);
                }
            }
Пример #4
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var user = await _userManager.GetUserAsync(User);

            Group = await _context.Groups
                    .Include(m => m.BannerImg)
                    .FirstOrDefaultAsync(m => m.GroupId == id);

            Members = await _context.UserGroups
                      .Where(m => m.Group == Group)
                      .Select(m => m.User)
                      .ToListAsync();

            Files = await _context.Files
                    .Where(m => m.Group == Group)
                    .ToListAsync();

            if (Group == null)
            {
                return(NotFound());
            }

            UserInGroup = Members.Contains(user);

            UserIsAdmin = Group.Admin == user ? true : false;

            return(Page());
        }
Пример #5
0
        /// <summary>
        /// Tries to add the specified player to the party.
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public bool AddMember(IPlayerEntity player, bool isPartyLeader = false)
        {
            if (player.Party.IsInParty)
            {
                return(false);
            }

            if (Members.Contains(player))
            {
                return(false);
            }

            if (Members.Count == Members.Capacity)
            {
                return(false);
            }

            Members.Add(player);
            if (isPartyLeader)
            {
                PartyLeaderId = player.PlayerData.Id;
            }

            player.Party.Party = this;

            return(true);
        }
Пример #6
0
 /// <summary>
 /// Adds a new member to the group if it not already exists
 /// </summary>
 /// <param name="user">The new member</param>
 public void AddMember(ApplicationUser user)
 {
     if (!Members.Contains(user))
     {
         Members.Add(user);
     }
 }
Пример #7
0
 /// <summary>
 /// check if the given address exists in this cluster
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public bool IsMember(Address node)
 {
     if (Members.Contains(node) || _servers.Contains(node))
     {
         return(true);
     }
     return(false);
 }
Пример #8
0
        public void RemoveMember(Mobile mob)
        {
            PlayerState pl = PlayerState.Find(mob);

            if (pl == null || !Members.Contains(pl))
            {
                return;
            }

            if (mob.Backpack != null)
            {
                //Ordinarily, through normal faction removal, this will never find any sigils.
                //Only with a leave delay less than the ReturnPeriod or a Faction Kick/Ban, will this ever do anything
                Item[] sigils = mob.Backpack.FindItemsByType(typeof(Sigil));

                for (int i = 0; i < sigils.Length; ++i)
                {
                    ((Sigil)sigils[i]).ReturnHome();
                }
            }

            Members.Remove(pl);

            if (mob is PlayerMobile)
            {
                ((PlayerMobile)mob).FactionPlayerState = null;
            }

            mob.InvalidateProperties();
            mob.Delta(MobileDelta.Noto);

            if (Election.IsCandidate(mob))
            {
                Election.RemoveCandidate(mob);
            }

            Election.RemoveVoter(mob);

            if (pl.Finance != null)
            {
                pl.Finance.Finance = null;
            }

            if (pl.Sheriff != null)
            {
                pl.Sheriff.Sheriff = null;
            }

            if (Commander == mob)
            {
                Commander = null;
            }

            if (mob is PlayerMobile)
            {
                ((PlayerMobile)mob).ValidateEquipment();
            }
        }
Пример #9
0
 public void RemoveMember(Character character)
 {
     if (Members.Contains(character))
     {
         Members.Remove(character);
         character.Party = null;
         character.Client.Send(new PartyLeaveMessage((uint)this.Id));
     }
 }
Пример #10
0
 public void AddGuest(Character character)
 {
     if (!Guests.Contains(character) && !Members.Contains(character))
     {
         Guests.Add(character);
         character.GuestedParties.Add(this);
         SendMembers(new PartyNewGuestMessage((uint)this.Id, this.GetPartyGuestInformations(character)));
     }
 }
Пример #11
0
        public void AddMember(string member)
        {
            if (!Members.Contains(member))
            {
                Members.Add(member);
            }

            //member.JoinGroup(this);
            //update database
        }
Пример #12
0
 public bool AddMember(ApplicationUser user, ApplicationDbContext context)
 {
     if (Members.Contains(user))
     {
         return(false);
     }
     Members.Add(user);
     context.SaveChanges();
     return(true);
 }
Пример #13
0
            public void RemoveMember(ulong steamID)
            {
                if (!Members.Contains(steamID))
                {
                    return;
                }

                Members.Remove(steamID);
                Save();
            }
Пример #14
0
 public void AddMember(Member member)
 {
     if (Members.Contains(member))
     {
         throw new DomainException(OperationCodes.GroupMemberAlreadyExists,
                                   $"Group with id: '{Id}' already contains a member: '{member.UserId}'.");
     }
     _members.Add(member);
     UpdatedAt = DateTime.UtcNow;
 }
Пример #15
0
            public void AddMember(ulong steamID)
            {
                if (Members.Contains(steamID))
                {
                    return;
                }

                Members.Add(steamID);
                Save();
                AddMemberToTeamUI(BasePlayer.FindByID(steamID));
            }
Пример #16
0
        /// <summary>
        /// Add a member to the Sequence
        /// </summary>
        public BigInteger AddMember()
        {
            BigInteger n = GetNextMember();

            if (!Stable)
            {
                Stable = Members.Contains(n);
            }
            _members = Members.Concat(new BigInteger[] { n });
            return(LastMember);
        }
Пример #17
0
 private void SubcribeButtonClick(object sender, RoutedEventArgs e)
 {
     if (Members.Contains(AuthenticationService.CurrentUser))
     {
         Service.DeleteUserFromGroup(Group, AuthenticationService.CurrentUser);
     }
     else
     {
         Service.AddUserToGroup(Group, AuthenticationService.CurrentUser);
     }
 }
Пример #18
0
 public void AddMember(Character character)
 {
     if (Members.Contains(character) == false)
     {
         Members.Add(character);
     }
     else
     {
         throw new PlannerExceptions("Member already exist");
     }
 }
Пример #19
0
 public void AddUser(Person newPerson)
 {
     if (Members.Contains(newPerson))
     {
         Console.WriteLine($"{newPerson} is already a member.");
     }
     else
     {
         Members.Add(newPerson);
     }
 }
Пример #20
0
 internal int GetMemberType(int userID)
 {
     if (OwnerID == userID)
     {
         return(3);
     }
     if (Members.Contains(userID))
     {
         return(1);
     }
     return(0);
 }
Пример #21
0
        public bool IsNeighbor(int index)
        {
            foreach (int lIndex in Board.Coord.GetNeighbors(index))
            {
                if (Members.Contains(lIndex))
                {
                    return(true);
                }
            }

            return(false);
        }
        public void AddMember(string name)
        {
            Member m = new Member(new AdMember(), name);

            m.Instance.Parent = this.Key;

            if (Members.Contains(m))
            {
                return;
            }

            m.Instance.Save();
        }
Пример #23
0
 public bool DelMember(string name)
 {
     if (Members.Count > 1)
     {
         if (Members.Contains(name))
         {
             return(false);
         }
         Members.Remove(name);
         return(true);
     }
     return(false);
 }
Пример #24
0
 public void AddMember(Character character)
 {
     if (!Members.Contains(character))
     {
         Members.Add(character);
         character.Party = this;
         RemoveGuest(character);
         AbstractParty.SendPartyJoinMessage(character);
         character.Client.Send(new PartyUpdateMessage((uint)this.Id, this.GetPartyMemberInformations(character)));
         UpdateMember(character);
         RemoveGuest(character);
     }
 }
        /// <summary>
        /// Returns the list of all the key members for this entity type
        /// </summary>
        /// <exception cref="System.ArgumentNullException">if member argument is null</exception>
        /// <exception cref="System.InvalidOperationException">Thrown if the EntityType has a base type of another EntityTypeBase. In this case KeyMembers should be added to the base type</exception>
        /// <exception cref="System.InvalidOperationException">If the EntityType instance is in ReadOnly state</exception>
        internal void AddKeyMember(EdmMember member)
        {
            EntityUtil.GenericCheckArgumentNull(member, "member");
            Util.ThrowIfReadOnly(this);
            Debug.Assert(this.BaseType == null || ((EntityTypeBase)this.BaseType).KeyMembers.Count == 0,
                         "Key cannot be added if there is a basetype with keys");

            if (!Members.Contains(member))
            {
                this.AddMember(member);
            }
            _keyMembers.Source.Add(member);
        }
Пример #26
0
 public bool AddMember(string name)
 {
     if (Members.Count < Capacity)
     {
         if (Members.Contains(name))
         {
             return(false);
         }
         Members.Add(name);
         return(true);
     }
     return(false);
 }
Пример #27
0
        public bool CanCreateRound(BandMember sheriff)
        {
            if (sheriff == null)
            {
                throw new ArgumentNullException(nameof(sheriff));
            }

            if (!Members.Contains(sheriff))
            {
                return(false);
            }

            return(Members.All(m => m.Rounds.Count >= sheriff.Rounds.Count));
        }
Пример #28
0
        public void RemovePlayerState(PlayerState pl)
        {
            if (pl == null || !Members.Contains(pl))
            {
                return;
            }

            Members.Remove(pl);

            PlayerMobile pm = (PlayerMobile)pl.Mobile;

            if (pm == null)
            {
                return;
            }

            Mobile mob = pl.Mobile;

            if (pm.FactionPlayerState == pl)
            {
                pm.FactionPlayerState = null;

                mob.InvalidateProperties();
                mob.Delta(MobileDelta.Noto);

                if (Election.IsCandidate(mob))
                {
                    Election.RemoveCandidate(mob);
                }

                if (pl.Finance != null)
                {
                    pl.Finance.Finance = null;
                }

                if (pl.Sheriff != null)
                {
                    pl.Sheriff.Sheriff = null;
                }

                Election.RemoveVoter(mob);

                if (Commander == mob)
                {
                    Commander = null;
                }

                pm.ValidateEquipment();
            }
        }
        /// <summary>
        /// Sets SQL describing a member of this entity type.
        /// Requires: member must belong to this type
        /// </summary>
        /// <param name="member">Member for which to set SQL</param>
        /// <param name="sql">SQL describing this member</param>
        internal void SetMemberSql(EdmMember member, string sql)
        {
            Debug.Assert(Members.Contains(member));

            // initialize dictionary on first use
            lock (_memberSqlLock)
            {
                if (null == _memberSql)
                {
                    _memberSql = new Dictionary <EdmMember, string>();
                }

                _memberSql[member] = sql;
            }
        }
Пример #30
0
        /// <summary>
        ///     Returns the list of all the key members for this entity type
        /// </summary>
        /// <exception cref="System.ArgumentNullException">if member argument is null</exception>
        /// <exception cref="System.InvalidOperationException">Thrown if the EntityType has a base type of another EntityTypeBase. In this case KeyMembers should be added to the base type</exception>
        /// <exception cref="System.InvalidOperationException">If the EntityType instance is in ReadOnly state</exception>
        public void AddKeyMember(EdmMember member)
        {
            Check.NotNull(member, "member");
            Util.ThrowIfReadOnly(this);
            Debug.Assert(
                BaseType == null || ((EntityTypeBase)BaseType).KeyMembers.Count == 0,
                "Key cannot be added if there is a basetype with keys");

            if (!Members.Contains(member))
            {
                AddMember(member);
            }

            _keyMembers.Source.Add(member);
        }