private void TimedEvent(object sender, ElapsedEventArgs e) { int iHour = e.SignalTime.Hour; int iMinute = e.SignalTime.Minute; int iSecond = e.SignalTime.Second; aTimer.Enabled = false; try { var accounts = AccountBLL.GetAllAccount(); foreach (DataRow dr in accounts.Rows) { Task.Factory.StartNew(() => { int contentNum = 0; if (AutoWeb.isSend(dr, ref contentNum, iHour)) { string useid = dr["id"].ToString(); string webGroupId = dr["id1"].ToString(); int context = int.Parse(dr["groupCount"].ToString()); var task = AutoWeb.GetWebSiteAwaitTask(webGroupId); task.Wait(); if (task != null && task.Result != null && task.Result.Rows.Count > 0) { var hostDataTable = task.Result; AutoWeb.AutoWebSit(contentNum, useid, hostDataTable, iHour, webGroupId, context); } } }); } AutoWeb.UpateAccount(iHour); } catch (Exception ex) { LogWrite.Write("自动发布" + ex.Message); } finally { aTimer.Enabled = true; } }
private void TimedEventb(object sender, ElapsedEventArgs e) { int iHour = e.SignalTime.Hour; int iMinute = e.SignalTime.Minute; int iSecond = e.SignalTime.Second; aTimer.Enabled = false; try { if (iHour == 1 && iMinute == 30 && iSecond <= 1) { AccountBLL.UpdateUseState(); } } catch (Exception ex) { LogWrite.Write("自动发布" + ex.Message); } finally { aTimer.Enabled = true; } }