Logging user logins in order to report that the client exceeds the number of licenses

I am a leading developer in a commercial Windows application (C #). The new requirement is to track customers who abuse the license.

For example: let's say a customer buys 10 user license agreements, i.e. 10 concurrent users at any given time.

I need to be able to report, looking back at the story, all the time when the client had more than 10 users registered at the same time.

I already have a User table with columns: userid (primary key), pw, lastLogin, lastLogout.

I was thinking of creating a new registration table in which a new row is added every time a user logs out ... columns may include:

LogId, UserId, LoginDateTime, LogoutDateTime

... and then I will have a story every time a user logs in / out of the application ...

but I'm not sure that this table design will provide efficient calculations for reporting ... no matter if I use SQL or C # to do the calculations, it doesn't matter to me if it's fast enough ...

Hoping that someone can have a good idea of ​​how best to develop this table so that I can quickly calculate all / all points in time when the client exceeded the license limit.

Note. I do not want to block user 11t, 12th, etc. from using the application ... The requirement is to display a warning to the user, but so that he continues to work ...

+2
source share
6

, . .

, , , : . , . , " " , , , .

"count count" .

:

    SessionId  EventType  .... your session data here ... SessionCount   
1.     1         Login         ................                 1
2.     2         Login         ................                 2
3.     3         Login         ................                 3
4.     1         Logout        ................                 2
5.     4         Login         ................                 3
6.     4         Logout        ................                 2
7.     2         Logout        ................                 1
8.     3         Logout        ................                 0
9.     5         Login         ................                 1
10.    6         Login         ................                 2

:

  • , / , - .
  • , ? , .

: , , " ", " ". , , . , , , ( SessionId ).

+5

- . , . , . , , .

(, , ), , . , , .

, .

+1

, , -, , ... , . ( WCF )

, . . , , , . , ...

0

- , ( Daniel, , , , ( , ALT + F4, File | Exit ..).

, , . , , , , . , , , . .

, , - . :

  • , ;
  • , (, 1x 5 ) ;
  • , ;
  • 10 , .
0

. , . , , , MRU ( 10) - SELECT TOP 10 DISTINCT usercode FROM atable WHERE ( wasn 't "log off" ) ORDER BY timestamp DESC. - , 10, . ( , ); , 10 . . . .

( ) ( ).

0

(LogId, UserId, LoginDateTime, LogoutDateTime) , - , , , , .

- , . 30- (UserId, BlockDateTime).

BettyR 10:05 11:45, :

BettyR, 10:00am
BettyR, 10:30am
BettyR, 11:00am
BettyR, 11:30am

Then you can use a regular SQL query with a group by clause to find the number of different users who used the system for each half hour period.

select ...
from UsageBlocks
group by BlockDateTime
having count(*) > 10

Depending on your requirements, you could do a deeper analysis during these specific time periods using the reporting application.

-1
source

All Articles