private void getContentById(HttpContext context) { string id = ""; if (null != context.Request.QueryString["id"]) { id = context.Request.QueryString["id"].ToString().Trim();//get方式获取参数 } if (id != "") { T_Notice t_notice = bll_notice.GetModel(Convert.ToInt32(id)); if (t_notice != null) { //context.Response.Write(t_notice.content); message.flag = true; message.msg = t_notice.content; context.Response.Write(JsonHelper.Object2Json <Message>(message)); } else { context.Response.Write(""); } } else { context.Response.Write(""); } }
/// <summary> /// 新增公告 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(T_Notice model) { using (IDbConnection conn = DapperAdapter.MySQLOpenConnection(ConfigurationHelper.MySQLConnectionStr)) { return(conn.Execute("insert into t_notice (content,createTime,updateTime) values(@content,@createTime,@updateTime);", model)); } }
public ActionResult AddPlacard(T_Notice model) { var data = new { content = model.content == null ? "" : model.content, id = model.id }; string json = JSONHelper.ObjectToJSON(data); bool result = WebSecurityHelper.GameServerApi.ToPost("updateNoticeContent", json).result; WebSecurityHelper.LogCommon.Current.WriteLog_Operation(Game.Entity.OperationType.Update, (result ? "1" : "0"), "公告内容设置", "大厅公告:" + model.content); return(Response(result)); }
private void Lock(HttpContext context) { bool flag = false; string id = ""; string opt = ""; if (null != context.Request.QueryString["id"]) { id = context.Request.QueryString["id"].ToString().Trim(); } Model.T_Notice t_notice = new T_Notice(); t_notice = bll_notice.GetModel(Convert.ToInt32(id)); if (t_notice.isDeleted == 1) { t_notice.isDeleted = 0; opt = "开启"; } else { t_notice.isDeleted = 1; opt = "关闭"; } flag = bll_notice.Update(t_notice); message = new Message(); if (flag) { message.flag = true; message.msg = opt + "成功"; } else { message.flag = false; message.msg = opt + "失败"; } context.Response.Write(JsonHelper.Object2Json <Message>(message));//返回给前台页面 }
private void AddOrModify(HttpContext context) { //=============================================================== //获取字段:【用户name】 string id, title, isDeleted, content; id = title = isDeleted = content = ""; if (null != context.Request.QueryString["id"]) { id = context.Request.QueryString["id"].ToString().Trim(); } if (null != context.Request.QueryString["title"]) { title = context.Request.QueryString["title"].ToString().Trim(); } if (null != context.Request.QueryString["isDeleted"]) { isDeleted = context.Request.QueryString["isDeleted"].ToString().Trim(); } if (null != context.Request.QueryString["content"]) { content = context.Request.QueryString["content"].ToString().Trim(); } if (id != "") { T_Notice model = bll_notice.GetModel(Convert.ToInt32(id)); model.title = title; model.content = content; model.isDeleted = Convert.ToInt16(isDeleted); model.create_time = DateTime.Now; if (context.Session["user_id"] != null) { model.admin_id = Convert.ToInt32(context.Session["user_id"]); } bool flag = bll_notice.Update(model); if (flag) { message.flag = true; message.msg = "修改成功"; } else { message.flag = false; message.msg = "修改失败"; } } else { T_Notice model = new T_Notice(); model.title = title; model.isDeleted = Convert.ToInt16(isDeleted); model.content = content; model.create_time = DateTime.Now; if (context.Session["user_id"] != null) { model.admin_id = Convert.ToInt32(context.Session["user_id"]); } int n = bll_notice.Add(model); if (n > 0) { message.flag = true; message.msg = "添加成功"; } else { message.flag = false; message.msg = "添加失败"; } } String jsonString = JsonHelper.Object2Json <Message>(message); context.Response.Write(jsonString); }
/// <summary> /// 公告页面编辑 /// </summary> /// <returns></returns> public ActionResult Index() { T_Notice model = this.bll.GetPlacardsetByDESC(); return(View(model)); }