Beispiel #1
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(((Label)e.Item.FindControl("lb_id")).Text);

            Cms.DAL.NewsInfo   dal   = new Cms.DAL.NewsInfo();
            Cms.Model.NewsInfo model = dal.GetModel(id);
            switch (e.CommandName.ToLower())
            {
            case "ibtnlock":
                if (model.IsLock == 1)
                {
                    dal.UpdateField(id, "IsLock=0");
                }
                else
                {
                    dal.UpdateField(id, "IsLock=1");
                }
                break;

            case "ibtntop":
                if (model.IsTop == 1)
                {
                    dal.UpdateField(id, "IsTop=0");
                }
                else
                {
                    dal.UpdateField(id, "IsTop=1");
                }
                break;
            }
            RptBind();
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.Params["newsID"] as string, out this.newsId))
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!'),location.href='News.aspx';</script>");
                return;
            }

            Cms.DAL.NewsInfo dal = new Cms.DAL.NewsInfo();
            model = dal.GetModel(this.newsId);//获得Id
            if (model == null)
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!'),location.href='News.aspx';</script>");
                return;
            }
            ////浏览数+1
            dal.UpdateField(this.newsId, "Click=Click+1");
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>menuEnable(4);</script>");
        }
        protected int newsId; //全局变量Id

        #endregion Fields

        #region Methods

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.Params["newsID"] as string, out this.newsId))
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!'),location.href='News.aspx';</script>");
                return;
            }

            Cms.DAL.NewsInfo dal = new Cms.DAL.NewsInfo();
            model = dal.GetModel(this.newsId);//获得Id
            if (model == null)
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!'),location.href='News.aspx';</script>");
                return;
            }
            ////浏览数+1
            dal.UpdateField(this.newsId, "Click=Click+1");
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>menuEnable(4);</script>");
        }