public void start() { var accounts = AccountBLL.GetAllAccount(); AccountBLL.UpdateUseState(); var iHour = DateTime.Now.Hour; 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); } } // }); } //aTimer.Elapsed += new ElapsedEventHandler(TimedEvent); //aTimer.Interval = 1000; //配置文件中配置的秒数 //aTimer.Enabled = true; }
public static void UpateAccount(int iHour) { var sql = string.Format(@" update [user] set isSend1=1 where {0} between startHour1 and endHour1; update [user] set isSend2=1 where {0} between startHour2 and endHour2; update [user] set isSend3=1 where {0} between startHour3 and endHour3;", iHour); WebsiteBLL.ArticleBak(sql); AccountBLL.GetAllAccount(true); }
/// <summary> /// 售后服务单状态及物流更新 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TimedEvent(object sender, ElapsedEventArgs e) { int iHour = e.SignalTime.Hour; int iMinute = e.SignalTime.Minute; aTimer.Enabled = false; try { var accounts = AccountBLL.GetAllAccount(); if (iHour == 1 && iMinute == 30) { AccountBLL.UpdateUseState(); } 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) { var hostDataTable = task.Result; AutoWeb.AutoWebSit(contentNum, useid, hostDataTable, iHour, webGroupId, context); } } // }); } } catch (Exception ex) { LogWrite.Write("自动发布" + ex.Message); } finally { aTimer.Enabled = true; } }
public ActionResult List(string Search, int PageIndex, int PageSize) { string Count = ""; AccountBLL AccountBLL = new AccountBLL(); AccountListEntityDC data = new AccountListEntityDC(); GlobalModel global = new GlobalModel(); string companyid = null; if (global.SelectUserRoleID != "1") { companyid = global.Company; } data = AccountBLL.GetAllAccount(Search, PageIndex, PageSize); Dictionary <string, object> retData = new Dictionary <string, object>(); // FOR RESPONSE retData.Add("data", data); retData.Add("total", Count); return(Json(retData, JsonRequestBehavior.AllowGet)); }
public static string AutoWebSit(int contextNum, string userId, DataTable webData, int iHour, string webGroupId, int contextCount) { if (webData != null && webData.Rows.Count > 0) { var sql = string.Empty; var contextDataTable = WebsiteBLL.GetAllArticleByIsRead(contextNum, userId, webGroupId); if (contextDataTable != null && contextDataTable.Rows.Count > 0 && webData != null && webData.Rows.Count > 0) { foreach (DataRow context in contextDataTable.Rows) { int i = 0; foreach (DataRow h in webData.Rows) { if (i >= contextCount || i > webData.Rows.Count) { sql += string.Format(@"insert into articleBak([title],[seoWord],[content],[IsImage],[websitCategory],[contentCategoryName] ,[contentCategoryId],[userid],[date],[isRead],[webGroupid]) select [title],[seoWord],[content],[IsImage],[websitCategory],[contentCategoryName] ,[contentCategoryId],[userid],GETDATE() ,[isRead],[webGroupid] from article where article.id = {0} ;delete from article where id ={0} ;", context["id"].ToString()); break; } i++; Task.Factory.StartNew(() => { var webKeyWords = WebsiteBLL.GetWebKey(h["id"].ToString()); if (h["webPlatformId"].ToString() == "1") { var cookieTask = GetCookie(h["loginName"].ToString(), h["loginPassword"].ToString(), h["webHost"].ToString(), h["webAdminUrl"].ToString()); cookieTask.Wait(); if (cookieTask.Result != null && cookieTask.Result != "") { var webWords = string.Empty; var content = WebsiteBLL.GetWebContext(webKeyWords, context["content"].ToString(), h["webImgPath"].ToString(), out webWords); var task = AutoRelease6System(cookieTask.Result, h["webCategoryCode"].ToString(), h["sixHost"].ToString(), h["categoryCode"].ToString(), context["title"].ToString(), webWords, content, null); if (task.Result.IndexOf("发布成功") < 0) { Thread.Sleep(1000); task = AutoRelease6System(cookieTask.Result, h["webCategoryCode"].ToString(), h["sixHost"].ToString(), h["categoryCode"].ToString(), context["title"].ToString(), webWords, content, null); } } } else { var cookieTask = GetECMSCookie(h["loginName"].ToString(), h["loginPassword"].ToString(), h["webHost"].ToString(), h["webAdminUrl"].ToString()); cookieTask.Wait(); if (cookieTask.Result != null && cookieTask.Result.Count > 0) { var cookie = cookieTask.Result; var webWords = string.Empty; var content = WebsiteBLL.GetWebContext(webKeyWords, context["content"].ToString(), h["webImgPath"].ToString(), out webWords); var task = AutoReleaseECMS(cookie[0], cookie[1], cookie[2], cookie[3], h["webCategoryCode"].ToString(), h["webHost"].ToString(), h["categoryCode"].ToString(), context["title"].ToString(), webWords, content, h["webAdminUrl"].ToString(), null); if (task.Result.IndexOf("增加信息成功") < 0) { Thread.Sleep(1000); task = AutoReleaseECMS(cookie[0], cookie[1], cookie[2], cookie[3], h["webCategoryCode"].ToString(), h["webHost"].ToString(), h["categoryCode"].ToString(), context["title"].ToString(), webWords, content, h["webAdminUrl"].ToString(), null); } } } }); } } sql += string.Format(@" update [user] set isSend1=1 where {0} between startHour1 and endHour1; update [user] set isSend2=1 where {0} between startHour2 and endHour2; update [user] set isSend3=1 where {0} between startHour3 and endHour3;", iHour); WebsiteBLL.ArticleBak(sql); AccountBLL.GetAllAccount(true); } } return(""); }