/// <summary> /// 增加一条数据 /// </summary> public int Add(Hi.Model.SYS_NewsNotice model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hi.Model.SYS_NewsNotice model) { return(dal.Update(model)); }
protected void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(Common.NoHTML(txtNewsTitle.Value.Trim()))) { JScript.AlertMsg(this, "消息标题不能为空!"); return; } Hi.Model.SYS_NewsNotice NewsNotice = null; if (KeyID != 0) { NewsNotice = new Hi.BLL.SYS_NewsNotice().GetModel(KeyID); NewsNotice.NewsTitle = Common.NoHTML(txtNewsTitle.Value.Trim());//去除非法字符 NewsNotice.NewsInfo = Common.NoHTML(textNewsInfo.Text.Trim()); NewsNotice.KeyWords = Common.NoHTML(textKeywords.Value.Trim()); NewsNotice.NewsContents = content7.Text.Trim(); //是否启用 if (this.rdoStatus1.Checked) { NewsNotice.IsEnabled = 0; } else { NewsNotice.IsEnabled = 1; } //是否置顶 if (this.Radio3.Checked) { NewsNotice.IsTop = 1; } else { NewsNotice.IsTop = 0; } //类别 if (this.Radio1.Checked) { NewsNotice.NewsType = 1; } else if (this.Radio2.Checked) { NewsNotice.NewsType = 2; } else if (this.Radio5.Checked) { NewsNotice.NewsType = 3; } else { NewsNotice.NewsType = 4; } NewsNotice.ts = DateTime.Now; NewsNotice.modifyuser = UserID; if (new Hi.BLL.SYS_NewsNotice().Update(NewsNotice)) { //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='NewsInfo.aspx?KeyID=" + KeyID + "'; }"); Response.Redirect("NewsInfo.aspx?KeyID=" + KeyID); } } else { NewsNotice = new Hi.Model.SYS_NewsNotice(); NewsNotice.NewsTitle = Common.NoHTML(txtNewsTitle.Value.Trim());//去除非法字符 NewsNotice.NewsInfo = Common.NoHTML(textNewsInfo.Text.Trim()); NewsNotice.KeyWords = Common.NoHTML(textKeywords.Value.Trim()); NewsNotice.NewsContents = content7.Text.Trim(); //是否启用 if (this.rdoStatus1.Checked) { NewsNotice.IsEnabled = 0; } else { NewsNotice.IsEnabled = 1; } //是否置顶 if (this.Radio3.Checked) { NewsNotice.IsTop = 1; } else { NewsNotice.IsTop = 0; } //类别 if (this.Radio1.Checked) { NewsNotice.NewsType = 1; } else if (this.Radio2.Checked) { NewsNotice.NewsType = 2; } else if (this.Radio5.Checked) { NewsNotice.NewsType = 3; } else { NewsNotice.NewsType = 4; } //标准参数 NewsNotice.CreateDate = DateTime.Now; NewsNotice.CreateUserID = UserID; NewsNotice.ts = DateTime.Now; NewsNotice.modifyuser = UserID; int newsrid = 0; newsrid = new Hi.BLL.SYS_NewsNotice().Add(NewsNotice); if (newsrid > 0) { Response.Redirect("NewsInfo.aspx?KeyID=" + newsrid); } } }