Example #1
0
    private void DataPlay()
    {
        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改
        }
        if (this.Request.QueryString["aid"] != null)
        {
            this.txtaid.Text = this.Request.QueryString["aid"].ToString();           //文章ID
        }
        if (this.Request.QueryString["cid"] != null)
        {
            this.txtcid.Text = this.Request.QueryString["cid"].ToString();           //栏目ID
            if (this.txtcid.Text.Contains(","))
                this.txtcid.Text = this.txtcid.Text.Substring(0, this.txtcid.Text.IndexOf(","));
        }

        TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle();
        //新文档
        if (this.txtop.Value == "add")
        {
            this.txtendtime.Text = System.DateTime.Now.AddYears(10).ToString();
            this.txtpubtime.Text = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            this.txtguid.Text = System.Guid.NewGuid().ToString(); //直接返回字符串类型
            this.txttopendtime.Value = System.DateTime.Now.AddDays(5).ToString("yyyy-MM-dd");
            //this.ddlcolname.SelectedValue = this.cid;

            //根据栏目ID得到栏目名称start
            TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns();
            DataTable dtcols = JpColumns.GetColumnBycid(this.cid);
            this.txtcolname.Text = dtcols.Rows[0]["cname"].ToString();
            //根据栏目ID得到栏目名称end
            this.txtauthor.Text = this.Session["uname"].ToString();
            DataTable dtsort = JpArticle.Getmaxsort();
            if (dtsort.Rows.Count > 0)
            {
                this.txtasort.Text = (System.Int32.Parse(dtsort.Rows[0]["asort"].ToString()) + 2).ToString();
            }
            else
            {
                this.txtasort.Text = "1";
            }
        }
        //旧文档
        if (this.txtop.Value == "modify")
        {
            DataTable dt = JpArticle.GetArticleByaid(System.Int32.Parse(this.txtaid.Text));

            if (dt.Rows.Count > 0)
            {

                this.txtendtime.Text = dt.Rows[0]["endtime"].ToString();
                this.txtpubtime.Text = dt.Rows[0]["pubtime"].ToString();

                //根据栏目ID得到栏目名称start
                TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns();
                DataTable dtcols = JpColumns.GetColumnBycid(dt.Rows[0]["cid"].ToString());
                this.txtcolname.Text = dtcols.Rows[0]["cname"].ToString();
                //根据栏目ID得到栏目名称end

                this.txttitle.Text = dt.Rows[0]["title"].ToString();
                this.txttitle2.Text = dt.Rows[0]["subhead"].ToString();
                this.content1.Value = dt.Rows[0]["ht_content"].ToString();
                this.txtauthor.Text = dt.Rows[0]["author"].ToString();
                this.txtsummary.Text = dt.Rows[0]["summary"].ToString();
                this.txtsummary.Text = dt.Rows[0]["summary"].ToString();
                this.txtseotitle.Text = dt.Rows[0]["seotitle"].ToString();
                this.txtseokeywords.Text = dt.Rows[0]["seokeywords"].ToString();
                this.txtseodescription.Text = dt.Rows[0]["seodescription"].ToString();
                this.txtasort.Text = dt.Rows[0]["asort"].ToString(); ;
                this.txttopendtime.Value = DateTime.Parse(dt.Rows[0]["topendtime"].ToString()).ToString("yyyy-MM-dd");
                this.txtsource.Value = dt.Rows[0]["source"].ToString();
                this.txtguid.Text = dt.Rows[0]["GUID"].ToString();
                this.txtrole_userid.Text = dt.Rows[0]["role_userid"].ToString(); ;
                this.txtrole_username.Text = dt.Rows[0]["role_username"].ToString();
                this.txtpic.Value = dt.Rows[0]["indexdisplaypicpath"].ToString();
                if (dt.Rows[0]["map_cid"].ToString() != "")
                {
                    ddllb.SelectedValue = dt.Rows[0]["map_cid"].ToString();
                }
                if (dt.Rows[0]["indexdisplaypicpath"].ToString() != "")
                {
                    this.lblpic.Text = "<img src='" + dt.Rows[0]["indexdisplaypicpath"].ToString() + "'  onError=\"this.src='/images/nophoto.jpg';\" width=60px height=55px />";
                }
                else
                {
                    this.lblpic.Text = "";
                }
                this.ddlsfzd.SelectedValue = dt.Rows[0]["iftop"].ToString();
                if (dt.Rows[0]["iftop"].ToString() == "1")
                {
                    ls_xs1 = "inline";
                }
                this.ddlsfsyss.SelectedValue = dt.Rows[0]["ifindexdisplay"].ToString();
                if (dt.Rows[0]["ifindexdisplay"].ToString() == "1")
                {
                    ls_xs2 = "inline";
                }
                if (dt.Rows[0]["sfzwd"].ToString() == "否")
                {
                    radlist.SelectedValue = "否";
                    ls_xs3 = "";
                    ddlwz.SelectedValue = dt.Rows[0]["zwdid"].ToString();
                }
            }
        }
    }