Pass parameter Timer
private static System.Timers.Timer Atimer;
Main (Approvalid);
public static void Main (int approvalid)
{
Atimer = new System.Timers.Timer (600000); 10 min 600000
atimer.elapsed + = new Elapsedeventhandler ((S, e) = Ontimedevent (S, E, approvalid));
Atimer.interval = 60000;
Atimer.enabled = true;
Atimer.autoreset = false;
}
private static void Ontimedevent (object source, Elapsedeventargs e, int approvalid)
{
Unlock Application Form
Model.Sys.ShenPiApprovalModel SQM = new Shenpiapprovalmodel ();
SQM = BLL. Sys.ShenPiApprovalBLL.Instance.GetModel (Approvalid);
if (SQM. Approvalstate! = 1)
{
SQM. Approvalstate = 0;//Lock Request Form
Bll. Sys.ShenPiApprovalBLL.Instance.UpdateJS (0, "id=" + Approvalid + "");
}
}
Two
Non-pass parameter timer
System.Timers.Timer t = new System.Timers.Timer (60000);//Instantiate Timer class, set interval time is 10000 milliseconds;
t.elapsed + = new System.Timers.ElapsedEventHandler (theout);//The event is executed at time of arrival;
T.autoreset = false;//Whether the setting is executed once (false) or always executed (true);
t.enabled = true;//Whether the System.Timers.Timer.Elapsed event is performed;
Timer function
public void Theout (object source, System.Timers.ElapsedEventArgs e)
{
Model.User.UserModel userm = new Model.User.UserModel ();
var MM = BLL. User.UserBLL.Instance.GetModel (6326);
Mm. Linkman = "Timer I am";
Bll. User.UserBLL.Instance.Update (MM);
}
C # Timer Pass value problem