Live Chat Software by Hybrid Solutions
LoginHistoryReport
Posted by Angham Banawien on 06 November 2017 04:00 PM

 Syntax

 Public Function LoginHistoryReport(ClientID As Long, FromDate As String, ToDate As String, IP As String, API As Integer, Username As String, Status As Integer, WhoType As Integer, WhoID As IntegerOptional ByVal isPaging As Boolean = False) As String

Description

The LoginHistoryReport operation is used to get the login history report for the given login client ID. 

Request Parameters

Name Description  Required
ClientID
  • Client identifier to getlogin history report for
  • Type : Long
  • Default : None
  • Constraints : Must be valid client Id and accessible by logged in dealer

Yes

FromDate
  • Specify the duration
  • Type : String
  • Default : None
  • Constraints : must be valid date format (“DD/MM/YYYY HH:NN:SS”)
  • “” : means from beginning
Yes  
ToDate
  • Specify the duration
  • Type : String
  • Default : None
  • Constraints : must be valid date format (“DD/MM/YYYY HH:NN:SS”)
  • “” : means till now 
 Yes 
IP
  • The report will show the login history  for this  IP
  • Type : String
  • Default : None
  • “” : Means for all IPs
Yes 
API
  • Indicate if the login by API or using terminal
  • Type : Integer
  • Default : None
  • Can be one of the following
          -1 : means All
           1 : means API
           0 : non API
Yes 

Username

  • Username that want to get the login history for
  • Type  : String
  • Default : none
  • “” : means  All usernames 
Yes 
Status
  • The succeeded or failed login
  • Type : Integer
  • Default : None
  • Can be one of the following
          -1 : means ALL
           1 : means failed login
           0 : Succeeded  
Yes
WhoType
  • The report will show of Dealer or client
  • Type : Integer
  • Default : None
  • Can be one of the following
         0 : means for all
         1 : means for Dealer
         2 : means for Client 
Yes 
WhoID
  • The Id of Dealer or Client
  • Type : Integer
  • Default : None
  • 0 : means for all 
 Yes
 isPaging
  • Boolean value which indicate that you are calling LoginHistoryReport to get remaining records
  • This is useful if you are calling a large amount of data to split the returned  data as 3000 rows for each response
  • Type : Boolean
  • Default : False
  • Constraints : on first call must be false and next calls true

Conditional if the first ClientID in LoginHistoryReport List = -1200 

 


Response Elements

Name Description 
 Result

The operation returns list of type LoginHisReport, otherwise an explicit error code is returned if ClientID  is less than 0 .

The Following are the LoginHisReport data member

  • Status : 1 : Means Failed
                 0 : Means Succeeded
  • LoginTime: client login time
  • LogoutTime : client logout time
  • Type : Client / Dealer
              1 : means Dealer
              2 : means client
  • Username : Logged in user name
  • Name : Logged in name
  • IP  : Logged IP address
  • IsAPI : False: means Not API 
                True : means login through API 


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>LoginHistoryReport</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<script type="text/javascript" >
var LoginHTable;
$(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 + "/LoginHistoryReport",
dataType: "jsonp",
data: { "ClientID ": $("#txtClientID ").val(), "FromDate": $("#txtFromDate").val(), "ToDate": $("#txtToDate").val(), "IP": $("#txtIP").val() , "API": $("#txtAPI").val() , "Username": $("#txtUsernamee").val(), "Status": $("#txtStatus").val(), "WhoType": $("#txtWhoType").val(), "WhoID": $("#txtWhoID").val(), "isPaging": $("#txtisPaging").val()},
success: function (LoginH) {
LoginH = eval('(' + LoginH + ')');
var result;
if (LoginH == undefined || LoginH == null || LoginH.length == 0) {
result = "No data found";
$("#resultAction").html(result);
}
else if (LoginH[0].Status < 0 && LoginH[0].Status > -1000) {
result = "No data found error code " + LoginH[0].Status;
$("#resultAction").html(result);
}
else if (LoginH[0].Status > 0 || LoginH[0].Status == -1200) {
LoginHTableHeader();
for (var i = 0; i < LoginH.length; i++) {
fillLoginHTable(LoginH[i]);
}
LoginHTable += "</tbody></table>";
}
$("#resultData").html(LoginHTable);
},
error: onErrorResult
});
});
});

function LoginHTableHeader() {
LoginHTable = "";
LoginHTable = "<table border='1px'><thead><tr>";
LoginHTable += "<th> LoginTime </th> <th>LogoutTime</th><th >Type</th><th >Username</th>";
LoginHTable += "<th>Name</th><th>IP</th><th>Status</th><th>IsAPI</th>";
LoginHTable += "</thead><tbody>";
}

function fillLoginHTable(LoginH) {

LoginHTable += "<tr><td>" + LoginH.LoginTime + "</td>";
LoginHTable += "<td>" + LoginH.LogoutTime + "</td>";
LoginHTable += "<td>" + LoginH.Type + "</td>";
LoginHTable += "<td>" + LoginH.Username + "</td>";
LoginHTable += "<td>" + LoginH.Name + "</td>";
LoginHTable += "<td>" + LoginH.IP + "</td>";
LoginHTable += "<td>" + LoginH.Status + "</td>";
LoginHTable += "<td>" + LoginH.IsAPI + "</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>
<tr >
<td>
ClientID : <input type="text" id="txtClientID" value ="" />
FromDate : <input type="text" id="txtFromDate" value=""/>
ToDate : <input type="text" id="txtToDate" value="" />
</td>
</tr>
<tr >
<td>
IP : <input type="text" id="txtIP" value ="" />
API : <input type="text" id="txtAPI" value=""/>
Username : <input type="text" id="txtUsernamee" value="" />
</td>
</tr>
<tr >
<td>
Status : <input type="text" id="txtStatus" value ="0" />
WhoType : <input type="text" id="txtWhoType" value="0"/>
WhoID : <input type="text" id="txtWhoID" value="0" />
</td>
</tr>

<tr>
<td>
isPaging : <input type="text" id="txtisPaging" value="False"/>

<button id="btnAction"> LoginHistoryReport </button>
</td>
</tr>
</tbody>
</table>
<div id="resultData"> </div>
<div id="resultAction"> </div>
</body>
</html>

 


See Also


VertexFX Backoffice 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