/// <summary> /// 添加或修改消息 /// </summary> /// <param name="mo"></param> /// <returns></returns> public JsonResult InserOrUpdatemessage(JMP.MDL.jmp_message mo) { object retJson = new { success = 0, msg = "操作失败" }; mo.m_sender = UserInfo.UserId; JMP.BLL.jmp_message mebll = new JMP.BLL.jmp_message(); string[] sta = Request["m_receiver"].Split(','); if (mo.m_id > 0) { JMP.MDL.jmp_message mod = mebll.GetModel(mo.m_id); var modClone = mod.Clone(); mod.m_receiver = mo.m_receiver; mod.m_content = mo.m_content; //mo.m_state = mod.m_state; //mo.m_type = mod.m_type; //mo.m_time = mod.m_time; string sm = "";//日志说明 if (mebll.Update(mod)) { Logger.ModifyLog("修改消息", modClone, mo); retJson = new { success = 1, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; } } else { mo.m_time = DateTime.Now; mo.m_state = 0; mo.m_type = 1; StringBuilder strSql = new StringBuilder(); for (int i = 0; i < sta.Length; i++) { strSql.Append("insert into jmp_message(m_sender,m_receiver,m_type,m_time,m_state,m_content,m_topid) values ('" + mo.m_sender + "','" + sta[i] + "','1','" + DateTime.Now + "','0','" + mo.m_content + "','0') "); } int cg = mebll.AdminAdd(strSql); if (cg > 0) { Logger.CreateLog("发送消息", mo); retJson = new { success = 1, msg = "发送成功" }; } else { retJson = new { success = 0, msg = "发送失败" }; } } return(Json(retJson)); }
public ActionResult message() { int m_id = string.IsNullOrEmpty(Request["m_id"]) ? 0 : Int32.Parse(Request["m_id"]); JMP.MDL.jmp_message mo = new JMP.MDL.jmp_message(); JMP.BLL.jmp_message mebll = new JMP.BLL.jmp_message(); string type = string.IsNullOrEmpty(Request["type"]) ? "dd" : Request["type"]; if (m_id > 0) { mo = mebll.GetModel(m_id); } ViewBag.type = type; ViewBag.mo = mo; return(View()); }