且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在C#Windows应用程序的客户端PC上获取活动表单?

更新时间:2023-11-14 10:34:28

您好,

我有一个解决方案,但我不知道它的正确与否.我正在与您分享.

您可以将一个像UserLog的表放入表中.
该表包含以下列.

UserLogID(PK), UserID(UserLoginID), Operatin(Which contains Add,Update,Delete,Login etc), Description(Any comments or description), CreatedDateTime(datetime)

现在,您可以使一个常用功能在此表中插入记录.
在您的项目中,您可以调用此函数并插入值.这样就可以跟踪每个用户.

例如.用户登录.因此,在验证用户名和密码后,您可以使用以下参数调用此函数.

UserLog(UserID,''Login'',''Member Login'',DATETIME.NOW);

现在,当您要跟踪哪个页面用户离开时,然后在每次页面加载时,都可以使用以下值调用此函数.

UserLog(UserID,''Usercomeson this page'',''User come on this page'',DATETIME.NOW);

您可以制作一个ENUM进行操作.

希望您能了解用户跟踪的想法.可能对您有帮助.

谢谢,
Viprat
Hi,

I have one solution but i don`t know its proper or not. I am sharing with you.

you can make one table like UserLog into the table.
That table contains the following columns.

UserLogID(PK), UserID(UserLoginID), Operatin(Which contains Add,Update,Delete,Login etc), Description(Any comments or description), CreatedDateTime(datetime)

Now you can make one common function to insert record in this this table.
In your project you can call this function and insert values. so can keep the track of every user.

For Example. User login. So after verifying username and password you can call this function with following parameters.

UserLog(UserID,''Login'',''Member Login'',DATETIME.NOW);

Now when you want to keep track on which page user gone then on every page load you can call this function with following value.

UserLog(UserID,''Usercomeson this page'',''User come on this page'',DATETIME.NOW);

you can make one ENUM for operations.

I hope you get my idea for user tracking. May be it help you.

Thanks,
Viprat


您可以创建一个xml文件,该文件会根据登录,注销等事件进行更新.
您可以创建另一个线程来监视表单并更新xml文件.
您有2个选择:
1.在客户端中创建一个xml文件,在固定的时间间隔后将其提取.
2.为服务器中的每个客户端创建一个xml文件.

在第二种情况下,您将获得有关客户行为的实时报告.

由于其xml易于解析数据.

Xml教程
关于如何使用c#读写xml文件的教程

由于您不太熟悉线程,因此可以通过使用事件来实现目标.
为您要监视的动作创建事件.
触发事件时,将信息写入xml文件.
由于您未提供代码,因此无法提供太多信息.
You can create a xml file which is updated on events like login,log out etc.
You can create another thread which monitors the form and updates the xml file.
You have 2 options:
1.create a xml file in client,fetch it after a fixed interval.
2.create a xml file for each client in server.

in 2nd case u will get a live report on client actions.

since its xml its easy to parse the data.

Xml Tutorial
Tutorial on how to read and write to xml file using c#

since you are not much familiar to threading, you can achieve your goal by using events.
create events for the actions you wanna monitor.
when the event is triggered write the info to xml file.
cant give much info since you havent provided the code.