/// <summary> /// 一键删除消息 /// </summary> /// <returns></returns> public JsonResult UpdateDeleteMessage() { 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_message mebll = new JMP.BLL.jmp_message(); if (str.CompareTo("On") > 0) { str = str.Substring(3); } if (mebll.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 ReplyMessage() { int topid = string.IsNullOrEmpty(Request["topid"]) ? 0 : Int32.Parse(Request["topid"]); List <JMP.MDL.jmp_message> list = new List <JMP.MDL.jmp_message>(); JMP.BLL.jmp_message mebll = new JMP.BLL.jmp_message(); if (topid > 0) { list = mebll.ReplySelect(topid); } ViewBag.topid = topid; ViewBag.list = list; return(View()); }
/// <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 messagelist() { #region 获取权限 string locUrl = ""; bool getUidF = bll_limit.GetLocUserLimitVoids("/MessageManagement/UpdateDeleteMessage", UserInfo.UserId.ToString(), int.Parse(UserInfo.UserRoleId.ToString()));//一键删除 if (getUidF) { locUrl += "<li onclick=\"javascript:UpdatestateMessage(-1);\"><i class='fa fa-check-square-o'></i>一键删除</li>"; } bool getlocuserAdd = bll_limit.GetLocUserLimitVoids("/MessageManagement/InserOrUpdatemessage", UserInfo.UserId.ToString(), int.Parse(UserInfo.UserRoleId.ToString()));//发布公告 if (getlocuserAdd) { locUrl += "<li onclick=\"addmessage()\"><i class='fa fa-plus'></i>发布消息</li>"; } ViewBag.locUrl = locUrl; #endregion 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; List <JMP.MDL.jmp_message> list = new List <JMP.MDL.jmp_message>(); JMP.BLL.jmp_message mebll = new JMP.BLL.jmp_message(); string strsql = "select m_id, m_sender, m_receiver, m_type, m_time, m_state, m_content, m_topid,b.u_loginname from jmp_message a left join jmp_locuser b on a.m_sender=b.u_id where 1=1 and a.m_state>-1 "; if (searchType > 0 && !string.IsNullOrEmpty(sea_name)) { switch (searchType) { case 1: strsql += " and a.m_id like '%" + sea_name + "%' "; break; case 2: strsql += " and b.u_loginname like '%" + sea_name + "%' "; break; } } string order = " order by m_time desc";//排序字段 list = mebll.SelectList(strsql, order, pageIndexs, PageSize, out pageCount); ViewBag.pageCount = pageCount; ViewBag.pageIndexs = pageIndexs; ViewBag.PageSize = PageSize; ViewBag.list = list; return(View()); }
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()); }
/// <summary> /// 消息回复 /// </summary> /// <returns></returns> public JsonResult ReplyMessageUser(JMP.MDL.jmp_message mo) { object retJson = new { success = 0, msg = "操作失败" }; mo.m_time = DateTime.Now; mo.m_state = 0; mo.m_type = 3; mo.m_sender = UserInfo.UserId; JMP.BLL.jmp_message mebll = new JMP.BLL.jmp_message(); int cg = mebll.Add(mo); if (cg > 0) { Logger.OperateLog("回复消息", mo.m_content); retJson = new { success = 1, msg = "发送成功" }; } else { retJson = new { success = 0, msg = "发送失败" }; } return(Json(retJson)); }
public JsonResult UpdateUser(JMP.MDL.jmp_user jmpuser) { object obj = new { success = 0, msg = "更新失败!" }; JMP.BLL.jmp_user userBll = new JMP.BLL.jmp_user(); var oldUser = _UserService.FindById(jmpuser.u_id); var oldUserColne = oldUser.Clone(); oldUser.u_category = jmpuser.u_category;//类别 oldUser.u_email = jmpuser.u_email; oldUser.u_realname = jmpuser.u_realname; oldUser.u_password = DESEncrypt.Encrypt(jmpuser.u_password); oldUser.u_phone = jmpuser.u_phone; oldUser.u_qq = jmpuser.u_qq; oldUser.u_address = jmpuser.u_address; oldUser.u_account = jmpuser.u_account; oldUser.u_name = jmpuser.u_name; oldUser.u_bankname = jmpuser.u_bankname; oldUser.u_idnumber = jmpuser.u_idnumber; oldUser.u_blicensenumber = jmpuser.u_blicensenumber; oldUser.BusinessEntity = jmpuser.BusinessEntity; oldUser.RegisteredAddress = jmpuser.RegisteredAddress; oldUser.u_auditstate = jmpuser.u_auditstate; oldUser.u_photof = string.IsNullOrEmpty(jmpuser.u_photof) ? "" : jmpuser.u_photof; oldUser.u_licence = string.IsNullOrEmpty(jmpuser.u_licence) ? "" : jmpuser.u_licence; try { if (oldUser.u_category == 0) { oldUser.u_photo = string.IsNullOrEmpty(jmpuser.u_photo) ? "" : jmpuser.u_photo; } else { oldUser.u_blicense = string.IsNullOrEmpty(jmpuser.u_blicense) ? "" : jmpuser.u_blicense; oldUser.u_photo = string.IsNullOrEmpty(jmpuser.u_photo) ? " " : jmpuser.u_photo; } if (string.IsNullOrEmpty(jmpuser.u_qq)) { oldUser.u_qq = " "; } if (string.IsNullOrEmpty(jmpuser.u_address)) { oldUser.u_address = " "; } bool flag = _UserService.Update(oldUser); obj = new { success = flag ? 1 : 0, msg = flag ? "更新成功!" : "更新失败!" }; //写日志 if (flag) { Logger.ModifyLog("修改开发者", oldUserColne, jmpuser); //审核状态改变是发送私信和邮件给用户 if (jmpuser.u_auditstate != oldUserColne.u_auditstate) { JMP.BLL.jmp_message messbll = new JMP.BLL.jmp_message(); JMP.MDL.jmp_message j_mess = new JMP.MDL.jmp_message(); string tipmsg = string.Empty; #region 组装私信实体 j_mess.m_sender = UserInfo.UserId; j_mess.m_receiver = oldUser.u_id.ToString(); j_mess.m_type = 1; j_mess.m_time = DateTime.Now; j_mess.m_state = 0; switch (jmpuser.u_auditstate) { case -1: tipmsg = "你的账号审核未通过!"; break; case 0: tipmsg = "你的账号正在审核中,如有疑问请联系我们!"; break; case 1: tipmsg = "你的账号审核通过!"; break; } j_mess.m_content = tipmsg; j_mess.m_topid = oldUser.u_topid; #endregion //发送私信 if (jmpuser.u_auditstate == 1) { //更改审核状态为通过时,才发送私信 int record = messbll.Add(j_mess); if (record > 0) { Logger.CreateLog("发送私信给用户", j_mess); } } } } } catch (Exception ex) { Logger.OperateLog("修改开发者报错" + jmpuser.u_id, ex.ToString()); obj = new { success = 0, msg = "更新出错了!" }; } return(Json(obj)); }
public JsonResult UpdateAgents(JMP.MDL.CoAgent jmpagent) { object obj = new { success = 0, msg = "更新失败!" }; JMP.BLL.CoAgent userBll = new JMP.BLL.CoAgent(); JMP.MDL.CoAgent oldUser = userBll.GetModel(jmpagent.Id); var oldUserClone = oldUser.Clone(); oldUser.Classify = jmpagent.Classify; oldUser.LoginName = jmpagent.LoginName; oldUser.Password = DESEncrypt.Encrypt(jmpagent.Password); oldUser.DisplayName = jmpagent.DisplayName; oldUser.EmailAddress = jmpagent.EmailAddress; oldUser.MobilePhone = jmpagent.MobilePhone; oldUser.QQ = jmpagent.QQ; oldUser.Website = jmpagent.Website; oldUser.ContactAddress = jmpagent.ContactAddress; oldUser.IDCardNumber = jmpagent.IDCardNumber; oldUser.BusinessLicenseNumber = jmpagent.BusinessLicenseNumber; oldUser.BankAccount = jmpagent.BankAccount; oldUser.BankAccountName = jmpagent.BankAccountName; oldUser.BankFullName = jmpagent.BankFullName; try { if (jmpagent.Classify == 0) { oldUser.PersonalPhotoPath = string.IsNullOrEmpty(jmpagent.PersonalPhotoPath) ? "" : jmpagent.PersonalPhotoPath; } else { oldUser.BusinessLicensePhotoPath = string.IsNullOrEmpty(jmpagent.BusinessLicensePhotoPath) ? "" : jmpagent.BusinessLicensePhotoPath; oldUser.PersonalPhotoPath = string.IsNullOrEmpty(jmpagent.PersonalPhotoPath) ? " " : jmpagent.PersonalPhotoPath; } if (string.IsNullOrEmpty(jmpagent.QQ)) { oldUser.QQ = " "; } if (string.IsNullOrEmpty(jmpagent.ContactAddress)) { oldUser.ContactAddress = " "; } //jmpagent.CreatedOn = oldUser.CreatedOn; //jmpagent.CreatedById = oldUser.CreatedById; //jmpagent.CreatedByName = oldUser.CreatedByName; //jmpagent.OwnerId = oldUser.OwnerId; //jmpagent.OwnerName = oldUser.OwnerName; bool flag = _coAgentService.Update(oldUser); obj = new { success = flag ? 1 : 0, msg = flag ? "更新成功!" : "更新失败!" }; //写日志 if (flag) { Logger.ModifyLog("修改代理商", oldUserClone, jmpagent); //审核状态改变是发送私信和邮件给用户 if (jmpagent.AuditState != oldUserClone.AuditState) { JMP.BLL.jmp_message messbll = new JMP.BLL.jmp_message(); JMP.MDL.jmp_message j_mess = new JMP.MDL.jmp_message(); string tipmsg = string.Empty; #region 组装私信实体 j_mess.m_sender = UserInfo.UserId; j_mess.m_receiver = oldUser.Id.ToString(); j_mess.m_type = 1; j_mess.m_time = DateTime.Now; j_mess.m_state = 0; switch (jmpagent.AuditState) { case -1: tipmsg = "你的账号审核未通过!"; break; case 0: tipmsg = "你的账号正在审核中,如有疑问请联系我们!"; break; case 1: tipmsg = "你的账号审核通过!"; break; } j_mess.m_content = tipmsg; #endregion //发送私信 if (jmpagent.AuditState == 1) { //更改审核状态为通过时,才发送私信 int record = messbll.Add(j_mess); if (record > 0) { Logger.CreateLog("发送私信给用户", j_mess); } } } } } catch (Exception ex) { Logger.OperateLog("修改代理商报错" + jmpagent.Id, ex.ToString()); obj = new { success = 0, msg = "更新出错了!" }; } return(Json(obj)); }