tags:

views:

62

answers:

2

HI All, i wish begin to work about a feature new for me ,i'n my project i have a database( with SqlServer) and an application (developing in WPF) the purpose of this application is to manage/handle about Accountancy and other Departement,so i created a Passwords and Roles(for Users) to access in the application ,now i will create a system to knows how many Usera are connected to the Application(via Database )and show that in a listBox(for example like a normal Chat Application i wish knows who is online and offline) but i don't know where i need begin to work out this feature ,i'm strange to this feature so if you have any suggestion,link and else i will appreciate so much your help.

Thanks so much.

P.S. if my question is not clear i will rewrite it...however sorry in anticipate

+1  A: 

Maybe in the database itself? When the user logs in, you can set a flag for each user "LoggedInd = true", and when they log out "LoggedIn = false". And do a query on that flag "SELECT * FROM Users WHERE LoggedIn = true"

Carlo
+1  A: 

Without knowing the details of your application, I would suggest setting a timestamp field in the database when they log in, and then set it again every X minutes while they are logged in. This has two advantages over just setting a flag:

1) If the application crashes, or the user's machine crashes, the flag will not be reset, and you will have no way of knowing that they are not still logged in.

2) The timestamp will tell you the last time each user was logged in, even if they are not logged in currently.

Hi Commongenius,in my database i have a UserTBL where there are the fields as password,salt,info,address,roles and so on,so if i got your advice i need to create a new field in UserTbl and set the DataType in TimeStamp after i don't know how set it every X minutes.Do you have more information about that?Thanks for your answer:
JayJay