protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(Request.Params["id"] as string, out Id))
     {
         Server.Transfer("error.aspx");
         return;
     }
     DtCms.BLL.Article bll = new DtCms.BLL.Article();
     if (!bll.Exists(Id))
     {
         Server.Transfer("error.aspx");
         return;
     }
     model = bll.GetModel(Id);
     //浏览数+1
     bll.UpdateField(this.Id, "Click=Click+1");
 }
Ejemplo n.º 2
0
        //设置操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(((Label)e.Item.FindControl("lb_id")).Text);

            DtCms.BLL.Article   bll   = new DtCms.BLL.Article();
            DtCms.Model.Article model = bll.GetModel(id);
            switch (e.CommandName.ToLower())
            {
            case "ibtnmsg":
                if (model.IsMsg == 1)
                {
                    bll.UpdateField(id, "IsMsg=0");
                }
                else
                {
                    bll.UpdateField(id, "IsMsg=1");
                }
                break;

            case "ibtntop":
                if (model.IsTop == 1)
                {
                    bll.UpdateField(id, "IsTop=0");
                }
                else
                {
                    bll.UpdateField(id, "IsTop=1");
                }
                break;

            case "ibtnred":
                if (model.IsRed == 1)
                {
                    bll.UpdateField(id, "IsRed=0");
                }
                else
                {
                    bll.UpdateField(id, "IsRed=1");
                }
                break;

            case "ibtnhot":
                if (model.IsHot == 1)
                {
                    bll.UpdateField(id, "IsHot=0");
                }
                else
                {
                    bll.UpdateField(id, "IsHot=1");
                }
                break;

            case "ibtnslide":
                if (model.IsSlide == 1)
                {
                    bll.UpdateField(id, "IsSlide=0");
                }
                else
                {
                    bll.UpdateField(id, "IsSlide=1");
                }
                break;
            }
            RptBind("Id>0" + CombSqlTxt(this.kindId, this.classId, this.keywords, this.property), "AddTime desc");
        }