protected void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(this.txtnewsTitle.Text.Trim().Length==0) { strErr+="标题不能为空!\\n"; } if(this.txtContent.Text.Trim().Length==0) { strErr+="新闻内容不能为空!\\n"; } if (this.ddrCat.SelectedValue == "0") { strErr += "请选择所属分类!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int catId = int.Parse(this.ddrCat.SelectedValue); string catName = this.ddrCat.Items[ddrCat.SelectedIndex].Text; int userId=int.Parse(Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_UserId)); string userName = Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_UserName); int deptId = 1; string newsTitle=this.txtnewsTitle.Text; string summary=""; string newsContent = this.txtContent.Text; string contentSource=""; string author=""; DateTime addTime = DateTime.Now; DateTime modifyTime = DateTime.Now; int status=1; int isHomePage=0; int isSlide=0; hm.Model.news model=new hm.Model.news(); model.catId=catId; model.catName=catName; model.userId=userId; model.userName=userName; model.deptId=deptId; model.newsTitle=newsTitle; model.summary=summary; model.newsContent=newsContent; model.contentSource=contentSource; model.author=author; model.addTime=addTime; model.modifyTime=modifyTime; model.status=status; model.isHomePage=isHomePage; model.isSlide=isSlide; hm.BLL.news bll=new hm.BLL.news(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
private void ShowInfo(int newsId) { hm.BLL.news bll = new hm.BLL.news(); hm.Model.news model = bll.GetModel(newsId); this.lblNewsId.Text = model.newsId.ToString(); this.txtnewsTitle.Text = model.newsTitle; this.txtContent.Text = model.newsContent; Model.ed_node modelNode = nBll.GetModel(model.catId.Value); litId.Text = modelNode.ID.ToString(); litName.Text = modelNode.title; }
private void ShowInfo(int newsId) { hm.BLL.news bll = new hm.BLL.news(); hm.Model.news model = bll.GetModel(newsId); this.lblnewsId.Text = model.newsId.ToString(); this.lbluserName.Text = model.userName; this.lblnewsTitle.Text = model.newsTitle; this.lblnewsContent.Text = model.newsContent; this.lbladdTime.Text = model.addTime.ToString(); this.lblmodifyTime.Text = model.modifyTime.ToString(); }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtnewsTitle.Text.Trim().Length == 0) { strErr += "标题不能为空!\\n"; } if (this.txtContent.Text.Trim().Length == 0) { strErr += "新闻内容不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int newsId = int.Parse(this.lblNewsId.Text); int catId = int.Parse(litId.Text); string catName = litName.Text; int userId = int.Parse(Request.Cookies["userId"].Value); string userName = Request.Cookies["userName"].Value; int deptId = int.Parse(Request.Cookies["deptId"].Value); string newsTitle = this.txtnewsTitle.Text; string summary = ""; string newsContent = this.txtContent.Text; string contentSource = ""; string author = ""; DateTime addTime = DateTime.Now; DateTime modifyTime = DateTime.Now; int isHomePage = 0; int isSlide = 0; isHomePage = 0; hm.BLL.news bll = new hm.BLL.news(); hm.Model.news model = bll.GetModel(newsId); model.newsId = newsId; model.catId = catId; model.catName = catName; model.userId = userId; model.userName = userName; model.deptId = deptId; model.newsTitle = newsTitle; model.summary = summary; model.newsContent = newsContent; model.contentSource = contentSource; model.author = author; model.addTime = addTime; model.modifyTime = modifyTime; model.isHomePage = isHomePage; model.isSlide = isSlide; model.picUrl = ""; model.videoUrl = ""; model.isTop = 0; model.fileUrl1 = ""; model.fileUrl2 = ""; model.fileUrl3 = ""; bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "../media/list.aspx?id=" + model.catId); }
private void ShowInfo(int newsId) { hm.BLL.news bll=new hm.BLL.news(); hm.Model.news model=bll.GetModel(newsId); this.lblNewsId.Text = model.newsId.ToString(); this.txtnewsTitle.Text=model.newsTitle; this.txtContent.Text=model.newsContent; ddrCat.SelectedValue = model.catId.Value.ToString(); }