protected void PushAll_Btn_Click(object sender, EventArgs e)
        {
            CurDT.DefaultView.RowFilter = "";
            int count = CurDT.Rows.Count;

            PushContent(CurDT);
            ReBind();
            ScriptManager.RegisterStartupScript(LeftPanel, LeftPanel.GetType(), "", "<script>alert('推送完成,已" + count + "篇内容');</script>", false);
        }
 protected void PushSel_Btn_Click(object sender, EventArgs e)
 {
     //另外还需要加入来源判断吧,或重新生成Index直接从dt中取值
     if (!string.IsNullOrEmpty(Request.Form["idchk"]))
     {
         CurDT.DefaultView.RowFilter = "Index IN(" + Request.Form["idchk"] + ")";
         int count = CurDT.DefaultView.ToTable().Rows.Count;
         PushContent(CurDT.DefaultView.ToTable());
         ReBind();
         ScriptManager.RegisterStartupScript(LeftPanel, LeftPanel.GetType(), "", "<script>alert('推送完成,已" + count + "篇内容');</script>", false);
     }
 }
        /// <summary>
        /// 推送文章
        /// </summary>
        /// <param name="dt">需要推送的文章dt</param>
        private void PushContent(DataTable dt)
        {
            if (dt == null || dt.Rows.Count < 0)
            {
                return;
            }
            HttpHelper http     = new HttpHelper();
            HtmlHelper htmlHelp = new HtmlHelper();

            string[] strArr = new string[] { "http://chanye.hbncw.cn:8080/AddArticle.aspx|CYT", "http://dqt.hbncw.net:89/AddArticle.aspx|DQT" };
            foreach (string str in strArr)
            {
                string url  = str.Split('|')[0];
                string plat = str.Split('|')[1];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    try
                    {
                        DataRow dr = dt.Rows[i];
                        Dictionary <string, object> param = new Dictionary <string, object>();
                        param.Add("Title", dr["Title"]);
                        string content = htmlHelp.ConvertImgUrl(dr["Contents"].ToString(), SiteConfig.SiteInfo.SiteUrl);
                        param.Add("Contents", HttpUtility.UrlEncode(content)); //这里需要对方用UrlDecode
                        param.Add("CateName", dr["CateName"]);                 //目标栏目名称
                        param.Add("Author", dr["Author"]);
                        param.Add("PublishDate", dr["PublishDate"]);
                        param.Add("ImgUrl", dr["ImgUrl"]);
                        param.Add("Keyword", dr["Keyword"]);
                        param.Add("CityName", dr["CityName"]);
                        param.Add("Platform", dr["Platform"]);
                        param.Add("ProductType", plat);
                        HttpResult result = http.UploadParam(url, param);
                        if (!result.Html.Contains("-1"))
                        {
                            UpdateCatch(dr);
                        }
                    }
                    catch (Exception ex)
                    {
                        ScriptManager.RegisterStartupScript(LeftPanel, LeftPanel.GetType(), "", "<script>alert('推送错误,原因:" + ex.Message + "');</script>", false);
                    }
                }
            }

            //有几个问题需要咨询
            //1,文章是否要同时推送到党群与产业通,或根据节点,推送至不同的平台(党群||产业通)
            //2,对方有无对我们的内容解码处理
            //3,需要配置好栏目节点之间的对应XML
            //1,图片需要转为http格式(需要配后应)
        }
Exemple #4
0
    protected void leftSwitch_Btn_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(Request.Form["left_Hid"]))
        {
            return;
        }
        string      ascxName = Request.Form["left_Hid"].ToLower();
        UserControl control  = null;

        if (ascxName.IndexOf("?") > 0)
        {
            //NodeTree.ascx?url=Content/ContentRecycle.aspx
            string param = ascxName.Split('?')[1];
            ascxName = ascxName.Split('?')[0];
            control  = (UserControl)Page.LoadControl(ascxPath += ascxName);
            control.Attributes["Url"] = param.Split('=')[1];
        }
        else
        {
            control = (UserControl)Page.LoadControl(ascxPath += ascxName);
        }
        left_Div.Controls.Add(control);
        ScriptManager.RegisterStartupScript(LeftPanel, LeftPanel.GetType(), "", "<script>ascxInit('" + ascxName + "');ClearSpin();DivCache('" + ascxName.ToLower() + "');setLayout();</script>", false);
    }