//发布系统公告 public int fabuXTGG(XTGG gg) { string sql = "insert into XTGG (GGHead,GGcontent,GGauthor,GGdateTime) values (@GGHead,@GGcontent,@GGauthor,@GGdateTime) "; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@GGHead", gg.GGHead), new SqlParameter("@GGContent", gg.GGcontent), new SqlParameter("@GGauthor", gg.GGauthor), new SqlParameter("@GGdateTime", gg.GGdateTime) }; return(new Helper.SQLHelper().update(sql, param, false)); }
protected void btn_submit_Click(object sender, EventArgs e) { XTGG gg = new XTGG() { GGauthor = ((Model.Login)Session["CurrentUser"]).StuName, GGdateTime = DateTime.Now, GGHead = GGHead.Text.Trim().ToString(), GGcontent = editor1.Text }; int result = new GGManage().fabuXTGG(gg); if (result > 0) { Literal1.Text = "<script type='text/javascript'>alert('公告发布成功!');history.go(-2)</script>"; btn_submit.Enabled = false; } else { Literal1.Text = "<script type='text/javascript'>alert('公告发布失败!');</script>"; } }
//查看公告详细信息 public XTGG queryDetail(int GGId) { string sql = "select Id ,GGHead,GGContent,GGauthor,GGdateTime from XTGG where Id = @GGId"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@GGId", GGId) }; XTGG gg = null; SqlDataReader res = new Helper.SQLHelper().queryAllResult(sql, param, false); while (res.Read()) { gg = new XTGG() { GGHead = res["GGHead"].ToString(), GGcontent = res["GGContent"].ToString(), GGauthor = res["GGauthor"].ToString(), GGdateTime = Convert.ToDateTime(res["GGdateTime"]) }; } return(gg); }
//发布公告 public int fabuXTGG(XTGG gg) { return(new GGService().fabuXTGG(gg)); }