Esempio n. 1
0
        public BaseResponse ChangePassword(string customerCode, string oldPassword, string newPassword, string useScope)
        {
            PasswordUseScope scope = useScope.Equals(PasswordUseScope.OptionTrade.InternalValue)
                                ? PasswordUseScope.OptionTrade
                                : PasswordUseScope.OptionFund;

            return(_accountManager.ChangePassword(customerCode, scope, oldPassword, newPassword));
        }
Esempio n. 2
0
        public BaseResponse ChangePassword(string customerCode, PasswordUseScope useScope, string oldPassword, string newPassword)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            arguments.Add(SZKingdomArgument.UserCode(customerCode));
            arguments.Add(SZKingdomArgument.PasswordUseScpose(useScope));
            arguments.Add(SZKingdomArgument.OldAuthenticationData(_marketDataLibrary.EncryptPassword(customerCode, oldPassword)));
            arguments.Add(SZKingdomArgument.NewAuthenticationData(_marketDataLibrary.EncryptPassword(customerCode, newPassword)));
            arguments.Add(SZKingdomArgument.EncryptionKey(customerCode));
            arguments.Add(SZKingdomArgument.EncryptionType(EncryptionType.WinEncryption));
            arguments.Add(SZKingdomArgument.AuthenticationType(AuthenticationType.Password));

            EntityResponse <DataTable> result = _marketDataLibrary.ExecuteCommand(SZKingdomRequest.ChangePassword, arguments);

            if (result.IsSuccess)
            {
                return(BaseResponse.Success());
            }

            return(BaseResponse.Error(result.ErrorCode, result.FormattedMessage));
        }
Esempio n. 3
0
        public EntityResponse <UserLoginInformation> UserLogin(LoginAccountType accountType, string accountId, string password, PasswordUseScope useScope)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            arguments.Add(SZKingdomArgument.LoginAccountType(accountType));
            arguments.Add(SZKingdomArgument.LoginAccountId(accountId));
            arguments.Add(SZKingdomArgument.PasswordUseScpose(useScope));
            arguments.Add(SZKingdomArgument.AuthenticationData(_marketDataLibrary.EncryptPassword(accountId, password)));
            arguments.Add(SZKingdomArgument.EncryptionKey(accountId));
            arguments.Add(SZKingdomArgument.EncryptionType(EncryptionType.WinEncryption));
            arguments.Add(SZKingdomArgument.AuthenticationType(AuthenticationType.Password));             // password(0) is the only AUTH_TYPE

            EntityResponse <List <UserLoginInformation> > results =
                _marketDataLibrary.ExecuteCommandList <UserLoginInformation>(SZKingdomRequest.UserLogin, arguments);

            if (results.IsSuccess)
            {
                if (results.Entity.Count >= 1)
                {
                    UserLoginInformation result = results.Entity.First();                     //.Single(u => u.StockBoard == StockBoard.SHStockOptions);
                    return(result);
                }
                return(EntityResponse <UserLoginInformation> .Error(ErrorCode.AuthenticationIncorrectIdentity, string.Format(ErrorMessages.SZKingdom_Invalid_Account, accountId)));
            }
            return(EntityResponse <UserLoginInformation> .Error(results));
        }