Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 131179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:03:52+00:00 2026-05-11T06:03:52+00:00

I am the lead developer on a commercial Windows app (c#). A new requirement

  • 0

I am the lead developer on a commercial Windows app (c#). A new requirement is to track customers who abuse the license.

For example: Let’s say a customer purchases a 10 user license agreement, i.e. 10 simultaneous users at any given time.

I need to be able to report, looking back at history, all the times that customer had more than 10 users logged in at the same time.

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

I was thinking about creating a a new ‘logging’ table in which a new row is added each time a user logs out…columns might include:

LogId, UserId, LoginDateTime, LogoutDateTime

…and then I would have a history of every time a user logs in/out of the app…

but I’m not sure if this table design will lend to efficient calculations for reporting…whether I use SQL or c# to perform the calculations does not matter to me, as long as it is reasonably fast…

Hoping someone might have a good idea about how to better design this table so that I can quickly calculate any/all points in time when the customer exceeded the license limit.

Note: I do not want to block the 11t, 12th etc. user from using the app…the requirement is to display a warning message to the user but to allow him to continue working…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T06:03:53+00:00Added an answer on May 11, 2026 at 6:03 am

    Think about starting and ending sessions as events that need to be recorded. You create a single table to record these events.

    So, a session that starts and ends will have two entries in the table – one for the session start and one for the session end. You only ever add records to the table, never modifying previous records. The table can keep track of the number of open sessions very simply now by adding a ‘session count’ field to the record that is incremented from the previous record’s session count value when a session start event occurs and decremented when a session end event occurs.

    The ‘session count’ column now gives us a piece-wise continuous function over time of the number of concurrent sessions.

    Example data:

        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 

    Things to worry about:

    1. You must make sure you pair begin/end events, so in the event of any failure, session end events must still be generated.
    2. Do you need the table to be tamper proof? If so, I have a technique for that also.

    EDIT: please note that where I put ‘your session data here’, I really meant ‘your session event data here’. Information such as a time stamp would go in here. Another table should be used to track session information common to both events, such as the identity of the user that owns the session (use the same SessionId key for both tables).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just had a conversation with my lead developer who disagreed that unit tests
As a lead developer I often get handed specifications for a new project, and
We have appointed a new team lead who will be starting in the next
In a recent project the lead developer designed a database schema where larger tables
My strongest lead is that the code who deals with the incoming XMLs is
I have a team lead who seems to think that business logic is very
A lead developer on my project has taken to referring to the project's toString()
The lead developer on a project I'm involved in says it's bad practice to
I'm a lead developer in a small development shop exclusively using Microsoft based solutions.
I'm a lead developer on a project which is building web applications for my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.