Пример #1
0
    //全部复制
    protected void btnallfz_Click(object sender, EventArgs e)
    {
        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle();
        string ls_tip = "全部复制成功!";

        TPortalClass.JpSite JpSite = new TPortalClass.JpSite();
        string ls_html = JpSite.fax;
        string ls_ids = "";
        //根据栏目ID得到该栏目下所有文章
        DataTable dt = JpArticle.GetArticlesByCid_fb(this.txtcid.Text);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            int id = (int)dt.Rows[i]["aid"];
            string ls_cids = this.txtcheckcid.Text;
            string[] lv_cids = ls_cids.Split('+');
            for (int j = 0; j < lv_cids.Length; j++)
            {
                if (lv_cids[j] != "")
                {
                    JpArticle.cid = lv_cids[j];
                    JpArticle.title = dt.Rows[i]["title"].ToString();
                    JpArticle.subhead = dt.Rows[i]["subhead"].ToString();
                    JpArticle.ht_content = dt.Rows[i]["ht_content"].ToString();
                    JpArticle.summary = dt.Rows[i]["summary"].ToString();
                    JpArticle.author = dt.Rows[i]["author"].ToString();
                    JpArticle.status = dt.Rows[i]["status"].ToString();
                    JpArticle.indexdisplaypicpath = dt.Rows[i]["indexdisplaypicpath"].ToString();
                    JpArticle.seotitle = dt.Rows[i]["seotitle"].ToString();
                    JpArticle.seokeywords = dt.Rows[i]["seokeywords"].ToString();
                    JpArticle.seodescription = dt.Rows[i]["seodescription"].ToString();
                    JpArticle.asort = (int)dt.Rows[i]["asort"];
                    JpArticle.iftop = dt.Rows[i]["iftop"].ToString();
                    JpArticle.topendtime = dt.Rows[i]["topendtime"].ToString();
                    JpArticle.ifindexdisplay = dt.Rows[i]["ifindexdisplay"].ToString();
                    JpArticle.ifcomment = dt.Rows[i]["ifcomment"].ToString();
                    JpArticle.source = dt.Rows[i]["source"].ToString();
                    JpArticle.role_userid = dt.Rows[i]["role_userid"].ToString();
                    JpArticle.role_username = dt.Rows[i]["role_username"].ToString();
                    JpArticle.input = dt.Rows[i]["input"].ToString();
                    JpArticle.GUID = System.Guid.NewGuid().ToString();
                    JpArticle.map_cid = dt.Rows[i]["map_cid"].ToString();
                    JpArticle.map_aid = (int)dt.Rows[i]["map_aid"];
                    JpArticle.targettype = dt.Rows[i]["targettype"].ToString();
                    JpArticle.endtime = dt.Rows[i]["endtime"].ToString();
                    JpArticle.pubtime = dt.Rows[i]["pubtime"].ToString();
                    int ls_newaid = JpArticle.Insert();
                    if (ls_ids == "")
                    {
                        ls_ids = ls_newaid.ToString();
                    }
                    else
                    {
                        ls_ids = ls_ids + "," + ls_newaid.ToString();
                    }
                }

            }
        }
        string pageUrl = "";

        pageUrl = JpCommon.CombUrlTxt("list_article_fb.aspx", "page={0}&rnd={1}&cid={2}",
            "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid.Text + "");

        if (ls_ids != "")
        {
            //静态发布时使用
            string ls_pubtime = System.DateTime.Now.ToString();
            string ls_endtime = System.DateTime.Now.AddYears(10).ToString();
            if (ls_html == "开启")
            {
                JpArticle.PubAll("," + ls_ids + ",", ls_pubtime, ls_endtime);
            }
            //写系统日志
            string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            if (userip == null || userip == "")
            {
                userip = Request.ServerVariables["REMOTE_ADDR"];
            }
            JpCommon.WriteLog(userip, "全部复制", "全部复制文章栏目ID:" + this.txtcid.Text, Session["uid"].ToString(), Session["uname"].ToString());
        }
        else
        {
            ls_tip = "全部复制失败!请选中复制源栏目和选择目标栏目。";
        }
        Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>");
    }
Пример #2
0
    //全部转移
    protected void btnallzy_Click(object sender, EventArgs e)
    {
        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle();
        string ls_tip = "批量转移成功!";

        TPortalClass.JpSite JpSite = new TPortalClass.JpSite();
        string ls_html = JpSite.fax;
        string ls_ids = "";
        //根据栏目ID得到该栏目下所有文章
        DataTable dt = JpArticle.GetArticlesByCid_fb(this.txtcid.Text);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            int id = (int)dt.Rows[i]["aid"];
            if (ls_ids == "")
            {
                ls_ids = id.ToString();
            }
            else
            {
                ls_ids = ls_ids + "," + id.ToString();
            }
            string ls_cids = this.txtcheckcid.Text;
            string[] lv_cids = ls_cids.Split('+');
            for (int j = 0; j < lv_cids.Length; j++)
            {
                if (lv_cids[j] != "")
                {
                    JpArticle.aid = id;
                    JpArticle.cid = lv_cids[j];
                    JpArticle.UpdatePlzylm();
                }
            }

        }
        string pageUrl = "";
        pageUrl = JpCommon.CombUrlTxt("list_article_fb.aspx", "page={0}&rnd={1}&cid={2}",
            "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid.Text + "");

        if (ls_ids != "")
        {
            string ls_pubtime = System.DateTime.Now.ToString();
            string ls_endtime = System.DateTime.Now.AddYears(10).ToString();
            if (ls_html == "开启")
            {
                JpArticle.PubAll("," + ls_ids + ",", ls_pubtime, ls_endtime);
            }
            //写系统日志
            string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            if (userip == null || userip == "")
            {
                userip = Request.ServerVariables["REMOTE_ADDR"];
            }
            JpCommon.WriteLog(userip, "全部转移", "将栏目ID:" + this.txtcid.Text + "全部转移到栏目ID:" + this.txtcheckcid.Text, Session["uid"].ToString(), Session["uname"].ToString());
        }
        else
        {
            ls_tip = "全部转移失败!请选中复制源栏目和选择一个目标栏目。";
        }

        Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>");
    }