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));
        }
        public EntityResponse <FundTransferSerialNo> TransferFund(TransferFundArguments transferArguments)
        {
            var arguments = new List <SZKingdomArgument>();

            arguments.Add(SZKingdomArgument.CustomerAccountCode(transferArguments.CustomerAccountCode));
            arguments.Add(SZKingdomArgument.Currency(transferArguments.Currency));
            arguments.Add(SZKingdomArgument.FundPassword(_marketDataLibrary.EncryptPassword(transferArguments.CustomerAccountCode, transferArguments.FundPassword)));
            arguments.Add(SZKingdomArgument.BankCode(transferArguments.BankCode));
            arguments.Add(SZKingdomArgument.BankPassword(_marketDataLibrary.EncryptPassword(transferArguments.CustomerAccountCode, transferArguments.BankPassword)));
            arguments.Add(SZKingdomArgument.TransferType(transferArguments.TransferType));
            arguments.Add(SZKingdomArgument.TransferAmount(transferArguments.TransferAmount));
            arguments.Add(SZKingdomArgument.EncryptionKey(transferArguments.CustomerAccountCode));
            arguments.Add(SZKingdomArgument.EncryptionType(EncryptionType.WinEncryption));
            arguments.Add(SZKingdomArgument.OperationRemark(transferArguments.OperationRemark));

            return(_marketDataLibrary.ExecuteCommandSingleEntity <FundTransferSerialNo>(SZKingdomRequest.FundTransfer, arguments));
        }
        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));
        }