time = new System.Timers.Timer(1000 * 10);
time.Enabled = true;
time.Elapsed += this.TimeOut;
time.Start();
{
try
{
string ids = "";
string sql = "";
string errorPath = "E:\\Item_eidt.log";
if (!File.Exists(errorPath))
{
FileStream create = File.Create(errorPath);
create.Close();
}
else
{
FileStream fs = new FileStream(errorPath, FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs);
ids = sr.ReadToEnd().Replace(" ", "");
//{
// if (ids == "")
// {
// ids = sr.ReadLine().Trim().Replace(" ", "");
// }
// else
// {
// ids += "|" + sr.ReadLine().Trim().Replace(" ", "");
// }
//}
sr.Close();
fs.Close();
// sw.WriteLine("Exception: " + ex.Message + " --" + DateTime.Now.ToString());
// sw.Flush();
// sw.Close();
}
if (ids != "")
{
//ids = ids.Trim().Replace(" ", "").Replace("||", "|").Replace("||", "|").Replace("|", ",");
sql = "select * from ItemInfo_Edit where i_e_nowstate=1 and addtime < getdate() and id not in (" + ids + ")";
}
else
{
sql = "select * from ItemInfo_Edit where i_e_nowstate=1 and addtime < getdate()";
}
if (dt.Rows.Count > 0)
{
sql = "有 " + dt.Rows .Count .ToString ()+ " 条修改信息等待处理。";
ids = "";
FileStream fw = new FileStream(errorPath, FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(fw);
for (int i = 0; i < dt.Rows.Count; i++)
{
if (ids == "")
ids = dt.Rows[i]["id"].ToString();
else
ids +="," + dt.Rows[i]["id"].ToString();
sql += " 【 " + dt.Rows[i]["i_e_title"].ToString() + " 】";
}
sw.Write(ids);
sw.Flush();
sw.Close();
fw.Close();
}
}
catch (Exception ex)
{