コード例 #1
0
        /// <summary>
        /// Shows the info.绑定数据显示到表单
        /// </summary>
        /// <param name="bh">The bh.</param>
        private void ShowInfo(int bh)
        {
            ROYcms.Sys.Bll.ROYcms_news   bll   = new ROYcms.Sys.Bll.ROYcms_news();
            ROYcms.Sys.Model.ROYcms_news model = bll.GetModel(bh);

            this.Date                  = model.time;
            this.txtpic.Text           = model.pic;
            this.txttitle.Text         = model.title;
            this.DdlMenu.SelectedValue = model.classname.ToString();
            this.keyword.Text          = model.keyword;//默认值
            this.txtzhaiyao.Text       = model.zhaiyao;
            FCKeditor1.Value           = model.contents;
            this.txtinfor.Text         = model.infor;
            this.jumpurl.Text          = model.jumpurl;
            this.txtauthor.Text        = model.author;
            this.txturl.Text           = model.url;
            this.txttag.Text           = model.tag;
            this.txthits.Text          = model.hits.ToString();
            this.txtdig.Text           = model.dig.ToString();
            this.orders.Value          = model.orders.ToString();
            if (model.jumpurl != "")
            {
                this.jumpurl_on_of.Checked = true;
            }
            if (model.ding == 0)
            {
                this.ding.Checked = true;
            }
            if (model.tuijian == 0)
            {
                this.tuijian.Checked = true;
            }
            if (model.switchs == 0)
            {
                this.switchs.Checked = true;
            }
            //绑定页面视图参数
            this.GUID      = model.GUID;
            this.ClassKind = Convert.ToInt32(model.type);


            // this.Class = model.classname.ToString();
        }
コード例 #2
0
        /// <summary>
        /// 添加信息方法  Adds the specified i.
        /// </summary>
        /// <param name="i">The i.</param>
        int add(int i)
        {
            string pic = ROYcms.Common.input.Htmls(this.txtpic.Text);


            string title = ROYcms.Common.input.Htmls(this.txttitle.Text);

            if (this.styles.Value != "")
            {
                title = "[size=" + this.styles.Value + "]" + title + "[/size]";
            }
            if (this.colors.Value != "")
            {
                title = "[color=" + this.colors.Value + "]" + title + "[/color]";
            }

            string keyword   = ROYcms.Common.input.Htmls(this.keyword.Text);//默认值
            string zhaiyao   = ROYcms.Common.input.Htmls(this.txtzhaiyao.Text);
            int    classname = int.Parse(this.Class[i]);
            string contents  = FCKeditor1.Value;
            string infor     = ROYcms.Common.input.Htmls(this.txtinfor.Text);

            string author = ROYcms.Common.input.Htmls(this.txtauthor.Text.Trim());
            string url    = ROYcms.Common.input.Htmls(this.txturl.Text);
            string tag    = ROYcms.Common.input.Htmls(this.txttag.Text);
            int    hits   = int.Parse(this.txthits.Text.Trim());
            int    dig    = int.Parse(this.txtdig.Text.Trim());

            string jumpurl = "";

            if (this.jumpurl_on_of.Checked)
            {
                jumpurl = ROYcms.Common.input.Htmls(this.jumpurl.Text.Trim());
            }
            int orders = 0;

            if (this.orders.Value != "")
            {
                orders = int.Parse(this.orders.Value);
            }

            int ding = 1;

            if (this.ding.Checked)
            {
                ding = 0;
            }
            int tuijian = 1;

            if (this.tuijian.Checked)
            {
                tuijian = 0;
            }
            int switchs = 1;

            if (this.switchs.Checked)
            {
                switchs = 0;
            }


            ROYcms.Sys.Model.ROYcms_news model = new ROYcms.Sys.Model.ROYcms_news();
            model.pic   = pic;
            model.title = title;
            if (keyword == "")
            {
                keyword = title;
            }
            else
            {
                model.keyword = keyword;
            }
            if (zhaiyao == "")
            {
                zhaiyao = title;
            }
            else
            {
                model.zhaiyao = zhaiyao;
            }
            model.classname = classname;
            model.contents  = contents;
            model.infor     = infor;
            model.jumpurl   = jumpurl;
            model.author    = author;
            model.url       = url;
            model.tag       = tag;
            model.orders    = orders;
            model.ding      = ding;
            model.tuijian   = tuijian;
            model.dig       = dig;
            model.hits      = hits;
            model.switchs   = switchs;
            model.link      = "";
            model.type      = this.ClassKind.ToString();
            model.GUID      = this.GUID;
            ROYcms.Sys.Bll.ROYcms_news bll = new ROYcms.Sys.Bll.ROYcms_news();

            if (tag != "")
            {
                AddTag(tag);
            }
            int ID = bll.Add(model);

            if (ID != 1)
            {
                Add_New_User(ID);
                ShearFile();
                NewXml(ID);
                NewHtml(ID, classname);
            }
            return(ID);
        }
コード例 #3
0
        /// <summary>
        /// 编辑信息方法 Edits this instance.
        /// </summary>
        protected void edit()
        {
            int    bh    = Convert.ToInt32(this.bh);
            string pic   = this.txtpic.Text;
            string title = this.txttitle.Text;


            if (this.styles.Value != "")
            {
                title = "[size=" + this.styles.Value + "]" + title + "[/size]";
            }
            if (this.colors.Value != "")
            {
                title = "[color=" + this.colors.Value + "]" + title + "[/color]";
            }

            string keyword = this.keyword.Text;//默认值
            string zhaiyao = this.txtzhaiyao.Text;
            // int classname =Convert.ToInt32(this.Class);//////////////////////////////////////////
            int    classname = int.Parse(this.DdlMenu.SelectedValue);
            string contents  = FCKeditor1.Value;
            string infor     = this.txtinfor.Text;

            string author  = this.txtauthor.Text.Trim();
            string url     = this.txturl.Text;
            string tag     = this.txttag.Text;
            int    hits    = int.Parse(this.txthits.Text.Trim());
            int    dig     = int.Parse(this.txtdig.Text.Trim());
            int    orders  = 0;
            string jumpurl = "";

            if (this.jumpurl_on_of.Checked)
            {
                jumpurl = this.jumpurl.Text.Trim();
            }
            if (this.orders.Value != "")
            {
                orders = int.Parse(this.orders.Value);
            }


            int ding = 1;

            if (this.ding.Checked)
            {
                ding = 0;
            }
            int tuijian = 1;

            if (this.tuijian.Checked)
            {
                tuijian = 0;
            }
            int switchs = 1;

            if (this.switchs.Checked)
            {
                switchs = 0;
            }


            ROYcms.Sys.Model.ROYcms_news model = new ROYcms.Sys.Model.ROYcms_news();
            model.bh    = bh;
            model.pic   = pic;
            model.title = title;
            if (keyword == "")
            {
                keyword = title;
            }
            else
            {
                model.keyword = keyword;
            }
            if (zhaiyao == "")
            {
                zhaiyao = title;
            }
            else
            {
                model.zhaiyao = zhaiyao;
            }
            model.classname = classname;
            model.contents  = contents;
            model.infor     = infor;
            model.jumpurl   = jumpurl;
            model.author    = author;
            model.url       = url;
            model.tag       = tag;
            model.orders    = orders;
            model.ding      = ding;
            model.tuijian   = tuijian;
            model.dig       = dig;
            model.hits      = hits;
            model.switchs   = switchs;
            model.link      = "";
            if (this.Date != null)
            {
                model.time = this.Date;
            }
            else
            {
                model.time = DateTime.Now;
            }
            model.type = this.ClassKind.ToString();
            model.GUID = this.GUID;
            ShearFile(); //删除临时附件信息
            NewXml(bh);  //生成XML
            if (Request["Z_url_clk"] == "0")
            {
                Add_New_Url(Convert.ToInt32(this.bh), Request["Z_url"]); //修改路径
            }

            ROYcms.Sys.Bll.ROYcms_news bll = new ROYcms.Sys.Bll.ROYcms_news();
            bll.Update(model);
        }
コード例 #4
0
        /// <summary>
        /// show页面标签 替换
        /// </summary>
        /// <param name="template">模板内容</param>
        /// <returns></returns>
        public string ShowTag(string template)
        {
            if (this.bh != null)
            {
                ROYcms.Sys.Bll.ROYcms_news bll = new ROYcms.Sys.Bll.ROYcms_news();

                DataSet dt    = bll.GetList("bh = '" + this.bh + "'");
                DataSet pg_Dn = bll.GetList("bh > '" + this.bh + "'");
                DataSet pg_Up = bll.GetList("bh < '" + this.bh + "' order by bh DESC");

                if (pg_Dn.Tables[0].Rows.Count > 0)
                {
                    template = Replace(template, @"\[SG:pg_Dn\]", pg_Dn.Tables[0].Rows[0]["title"].ToString());
                    template = Replace(template, @"\[SG:pg_Dn_Link\]", pg_Dn.Tables[0].Rows[0]["jumpurl"].ToString() == "" ? (config.web_host + TemplateZone.Zpath(this.pageHost) + "show" + this.templet + "-" + pg_Dn.Tables[0].Rows[0]["bh"].ToString() + "-" + Convert.ToDateTime(pg_Dn.Tables[0].Rows[0]["time"]).ToString("yyyyMM") + config.web_forge) : pg_Dn.Tables[0].Rows[0]["jumpurl"].ToString());
                }
                else
                {
                    template = Replace(template, @"\[SG:pg_Dn\]", "无数据");
                    template = Replace(template, @"\[SG:pg_Dn_Link\]", "#");
                }
                if (pg_Up.Tables[0].Rows.Count > 0)
                {
                    template = Replace(template, @"\[SG:pg_Up\]", pg_Up.Tables[0].Rows[0]["title"].ToString());
                    template = Replace(template, @"\[SG:pg_Up_Link\]", pg_Up.Tables[0].Rows[0]["jumpurl"].ToString() == "" ? (config.web_host + TemplateZone.Zpath(this.pageHost) + "show" + this.templet + "-" + pg_Up.Tables[0].Rows[0]["bh"].ToString() + "-" + Convert.ToDateTime(pg_Up.Tables[0].Rows[0]["time"]).ToString("yyyyMM") + config.web_forge) : pg_Up.Tables[0].Rows[0]["jumpurl"].ToString());
                }
                else
                {
                    template = Replace(template, @"\[SG:pg_Up\]", "无数据");
                    template = Replace(template, @"\[SG:pg_Up_Link\]", "#");
                }
                template = Replace(template, @"\[SG:UrlPath\]", config.web_host);
                Regex r = new Regex(@"(\[SG:Field\s+name=" + "\"" + @"(?<name>[^" + "\"" + "]*)" + "\"" + @"\])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
                if (dt.Tables[0].Rows.Count > 0)
                {
                    foreach (Match m in r.Matches(template))
                    {
                        string name = m.Groups["name"].ToString().ToLowerInvariant();
                        if (name == "year")
                        {
                            template = template.Replace(m.Groups[0].Value.ToString(), Convert.ToDateTime(dt.Tables[0].Rows[0]["time"]).Date.Year.ToString());
                        }
                        else if (name == "month")
                        {
                            template = template.Replace(m.Groups[0].Value.ToString(), Convert.ToDateTime(dt.Tables[0].Rows[0]["time"]).Date.Month.ToString());
                        }
                        else if (name == "day")
                        {
                            template = template.Replace(m.Groups[0].Value.ToString(), Convert.ToDateTime(dt.Tables[0].Rows[0]["time"]).Date.Day.ToString());
                        }
                        else
                        {
                            try
                            {
                                template = template.Replace(m.Groups[0].Value.ToString(), dt.Tables[0].Rows[0][name].ToString());
                            }
                            catch { return("标签定义出错"); }
                        }
                    }
                }
            }
            else
            {
                return(template);
            }

            return(template);
        }