protected void btnAdd_OnClick(object sender, EventArgs e) { New n = new New(); BNew bn = new BNew(); BSysOperateLog bsol = new BSysOperateLog(); n.NewsID = bn.GetMaxID() + 1; n.IsTop = CbIstop.Checked; n.IsHot = CbIsHot.Checked; n.NewsContent = container.Text; n.SubmitTime = DateTime.Now; //n.SavePath = "details" + DateTime.Now.Year + "_" + DateTime.Now.Month + "/" +DateTime.Now.Day; n.Uploader = PubCom.CheckString(txtauthor.Text.Trim()); n.Title = PubCom.CheckString(txtTitle.Text.Trim()); n.summary = PubCom.CheckString(txtsummary.Text.Trim()); n.NewsType = dpNewstype.SelectedValue; n.StaticType = dpstatictype.SelectedValue; //string PicUrl = ""; //if (UploadValidate(out PicUrl)) //{ // n.IsImg = 1; // mp.Id = mpm.GetMaxID() + 1; // mp.NewsId = n.Id; // mp.Title = pic_upload.FileName; // mp.PicUrl = PicUrl; // mpm.Insert(mp); //} //else //{ // n.IsImg = 1; //}NewsManage if (bn.Insert(n) != 1) { Message.ShowWrong(this, "添加文章失败!"); } else { bn.UploadValidate(pic_upload, lbl_pic, PicFilePath, n.NewsID); //// 插入日志 add SysOperateLog log = new SysOperateLog(); log.LogID = StringHelper.getKey(); log.LogType = LogType.新闻信息.ToString(); log.OperateUser = GetLogUserName(); log.OperateDate = DateTime.Now; log.LogOperateType = "新闻新增"; log.LogAfterObject = JsonHelper.Obj2Json(n); bsol.Insert(log); Message.ShowOKAndRedirect(this, "添加文章成功", "NewsManage.aspx"); } }