The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
How to determine date and time of last login for a user of web client 7.5.1
Posted: 23 Jul 09 5:23 PM
|
In 7.0.1 we would use the following to determine the date and time a web client user's most recent login:
SELECT LASTLOGINDATE FROM SLXWEBUSERINFO
In 7.5.1 no data is written to this table. Does anyone know if this information is recorded in 7.5.1 and, if so, where?
Thanks, Doug Evenhouse |
|
|
|
Re: How to determine date and time of last login for a user of web client 7.5.1
Posted: 23 Jul 09 10:54 PM
|
I don't think that it is being written anywhere, but it could be easy to add code for it.
On the Base.Master, add the following lines on the Page_Load function:
if (Session["logdatewritten"] == null) { string userID = ApplicationContext.Current.Services.Get(true).UserId.Trim(); string SQL = string.Format("UPDATE SLXWEBUSERINFO SET LASTLOGINDATE = GETUTCDATE() WHERE USERID = '{0}'", userID); System.Data.OleDb.OleDbConnection openConnection = GetOpenConnection(); System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand(SQL, openConnection); command.ExecuteNonQuery(); Session.Add("logdatewritten", "yes"); }
And, add to the file the following function to the file: private static System.Data.OleDb.OleDbConnection GetOpenConnection() { //There are other ways to obtain a connection, this was the code I had handy, but works. string ConnectionString = Sage.Platform.Application.ApplicationContext.Current.Services.Get().GetConnectionString(); System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection(ConnectionString); connection.Open(); return connection; }
|
|
|
| |
| |
| |
|
Re: How to determine date and time of last login for a user of web client 7.5.1
Posted: 11 Jan 10 12:24 AM
|
Raul's code got mucked up by the forums (sorry, that's changing soon)
Fixed code is:
private static System.Data.OleDb.OleDbConnection GetOpenConnection() { //There are other ways to obtain a connection, this was the code I had handy, but works. string ConnectionString = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Data.IDataService>().GetConnectionString(); System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection(ConnectionString); connection.Open(); return connection; }
-Ryan |
|
|
| |
|
Re: How to determine date and time of last login for a user of web client 7.5.1
Posted: 25 Jan 10 12:09 AM
|
Ok. I have tried the above code substitution (from Ryan), however, I get an error on login:
We're sorry, your request could not be completed.
c:\Inetpub\wwwroot\Saleslogix_Sales\Masters\Base.Master(200): error CS1502: The best overloaded method match for 'Sage.Platform.Application.ServiceCollection.Get(System.Type)' has some invalid arguments
http://preslxweb1bur/saleslogix_sales/Default.aspx c:\Inetpub\wwwroot\Saleslogix_Sales\Masters\Base.Master(200): error CS1502: The best overloaded method match for 'Sage.Platform.Application.ServiceCollection.Get(System.Type)' has some invalid arguments at System.Web.Compilation.BuildManager.PostProcessFoundBuildResult(BuildResult result, Boolean keyFromVPP, VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetBuildResultFromCacheInternal(String cacheKey, Boolean keyFromVPP, VirtualPath virtualPath, Int64 hashCode) at System.Web.Compilation.BuildManager.GetVPathBuildResultFromCacheInternal(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile) at System.Web.UI.PageParser.ProcessMainDirectiveAttribute(String deviceName, String name, String value, IDictionary parseData) at System.Web.UI.TemplateParser.ProcessMainDirective(IDictionary mainDirective)
- Any ideas on how to fix this??
Thanks |
|
|
| |
| |
| |
|