コード例 #1
0
ファイル: Users.cs プロジェクト: Eric-Zhang3/ExhibFlat1.0
        public static IUser GetDistributor(int userId, string username, bool isCacheable, bool userIsOnline)
        {
            if (((userId == 0) && !string.IsNullOrEmpty(username)) && username.Equals("Anonymous", StringComparison.CurrentCultureIgnoreCase))
            {
                return(GetAnonymousUser());
            }
            Hashtable hashtable = UserCache();
            string    str       = (userId > 0) ? UserKey(userId.ToString(CultureInfo.InvariantCulture)) : UserKey(username);
            IUser     user      = null;

            if (isCacheable)
            {
                user = hashtable[str] as IUser;
                if (user != null)
                {
                    return(user);
                }
            }
            HiMembershipUser membershipUser = UserHelper.GetMembershipUser(userId, username, userIsOnline);

            if (membershipUser == null)
            {
                return(GetAnonymousUser());
            }
            user = DistributorFactory.Instance().GetUser(membershipUser);
            if (isCacheable)
            {
                hashtable[UserKey(user.Username)] = user;
                hashtable[UserKey(user.UserId.ToString(CultureInfo.InvariantCulture))] = user;
            }
            return(user);
        }
コード例 #2
0
ファイル: Users.cs プロジェクト: Eric-Zhang3/ExhibFlat1.0
        public static CreateUserStatus CreateOnlyDistributorUser(IUser user, string roles)
        {
            CreateUserStatus unknownFailure = UserHelper.CreateOnlyDistributor(user.MembershipUser, new string[] { roles });

            if ((unknownFailure == CreateUserStatus.Created) && !DistributorFactory.Instance().Create(user))
            {
                HiMembership.Delete(user.Username);
                unknownFailure = CreateUserStatus.UnknownFailure;
            }
            return(unknownFailure);
        }
コード例 #3
0
ファイル: Users.cs プロジェクト: Eric-Zhang3/ExhibFlat1.0
        public static bool UpdateDistributor(IUser user)
        {
            if (null == user)
            {
                return(false);
            }
            bool flag = UserHelper.UpdateUser(user.MembershipUser);

            if (flag)
            {
                flag = DistributorFactory.Instance().UpdateUser(user);
                HiContext current = HiContext.Current;
                if (current.User.UserId == user.UserId)
                {
                    current.User = user;
                }
            }
            ClearUserCache(user);
            return(flag);
        }
コード例 #4
0
ファイル: Supplier.cs プロジェクト: Eric-Zhang3/ExhibFlat1.0
 public bool ChangeTradePassword(string oldPassword, string newPassword)
 {
     return(DistributorFactory.Instance().ChangeTradePassword(this.Username, oldPassword, newPassword));
 }