예제 #1
0
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            var bll = BLL.TcArticle.Instance;
            var m   = id > 0 ? bll.GetModel(id) : new Model.TcArticle();

            if (m == null)
            {
                m = new Model.TcArticle();
            }
            m.Title = txt_title.Text.GetString();

            //m.Jianyao = txt_jianyao.Text.GetString();
            m.Fenleiid = ddl_fenlei.SelectedValue.GetInt();
            m.Content  = Request.Form["txt_content"].GetString().FilterSql();
            m.Jianyao  = m.Content.DeleteHMTL().Subs(180);
            m.Tupian   = this.hd_tupian.Value.GetString();
            m.Types    = types;
            if (id > 0)
            {
                bll.Update(m);//更新
            }
            else
            {
                m.Addtime = DateTime.Now;
                bll.Add(m);//添加
            }

            Alert("保存成功!", "list.aspx?types=" + types);
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var id = Request.QueryInt("id");
         if (id > 0)
         {
             art = BLL.TcArticle.Instance.GetModel(id);
             if (art != null)
             {
                 art.Click = art.Click.GetInt() + 1;
                 BLL.TcArticle.Instance.Update(art);
                 var c = BLL.TcChanpin.Instance.GetModelList("articleid=" + id);
                 if (c.Count > 0)
                 {
                     prt = c[0];
                 }
                 cate = BLL.TcFenlei.Instance.GetModel(art.Fenleiid.GetInt());
                 if (cate == null)
                 {
                     cate = new Model.TcFenlei();
                 }
             }
             else
             {
                 art = new Model.TcArticle();
             }
         }
     }
 }
예제 #3
0
        public void LoadData()
        {
            var id = Request.QueryInt("id");

            if (id > 0)
            {
                if (art.Fill(id))
                {
                    art.Click = art.Click.GetInt() + 1;
                    art.Update("id=" + id);

                    if (cate.Fill(art.Fenleiid))
                    {
                    }
                    else
                    {
                        cate = new Model.TcFenlei()
                        {
                            Name = ""
                        };
                    }
                }
                else
                {
                    art = new Model.TcArticle();
                }
            }
        }
예제 #4
0
        public void BindPrev(string types)
        {
            var id = Request.QueryInt("id");
            List <Model.TcArticle> lspd = art.Select(1, " types='" + types + "' order by id").ToList <Model.TcArticle>();

            if (lspd[0].ID != id)
            {
                List <Model.TcArticle> ls = art.Select(1, " types='" + types + "' and id<" + id + " order by id desc").ToList <Model.TcArticle>();
                art = ls[0];
            }
        }
예제 #5
0
        /// <summary>
        /// 根据标题获取广告名称
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static Model.TcArticle get_ad_md(string url)
        {
            var md = new Model.TcArticle();

            if (md.Fill("url='" + url + "'"))
            {
                return(md);
            }
            else
            {
                return(new Model.TcArticle());
            }
        }
예제 #6
0
        /// <summary>
        /// 获取广告内容
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static string get_ad(string url)
        {
            var md = new Model.TcArticle();

            if (md.Fill("url='" + url + "'"))
            {
                return(md.Content);
            }
            else
            {
                return("");
            }
        }
예제 #7
0
        /// <summary>
        /// 获取单页内容
        /// </summary>
        /// <param name="ename"></param>
        /// <returns></returns>
        public static Model.TcArticle get_danye_model(string ename)
        {
            var md = new Model.TcArticle();

            if (md.Fill("url='" + ename + "'"))
            {
                return(md);
            }
            else
            {
                return(new Model.TcArticle());
            }
        }
예제 #8
0
        /// <summary>
        /// 获取下一篇
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Model.TcArticle get_next_article(int id, string types)
        {
            var list = get_article(1, "types='" + types + "' and id>" + id, "id");
            var m    = new Model.TcArticle()
            {
                ID = 0
            };

            if (list.Count > 0)
            {
                m = list[0];
            }
            return(m);
        }
예제 #9
0
        public void LoadData()
        {
            var s = Request.QueryString["n"].GetString().FilterSql();

            if (s.Length > 0)
            {
                var type = "danye";

                var list = new Model.TcArticle().Select("types='" + type + "' and url='" + s + "'").ToList <Model.TcArticle>();
                if (list.Count > 0)
                {
                    mdy = list[0];
                }
            }
        }
예제 #10
0
        /// <summary>
        /// 获取下一篇
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Model.TcArticle get_next_article(int id, string types, string where)
        {
            if (where.Length > 0)
            {
                where = " and " + where;
            }
            var list = get_article(1, "types='" + types + "' and id>" + id + where, "id");
            var m    = new Model.TcArticle()
            {
                ID = 0
            };

            if (list.Count > 0)
            {
                m = list[0];
            }
            return(m);
        }
예제 #11
0
파일: ArtInfo.cs 프로젝트: lcx19910911/qyz
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var id = Request.QueryInt("id");
         if (id > 0)
         {
             art = BLL.TcArticle.Instance.GetModel(id);
             if (art != null)
             {
                 cate = BLL.TcFenlei.Instance.GetModel(art.Fenleiid.GetInt());
                 if (cate == null)
                 {
                     cate = new Model.TcFenlei();
                 }
             }
             else
             {
                 art = new Model.TcArticle();
             }
         }
     }
 }