Esempio n. 1
0
        public bool Enter(string name, string ID)
        {
            lock (SyncLocker)
            {
                if (_list != null && _list.Count >= 0)
                {
                    var ci = _list.FirstOrDefault(b => b.Name == name);

                    if (ci != null && ci.Members != null)
                    {
                        var cm = new GroupMemberInfo()
                        {
                            ID     = ID,
                            Joined = DateTimeHelper.Now
                        };

                        if (!ci.Members.Exists(b => b.ID == ID))
                        {
                            ci.Members.Add(cm);

                            return(true);
                        }
                    }
                }
                return(false);
            }
        }
Esempio n. 2
0
        public bool Create(string name, string ID)
        {
            lock (SyncLocker)
            {
                if (_list != null && _list.Count >= 0)
                {
                    var gi = _list.FirstOrDefault(b => b.Name == name);

                    if (gi == null)
                    {
                        gi = new GroupInfo()
                        {
                            Name    = name,
                            Creator = ID,
                            Created = DateTimeHelper.Now
                        };

                        var gm = new GroupMemberInfo()
                        {
                            ID     = ID,
                            Joined = DateTimeHelper.Now
                        };

                        gi.Members = new List <GroupMemberInfo>
                        {
                            gm
                        };
                        _list.Add(gi);
                        return(true);
                    }
                }
            }
            return(false);
        }