Knowledgebase:
GetClient
Posted by Mohammad Rahhal, Last modified by Eyad Alhaj Hammad on 22 January 2017 03:49 PM

Syntax 

GetClient()

Description

The GetClient operation is used to return all client’s data needed including accounts list and child clients list,
needed to build your client’s tree after logging on.

Request Parameters

This operation takes no parameters.

Response Elements

Name Description 
Result

In case of success, this operation returns an object of type Client that holds the following members:
  

  • Accounts: Indicates to the accounts related to the client.
     - AccountID.
     - AccountType: As the following: 
         0: Which means Demo Account Type.
         1: Which means Normal Account Type.
         2: Which means Coverage Account Type. 
     - IsMargin.
     - DemoAccount.
     - LockLiquidate.
  • ChildClients: Indicates to child related to Client.
  • ClientID: Indicates to Client ID.
  • ClientType: Indicates to the Client Type as the following:
     1: Which means Client type. 
     2: Which means office type. 
     3: Which means group type.
  • FirstName: Indicates to client first name.
  • FullName: Indicates to client full name.
  • LastName: Indicates to client last name.
  • ThirdName: Indicates to client third name.
  • UserName: Indicates to user name.
  • Parent: Client parent.
  • Phone: Indicates to client Phone.
  • Email: Indicates to client Email.
  • Address: Indicates to client address.
  • Country: Indicates to client country.
  • Password: Indicates the client Password.
  • ClientID: Indicates the logged in client ID.
  • EnableInterest: Indicates if the interest enabled or not. 
  • LiqPoint: Indicates the liquidation point value.
  • LiqType: Indicates the liquidation type.
     1: Which means the liquidation at the Equity value. 
     2: Which means the liquidation at the Margin level value.

Otherwise see Error codes.
Type: JSON object as client.

Sample

Download sample as text file.

 

<!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>GetClient</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<script >
$(document).ready(function () {
var urlStr = "http://5.10.64.199/vertexweb10/WebService.svc";
jQuery.support.cors = true;
$("#progress").ajaxStart(function () { $(this).css("display", "block"); });
$("#progress").ajaxComplete(function () { $(this).css("display", "none"); });
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);
}
}
$("#resultAction").ajaxError(function (result) { $(this).html('An error occured'); });
function onErrorResult(result) {
alert('Service call failed : ' + result.status + ' ' + result.statusText);
}
$("#btnLogin").click(function () {
$.getJSON(urlStr + "/Login?username=" + $("#txtusername").val() + "&password=" + $("#txtpassword").val() + "&callback=?", onSuccessResult);
});
$("#btnAction").click(function () {
$.getJSON(urlStr + "/GetClient?" + "callback=?", onSuccessResult);
function onSuccessResult(dataResult) {
dataResult = eval('(' + dataResult + ')');
var acc = "";
if (dataResult.ClientID > 0) {
var clientType = "client";
var AccountType = "Demo";
var liqType = "margin";
if (dataResult.ClientType == 1) { clientType = "Client"; acc += "Client Type: Client " }
else if (dataResult.ClientType == 2) { clientType = "office"; acc += "Client Type: office " }
else { clientType = "group"; acc += "Client Type: group " }
acc += "<li align='left'> First name: " + dataResult.FirstName + "</li>";
acc += "<li align='left'> Enable Interest: " + dataResult.EnableInterest + "</li>";
acc += "<li align='left'> liquidation Point: " + dataResult.LiqPoint + "</li>";
acc += "<li align='left'> Client ID: " + dataResult.ClientID + "</li>";

if (dataResult.LiqType == 1 ) {liqType = " Equity ";}
else {liqType = "Margin level ";}
acc += "<li align='left'> Liquidate Type: " + liqType + "</li>";
for (var i = 0; i < dataResult.Accounts.length; i++) {
acc += "<li>Account Id :" + dataResult.Accounts[i].AccountID + "</a></li>";
if (dataResult.Accounts[i].AccountType = 0 ){AccountType = "Demo Account ";}
else if (dataResult.Accounts[i].AccountType = 1){AccountType = "Normal account ";}
else {AccountType = "Coverage account ";}
acc += "<li>Account Type : " + AccountType + "</a></li>";
acc += "<li>Is Margin : " + dataResult.Accounts[i].IsMargin + "</a></li>";
acc += "<li>Demo Account : " + dataResult.Accounts[i].DemoAccount + "</a></li>";
acc += "<li>Lock Liquidate : " + dataResult.Accounts[i].LockLiquidate + "</a></li>";

}
if (dataResult.ChildClients) {
acc += "ChildClients are :";
for (var x = 0; x < dataResult.ChildClients.length; x++) {
for (var i = 0; i < dataResult.ChildClients[x].Accounts.length; i++) {
acc += "<br>";
acc += "<br>";
acc += "<li>Account Id :" + dataResult.ChildClients[x].Accounts[i].AccountID + "</a></li>";
if (dataResult.ChildClients[x].Accounts[i].AccountType = 0 ){AccountType = "Demo Account ";}
else if (dataResult.ChildClients[x].Accounts[i].AccountType = 1){AccountType = "Normal account ";}
else {AccountType = "Coverage account ";}
acc += "<li>Account Type : " + AccountType + "</a></li>";
acc += "<li>Is Margin : " + dataResult.ChildClients[x].Accounts[i].IsMargin + "</a></li>";
acc += "<li>Demo Account : " + dataResult.ChildClients[x].Accounts[i].DemoAccount + "</a></li>";
acc += "<li>Lock Liquidate : " + dataResult.ChildClients[x].Accounts[i].LockLiquidate + "</a></li>";
}
}
}
acc += "</ul></li>";
$("#resultAction").html(acc);
}
}
});
});
</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"> GetClient </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


VertexFX WCF Service Index

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

Help Desk Software by Hybrid Solutions