Exemplo n.º 1
0
        public ISimpleUserInfo[] GetUserInfos(IServiceStateService user, long[] uids, Dictionary <long, AddressBookFriend> addressFriends)
        {
            uids = (uids ?? new long[0]).Where(p => p > 0).Distinct().ToArray();
            if (uids.Length == 0)
            {
                return(new SimpleUserInfo[0]);
            }
            IUserDisplayStrategy strategy;

            if (user != null)
            {
                strategy = new UserDisplayStrategy(user, addressFriends);
            }
            else
            {
                strategy = new UserPreviewStrategy();
            }
            var users = _UserRepository.GetUserInfo(uids);

            return(GetDisplaySimpleUserInfo(users, strategy).ToArray());
        }
Exemplo n.º 2
0
        public IFootPrintSimpleUserInfo[] GetFootPrintUserInfos(IServiceStateService user, Dictionary <long, long> fuidDic, Dictionary <long, AddressBookFriend> addressFriends, long[] dockFids)
        {
            ExceptionHelper.ThrowIfNull(fuidDic, nameof(fuidDic));
            var uids = fuidDic.Select(p => p.Value).Where(p => p > 0).Distinct().ToArray();

            dockFids = (dockFids ?? new long[0]).Where(p => p > 0).Distinct().ToArray();
            if (uids.Length == 0)
            {
                return(new FootPrintSimpleUserInfo[0]);
            }
            IFootPrintUserDisplayStrategy strategy;

            if (user != null)
            {
                strategy = new FootPrintUserDisplayStrategy(user, addressFriends, dockFids);
            }
            else
            {
                strategy = new FootPrintUserPreviewStrategy();
            }
            var users = _UserRepository.GetUserInfo(uids);

            return(GetDisplayFootPrintUserInfo(users, fuidDic, strategy).ToArray());
        }
Exemplo n.º 3
0
 public UserDisplayStrategy(IServiceStateService user, Dictionary <long, AddressBookFriend> addressFriends)
 {
     _User           = user;
     _AddressFriends = addressFriends ?? new Dictionary <long, AddressBookFriend>();
 }
Exemplo n.º 4
0
 public FootPrintUserDisplayStrategy(IServiceStateService user, Dictionary <long, AddressBookFriend> addressFriends, long[] dockFids)
 {
     _User           = user;
     _AddressFriends = addressFriends ?? new Dictionary <long, AddressBookFriend>();
     _DockFids       = dockFids ?? new long[0];
 }