/// <summary> /// 一键删除公告 /// </summary> /// <returns></returns> public JsonResult UpdateDelete() { object retJson = new { success = 0, msg = "操作失败" }; int state = string.IsNullOrEmpty(Request["state"]) ? 0 : Int32.Parse(Request["state"].ToString()); string str = Request["ids"]; string xgzfc = ""; //组装说明 string tsmsg = ""; //提示 JMP.BLL.jmp_notice noticebll = new JMP.BLL.jmp_notice(); if (str.CompareTo("On") > 0) { str = str.Substring(3); } if (noticebll.UpdateLocUserState(str, state)) { xgzfc = "删除公告ID为:" + str; tsmsg = "删除成功"; Logger.OperateLog("删除公告", xgzfc); retJson = new { success = 1, msg = tsmsg }; } else { tsmsg = "删除失败"; retJson = new { success = 0, msg = tsmsg }; } return(Json(retJson)); }
/// <summary> /// 公共发布界面 /// </summary> /// <returns></returns> public ActionResult notice() { int n_id = string.IsNullOrEmpty(Request["n_id"]) ? 0 : Int32.Parse(Request["n_id"]); JMP.BLL.jmp_notice noticebll = new JMP.BLL.jmp_notice(); JMP.MDL.jmp_notice mo = new JMP.MDL.jmp_notice(); if (n_id > 0) { mo = noticebll.GetModel(n_id); } ViewBag.mo = mo; return(View()); }
public ActionResult noticeList() { #region 获取操作权限 string locUrl = ""; bool getUidF = bll_limit.GetLocUserLimitVoids("/MessageManagement/UpdateDelete", UserInfo.UserId.ToString(), int.Parse(UserInfo.UserRoleId.ToString()));//一键删除 if (getUidF) { locUrl += "<li onclick=\"javascript:Updatestate(1);\"><i class='fa fa-check-square-o'></i>一键删除</li>"; } bool getlocuserAdd = bll_limit.GetLocUserLimitVoids("/MessageManagement/insertOrUpdatenotice", UserInfo.UserId.ToString(), int.Parse(UserInfo.UserRoleId.ToString()));//发布公告 if (getlocuserAdd) { locUrl += "<li onclick=\"addnotice()\"><i class='fa fa-plus'></i>发布公告</li>"; } ViewBag.locUrl = locUrl; #endregion JMP.BLL.jmp_notice noticebll = new JMP.BLL.jmp_notice(); int pageCount = 0; int pageIndexs = string.IsNullOrEmpty(Request["pageIndexs"]) ? 1 : Int32.Parse(Request["pageIndexs"]); //当前页 int PageSize = string.IsNullOrEmpty(Request["PageSize"]) ? 20 : Int32.Parse(Request["PageSize"]); //每页显示数量 int searchType = string.IsNullOrEmpty(Request["searchType"]) ? 0 : Int32.Parse(Request["searchType"]); //查询条件 ViewBag.searchType = searchType; string sea_name = string.IsNullOrEmpty(Request["sea_name"]) ? "" : Request["sea_name"]; //查询内容 ViewBag.sea_name = sea_name; string strsql = "select a.n_id, a.n_title, a.n_content, a.n_time, a.n_top, a.n_state, a.n_locuserid,b.u_loginname from jmp_notice a left join jmp_locuser b on a.n_locuserid=b.u_id where 1=1 and n_state='0'"; if (searchType > 0 && !string.IsNullOrEmpty(sea_name)) { switch (searchType) { case 1: strsql += " and a.n_id like '%" + sea_name + "%' "; break; case 2: strsql += " and a.n_title like '%" + sea_name + "%' "; break; } } string order = " order by n_top desc ,n_time desc ";//排序 List <JMP.MDL.jmp_notice> list = noticebll.SelectList(strsql, order, pageIndexs, PageSize, out pageCount); ViewBag.pageCount = pageCount; ViewBag.pageIndexs = pageIndexs; ViewBag.PageSize = PageSize; ViewBag.list = list; return(View()); }
/// <summary> /// 添加或修改公告 /// </summary> /// <returns></returns> public JsonResult insertOrUpdatenotice(JMP.MDL.jmp_notice mo) { object retJson = new { success = 0, msg = "操作失败" }; JMP.BLL.jmp_notice noticebll = new JMP.BLL.jmp_notice(); mo.n_time = DateTime.Now; mo.n_state = 0; mo.n_locuserid = UserInfo.UserId; if (mo.n_id > 0) { JMP.MDL.jmp_notice mod = noticebll.GetModel(mo.n_id); var modClone = mod.Clone(); mod.n_title = mo.n_title; mod.n_content = mo.n_content; mod.n_top = mo.n_top; if (noticebll.Update(mod)) { Logger.ModifyLog("修改公告", modClone, mo); retJson = new { success = 1, msg = "修改成功!" }; } else { retJson = new { success = 1, msg = "修改失败!" }; } } else { int cg = noticebll.Add(mo); if (cg > 0) { Logger.CreateLog("新增公告", mo); retJson = new { success = 1, msg = "发布成功!" }; } else { retJson = new { success = 0, msg = "发布失败!" }; } } return(Json(retJson)); }