Esempio n. 1
0
    //批量转移
    protected void btnplzy_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 = "";
        for (int i = 0; i < rptList.Items.Count; i++)
        {
            int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
            //string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value;
            CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
            if (cb.Checked)
            {
                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:" + ls_ids, Session["uid"].ToString(), Session["uname"].ToString());
        }
        else
        {
            ls_tip = "批量转移失败!请选中复制源文章和选择一个目标栏目。";
        }

        Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>");
    }
Esempio n. 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>");
    }