예제 #1
0
        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);
        }
예제 #2
0
        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);
                                        }
                                    }
                                }
                            });
                        }
                    }
                    WebsiteBLL.ArticleBak(sql);
                }
            }
            return(string.Empty);
        }