110,534
社区成员
发帖
与我相关
我的任务
分享
//获取所有车次ID
public DataTable getAllCheci()
{
String sql = "select Id from t_chec where datediff(second,getdate(),ftime)>0 and datediff(ss,ftime,getdate())<kaissp and datediff(ss,ftime,getdate())<KaiSYd";
return AccessDal.SqlHelper.ExecuteDataset(Pub.Connectionstring, CommandType.Text, sql).Tables[0];
}
public void setValue(int value)
{
progressBar2.Value = value;
Thread.Sleep(1000);
}
protected void Proce(object sender, EventArgs e)
{
Application.DoEvents();
DataTable dtCheci = getAllCheci();
progressBar2.Maximum = dtCheci.Rows.Count;
int j = 1;
for (int i = 0; i < dtCheci.Rows.Count; i++)
{
string result = bcz.ChangeZuoXActionstringStatusByYuDTime(dtCheci.Rows[i]["Id"].ToString());
Thread.Sleep(100);
Invoke(new setProgressBarValue(setValue), j);
j++;
if (result != "")
{
String sql = "insert into Log(CZR,CZDate,CZIP,TableName,CZID,CZLX)values(@czr,@czdate,@czip,@table,@czid,@czlx)";
SqlParameter[] param = new SqlParameter[] {
new SqlParameter("@czr",SqlDbType.Int,4),
new SqlParameter("@czdate",SqlDbType.DateTime,8),
new SqlParameter("@czip",SqlDbType.VarChar,50),
new SqlParameter("@table",SqlDbType.VarChar,50),
new SqlParameter("@czid",SqlDbType.Int,4),
new SqlParameter("@czlx",SqlDbType.Int,4)
};
param[0].Value = Convert.ToInt32(Pub.Userid);
param[1].Value = DateTime.Now;
param[2].Value = Pub.LoginIp;
param[3].Value = "t_chec";
param[4].Value = Convert.ToInt32(dtCheci.Rows[i]["Id"].ToString());
param[5].Value = 1;
sp.ExecuteIntoLog(sql, param);
}
Thread.Sleep(100);
}
}
private void testlx_Load(object sender, EventArgs e)
{
this.BeginInvoke(new EventHandler(Proce), this, EventArgs.Empty);
}