Home > Net >  C # winform automatically records the custom operation logs and saved to the oracle database, be urg
C # winform automatically records the custom operation logs and saved to the oracle database, be urg

Time:10-05

With local LAN, record fields include user login, user computer IP, operation content, user operation time, operating status (whether) the five fields, the development environment is vs2010. Net4.0 platform, oracle11g, it's better if can use log4net, beg god for help, it is better for detailed configuration and code,

CodePudding user response:

http://www.cnblogs.com/guwei4037/p/3504706.html

CodePudding user response:

@ minimalist I think output within the local area network (LAN) all lander user name, IP, operation content, operation time and operation status, how to change the code? Per click a function button should be the content will record a log so you need to add the appropriate output in the button code, how to add? And just now I tried it on your code, don't know how to save to the database in the winform! Please forgive me for the beginner rookie

CodePudding user response:

Can I reply?

CodePudding user response:

1. The user to enter any form to give him a binding the mouse click event (keyboard events) and an optional
///& lt; Summary>
///bind mouse click events
///& lt;/summary>
///& lt; Param name="items" & gt;
Public static void updateMouseClickEvent Form (col)
{
List List=new List (a);

List=GetAllControls (col);
If (list. Count==0) return;
Foreach (Control con in the list)
(con) (Control). MouseClick +=new MouseEventHandler (MainWindow_MouseClick);
}
///& lt; Summary>
///access controls all of the subspace
///& lt;/summary>
///& lt; Param name="control" & gt;
///& lt; Returns>
Public static List GetAllControls Control (Control)
{
Var list=new List (a);
Foreach (Control con in Control. Controls)
{
List. The Add (con);
If (con. Controls. Count & gt; 0)
{
List. AddRange (GetAllControls (con));
}
}
Return the list;
}

///& lt; Summary>
///the form click event
///& lt;/summary>
///& lt; Param name="sender" & gt;
///& lt; Param name="e" & gt;
Private static void MainWindow_MouseClick (object sender, MouseEventArgs e)
{
The Control FM=(Control) sender;
If (FM is DataGridView) * * *;
If (FM is MenuStrip) * * *;

GoodsInfoAPI. Constant. LastTime=DateTime. Now;
Try
{
The Control FM=(Control) sender;
If (FM is DataGridView) return;
If (FM is MenuStrip) return;

App. LogWrite (FM) Name) the ToString () + ": the Text - & gt; : "+ FM. Text +" -- -- -- & gt; Click ");
}
The catch (Exception ee)
{

App. LogWrite (sender. ToString () + "-- -- -- & gt; Click ");
App. LogWrite (" Comvert To form the Error: "+ ee. Message);
}


}


Is there a little inspiration?


In form the Load add
UpdateMouseClickEvent (this);
  •  Tags:  
  • C#
  • Related