Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, April 28, 2024 
 
slxdeveloper.com Community Forums  
   
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!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: How to determine date and time of last login for a user of web client 7.5.1
Doug Evenhouse
Posts: 66
 
How to determine date and time of last login for a user of web client 7.5.1Your last visit to this thread was on 1/1/1970 12:00:00 AM
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
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: How to determine date and time of last login for a user of web client 7.5.1Your last visit to this thread was on 1/1/1970 12:00:00 AM
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;
}
[Reply][Quote]
Doug Evenhouse
Posts: 66
 
Re: How to determine date and time of last login for a user of web client 7.5.1Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jul 09 9:22 AM
We'd have to be sure the userid exists in the table before running the update statement, correct? I guess we could just query for the userid first and then do an insert or update based on the result.

Thanks Raul!
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: How to determine date and time of last login for a user of web client 7.5.1Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Jul 09 11:55 PM
You are right, you should always check if the record exists if it doesn't, then you would instead use an Insert statement.
[Reply][Quote]
Andrew Sokolsky
Posts: 26
 
Re: How to determine date and time of last login for a user of web client 7.5.1Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jan 10 3:28 PM
Ok. I have tried your method above but I get the following message:

c:\Inetpub\wwwroot\Saleslogix_Sales\Masters\Base.Master(133): error CS1502: The best overloaded method match for 'Sage.Platform.Application.ServiceCollection.Get(System.Type)' has some invalid arguments
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: How to determine date and time of last login for a user of web client 7.5.1Your last visit to this thread was on 1/1/1970 12:00:00 AM
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
[Reply][Quote]
Andrew Sokolsky
Posts: 26
 
Re: How to determine date and time of last login for a user of web client 7.5.1Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Jan 10 12:33 PM
Thanks. I'll give this a try
[Reply][Quote]
Andrew Sokolsky
Posts: 26
 
Re: How to determine date and time of last login for a user of web client 7.5.1Your last visit to this thread was on 1/1/1970 12:00:00 AM
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
[Reply][Quote]
Andrew Sokolsky
Posts: 26
 
Re: How to determine date and time of last login for a user of web client 7.5.1Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Jan 10 2:11 AM
Raul,

I was finally able to get this to work. My bosses will be please as they want to track daily logins.

Thank you so much!

Andrew
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: How to determine date and time of last login for a user of web client 7.5.1Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Jan 10 12:46 PM
Thank you Andrew. I just re-read the thread and realized that you had run into some issues.
I have had the same structure (off course, not the same code) running for several years starting on the Legacy Web client, and for the most is pretty accurate.

Glad to hear you have it working.
[Reply][Quote]
Veronka Capone
Posts: 113
 
Re: How to determine date and time of last login for a user of web client 7.5.1Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Feb 10 3:22 PM
Raul,

I followed the same logic to insert user login into my own custom table. I would also like yo track when user loggs out/session ends. Where should I put that piece of code?

Thanks !
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 4/28/2024 2:31:26 PM