Пример #1
0
        protected void rplist_OnItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "bj")
            {
                Response.Redirect("NewsEdit.aspx?ID=" + e.CommandArgument);
            }
            if (e.CommandName == "sc")
            {
                int id        = int.Parse(e.CommandArgument.ToString());
                var newsmodel = bn.GetNewsByID(id);

                if (bn.Delete(newsmodel) == 1)
                {
                    SysOperateLog log = new SysOperateLog();
                    log.LogID           = StringHelper.getKey();
                    log.LogType         = LogType.新闻信息.ToString();
                    log.OperateUser     = GetLogUserName();
                    log.OperateDate     = DateTime.Now;
                    log.LogOperateType  = "文章删除";
                    log.LogBeforeObject = JsonHelper.Obj2Json(newsmodel);
                    bsol.Insert(log);
                    Message.ShowOK(this, "删除文章成功!");
                }


                else
                {
                    Message.ShowWrong(this, "删除文章失败");
                }
            }
            BindingList();
        }
Пример #2
0
        private void BindContent()
        {
            New n = bn.GetNewsByID(Utils.StrToInt(ID, 0));

            txtTitle.Text              = n.Title;
            txtauthor.Text             = n.Uploader;
            txtsummary.Text            = n.summary;
            dpNewstype.SelectedValue   = n.NewsType;
            dpstatictype.SelectedValue = n.StaticType;
            if (n.IsTop != null)
            {
                CbIstop.Checked = (bool)n.IsTop;
            }
            if (n.IsHot != null)
            {
                CbIsHot.Checked = (bool)n.IsHot;
            }
            container.Text = n.NewsContent;
            if (n.NewsPicPath != "")
            {
                ImgNews.ImageUrl = PicFilePathV + n.NewsPicPath;
            }
        }
Пример #3
0
        private void BindDetail()
        {//新闻绑定
            New n = bn.GetNewsByID(Utils.StrToInt(id, 0));

            ltTitle.Text   = n.Title;
            ltViews.Text   = (n.Views ?? 0).ToString();
            ltdate.Text    = ((DateTime)n.SubmitTime).ToString("yyyy-MM-dd");
            ltauthor.Text  = n.Uploader;
            ltContent.Text = n.NewsContent;
            //修改Views
            bn.Update(new New()
            {
                NewsID = Utils.StrToInt(id, 0), Views = (n.Views ?? 0) + 1
            });
        }