Syntax
Public Function GetAccounts() As String
Description
The GetAccounts operation is used to return the accounts information which is under the logged in dealer.
Request Parameters
No request parameters.
Response Elements
Name |
Description |
Result |
The operation returns 1 in case successfully otherwise an explicit error code is returned.
The following are the Account’s data members
- AccountID : Account number
- AccountType : 1= normal account
2 = coverage account
- IsMargin : Boolean value to detect if account is margin or not
- DemoAccount : detect if the account is demo or not
- LockLiquidate : detect if the account is locked or not
|
Sample
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>GetAccounts</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<script type="text/javascript" >
var AccountInfoTable;
$(document).ready(function () {
var urlStr = "http://5.10.64.199/vertexweb10/WebService.svc";
$.support.cors = true;
$.ajaxSetup({ cash: false });
function onSuccessResult(response) {
response = eval('(' + response + ')')
if (response.UserId == -1 || response.UserId == -207) {
$("#resultData").html("Invalid username or password");
}
else if (response.UserId == -231) {
$("#resultData").html("You must have at least one account");
}
else if (response == null || response == "" || response.UserId < 0) {
$("#resultData").html("Error while login.Please try later");
}
else {
$("#resultData").html("SuccessResult ... UserId is :" + response.UserId);
}
}
function onErrorResult(result) {
alert('Service call faild : ' + result.status + ' ' + result.statusText);
}
$("#btnLogin").click(function () {
$.ajax({
type: 'GET',
url: urlStr + "/BackofficeLogin",
dataType: "jsonp",
data: { "username": $("#txtusername").val(), "password": $("#txtpassword").val() },
ProcessData: false,
success: onSuccessResult,
error: onErrorResult
});
});
$("#btnAction").click(function () {
$.ajax({
type: 'GET',
url: urlStr + "/GetAccounts",
dataType: "jsonp",
data: {},
success: function (AccountInfo) {
AccountInfo = eval('(' + AccountInfo + ')');
var result;
if (AccountInfo == undefined || AccountInfo == null || AccountInfo.length == 0) {
result = "No data found";
$("#resultAction").html(result);
}
else if (AccountInfo.AccountID < 0 && AccountInfo.AccountID > -1000) {
result = "No data found error code " + AccountInfo.AccountID ;
$("#resultAction").html(result);
}
else if (AccountInfo.AccountID > 0 || AccountInfo.AccountID == -1200) {
AccountInfoTableHeader();
for (var i = 0; i < AccountInfo.length; i++) {
fillAccountInfoTable(AccountInfo[i]);
}
AccountInfoTable += "</tbody></table>";
}
$("#resultData").html(AccountInfoTable);
},
error: onErrorResult
});
});
});
function AccountInfoTableHeader() {
AccountInfoTable = "";
AccountInfoTable = "<table border='1px'><thead><tr>";
AccountInfoTable += "<th> AccountID </th> <th>AccountType</th><th >Tel</th><th >IsMargin</th>";
AccountInfoTable += "<th>DemoAccount</th><th>LockLiquidate</th>";
AccountInfoTable += "</thead><tbody>";
}
function fillAccountInfoTable(AccountInfo) {
AccountInfoTable += "<tr><td>" + AccountInfo.AccountID + "</td>";
AccountInfoTable += "<td>" + AccountInfo.AccountType + "</td>";
AccountInfoTable += "<td>" + AccountInfo.IsMargin + "</td>";
AccountInfoTable += "<td>" + AccountInfo.DemoAccount + "</td>";
AccountInfoTable += "<td>" + AccountInfo.LockLiquidate + "</td></tr>";
}
</script>
<body>
<table border="1px">
<tbody>
<tr>
<td>
Username: <input type="text" id="txtusername" value=""/>
Password: <input type="text" id="txtpassword" value=""/>
<button id="btnLogin"> Login </button>
</td>
</tr>
<td>
<button id="btnAction"> GetAccounts </button>
</td>
</tr>
</tbody>
</table>
<div id="resultData"> </div>
<div id="resultAction"> </div>
</body>
</html>
See Also
VertexFX Backoffice WCF Service Index
|