Syntax
Function GetOnlineSessions() As String
Description
The GetOnlineSessions operation is used to retrieve the all the online sessions that the logged in dealer has privilege on
Response Elements
Name |
Description |
Result |
This operation returns the online sessions as list (of type SessionData) upon success.
The following are the SessionsData Data members:
- UserId
- UserName
- StartSession
- IP
- DealerPriv
- UserType
1 : for dealer user type . 2 : for client user type . 3 : for Demo client user type. 6 : for History Client User Type
In case of failure the UserId will be less than 0 , refer to the error code
|
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>GetOnlineSessions</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<script>
$(document).ready(function () {
var urlStr = "http://173.249.35.43/webtrader/webservice.svc";
jQuery.support.cors = true;
$("#progress").ajaxStart(function () { $(this).css("display", "block"); });
$("#progress").ajaxComplete(function () { $(this).css("display", "none"); });
$("#resultAction").ajaxError(function (result) { $(this).html('An error occured'); });
function onSuccessResultt(dataResult) {
var result = eval(dataResult);
var rst = ""
if (result[0].UserId > 0) {
for (var i = 0; i < result.length; i++) {
rst += "UserID : " + result[i].UserId + "<br/>"
rst += "UserName : " + result[i].UserName + "<br/>"
rst += "StartSession : " + result[i].StartSession + "<br/>"
rst += "IP : " + result[i].IP + "<br/>"
rst += "DealerPriv : " + result[i].DealerPriv + "<br/>"
rst += "UserType : " + result[i].UserType + "<br/>"
rst += "--------------------------------------------------" + "<br/>"
$("#resultAction").html(rst)
}
}
else {
$("#resultAction").html("Error Code : " + result[0].UserId + "<br/>" );
}
}
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 () {
$.getJSON(urlStr + "/BackofficeLogin?username=" + $("#txtusername").val() + "&password=" + $("#txtpassword").val() + "&callback=?" , onSuccessResult);
});
$("#btnAction").click(function () {
$.getJSON(urlStr + "/GetOnlineSessions?" + "&callback=?", onSuccessResultt);
});
});
</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>
<tr >
<td>
<button id="btnAction"> GetOnlineSessions </button>
</td>
</tr>
</tbody>
</table>
<div id="resultData"> </div>
<div id="resultAction"> </div>
<div style="display:none" id="progress">Loading ... </div>
</body>
</html>
See Also
GetMWAllSymbol getClientGMT GetMWNewTick
VertexFX Backoffice WCF Service (Primitive)
|