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)); }