Exemplo n.º 1
0
        public UsersByLastName(int hintsCount = 0, bool online = false, Dictionary <int, int> excludeUids = null)
        {
            var people = IoC.Get <ICacheService>().GetContacts();

            people.Sort(TLUserBase.CompareByLastName);

            _groups = new Dictionary <string, AlphaKeyGroup <TLUserBase> >();

            //if (hintsCount > 0)
            //{
            //    var hints = people.Take(hintsCount).ToList();
            //    var hintsGroup = new UsersInGroup("hints");
            //    Add(hintsGroup);
            //    _groups["hints"] = hintsGroup;
            //    foreach (var hint in hints)
            //    {
            //        _groups["hints"].Add(hint);
            //    }
            //}

            foreach (var c in Groups)
            {
                var group = new AlphaKeyGroup <TLUserBase>(c.ToString());
                Add(group);
                _groups[c.ToString()] = group;
            }

            foreach (var person in people)
            {
                _groups[TLUserBase.GetLastNameKey(person)].Add(person);
            }

            //CacheService.Database.Storage.Commit();
        }
Exemplo n.º 2
0
        public ContactsByLastName(List <TLUserBase> contacts)
        {
            var people = contacts;

            people.Sort(TLUserBase.CompareByLastName);

            /*if (!people.Any())
             * {
             *  people.Add(new User { FirstName = "Андрей", LastName = "Рогозов", PhoneFirstName = "Андрей", PhoneLastName = "" });
             *  people.Add(new User { PhoneFirstName = "Алексей", PhoneLastName = "Степанов" });
             * }*/

            var groups = new Dictionary <string, AlphaKeyGroup <TLUserBase> >();

            foreach (var c in Groups)
            {
                var group = new AlphaKeyGroup <TLUserBase>(c.ToString());
                Add(group);
                groups[c.ToString()] = group;
            }

            foreach (var person in people)
            {
                groups[TLUserBase.GetLastNameKey(person)].Add(person);
            }
        }