记录用户登录报告客户端是超过许可数量的目的 [英] logging user logins for the purpose of reporting that the client is exceeding number of licenses

查看:222
本文介绍了记录用户登录报告客户端是超过许可数量的目的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个商业应用程序的Windows(C#)的首席开发人员。一个新的要求是跟踪谁滥用许可客户

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

例如:假设客户购买10个用户许可协议,即10个并发用户在任何给定的时间。

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

我需要能够报告,回顾历史,所有的客户已经超过10个用户同时登录的时间。

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.

我已经有一个用户表列:用户ID(主键),PW,lastLogin,lastLogout。

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,用户ID,LoginDateTime,LogoutDateTime

LogId, UserId, LoginDateTime, LogoutDateTime

...然后我会的每一次历史的用户登录输入/输出应用的...

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

但我不知道这表的设计能够给予高效的计算报告...我是使用SQL或C#来执行计算没有关系对我来说,只要它是相当快的...

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.

请注意:我不想使用阻止11吨,12号等用户应用程序...的要求是显示警告信息给用户,但允许他继续工作......

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...

推荐答案

想想开始和结束会议的需要被记录的事件。你创建单个表来记录这些事件

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.

实例数据:

    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

的事情担心:


  1. 你必须确保你配对开始/结束事件,因此在任何故障的情况下,仍必须生成会话结束事件。

  2. 请您需要的表是防篡改?如果是这样,我有专门的技术也

编辑:请注意,这里我把在这里你的会话数据,我真正的意思是你的会话的事件在这里的数据。信息,如时间标记会在这里犹豫。另一个表应当用于跟踪通用的事件,如拥有该会话(使用两个表的相同的SessionID键)的用户的身份的会话信息。

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).

这篇关于记录用户登录报告客户端是超过许可数量的目的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆