예제 #1
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
            });
        }
예제 #2
0
        protected void btnEdit_OnClick(object sender, EventArgs e)
        {
            New oldn = bn.GetNewsByID(Utils.StrToInt(ID, 0));

            if (bn.Update(new New
            {
                NewsID = Utils.StrToInt(hfNewsID.Value, 0),
                Title = PubCom.CheckString(txtTitle.Text.Trim()),
                NewsContent = container.Text,
                summary = PubCom.CheckString(txtsummary.Text.Trim()),
                Uploader = txtauthor.Text.Trim(),
                SubmitTime = DateTime.Now,
                IsHot = CbIsHot.Checked,
                IsTop = CbIstop.Checked,
                NewsType = dpNewstype.SelectedValue,
                StaticType = dpstatictype.SelectedValue
            }) != 1)
            {
                Message.ShowWrong(this, "更新文章失败");
            }


            else
            {
                bn.UploadValidate(pic_upload, lbl_pic, PicFilePath, Utils.StrToInt(hfNewsID.Value, 0));

                New           n   = bn.GetNewsByID(Utils.StrToInt(ID, 0));
                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(oldn);
                log.LogAfterObject  = JsonHelper.Obj2Json(n);
                bsol.Insert(log);
                Message.ShowOKAndRedirect(this, "更新新闻成功", "NewsManage.aspx");
            }
        }