public JsonResult AddUser(JMP.MDL.jmp_user jmpuser) { object obj = new { success = 0, msg = "添加失败!" }; JMP.BLL.jmp_user userBll = new JMP.BLL.jmp_user(); jmpuser.u_password = DESEncrypt.Encrypt(jmpuser.u_password); jmpuser.relation_person_id = UserInfo.UserId; jmpuser.relation_type = (int)Relationtype.Bp; jmpuser.u_state = 1; int RoleID = int.Parse(ConfigurationManager.AppSettings["UserRoleId"]); jmpuser.ServiceFeeRatioGradeId = _CoAgentService.FindMax(" select top 1 Id from CoServiceFeeRatioGrade where ServiceFeeRatio in(select max(ServiceFeeRatio) from CoServiceFeeRatioGrade ) "); jmpuser.u_role_id = RoleID; jmpuser.u_photof = string.IsNullOrEmpty(jmpuser.u_photof) ? "" : jmpuser.u_photof; jmpuser.u_licence = string.IsNullOrEmpty(jmpuser.u_licence) ? "" : jmpuser.u_licence; try { if (jmpuser.u_category == 0) { jmpuser.u_photo = string.IsNullOrEmpty(jmpuser.u_photo) ? "" : jmpuser.u_photo; } else { jmpuser.u_blicense = string.IsNullOrEmpty(jmpuser.u_blicense) ? "" : jmpuser.u_blicense; jmpuser.u_photo = string.IsNullOrEmpty(jmpuser.u_photo) ? " " : jmpuser.u_photo; } jmpuser.u_qq = string.IsNullOrEmpty(jmpuser.u_qq) ? "" : jmpuser.u_qq; jmpuser.u_address = string.IsNullOrEmpty(jmpuser.u_address) ? " " : jmpuser.u_address; jmpuser.u_time = DateTime.Now; bool flag = false; if (!userBll.ExistsEmail(jmpuser.u_email)) { flag = _UserService.Insert(jmpuser) > 0; } obj = new { success = flag ? 1 : 0, msg = flag ? "添加成功!" : "添加失败!" }; //写日志 if (flag) { Logger.CreateLog("添加开发者", jmpuser); } } catch (Exception ex) { obj = new { success = 0, msg = "添加异常!" }; Logger.OperateLog("添加开发者报错", ex.ToString()); } return(Json(obj)); }
public JsonResult ScAdd() { object retJson = new { success = 0, msg = "操作失败" }; JMP.BLL.jmp_user bllUser = new JMP.BLL.jmp_user(); JMP.MDL.jmp_user modelUser = new JMP.MDL.jmp_user(); int ServiceFeeRatioGradeId = string.IsNullOrEmpty(Request["ServiceFeeRatioGradeId"]) ? 0 : int.Parse(Request["ServiceFeeRatioGradeId"]); int id = string.IsNullOrEmpty(Request["id"]) ? 0 : int.Parse(Request["id"]); //修改前的数据 modelUser = bllUser.GetModel(id); if (bllUser.UpdateServiceFeeRatioGradeId(id, ServiceFeeRatioGradeId)) { Logger.OperateLog("商务设置直客开发者费率", "商务ID:" + modelUser.relation_person_id + ",操作数据(jmp_user)ID:" + id + ",费率等级由:" + modelUser.ServiceFeeRatioGradeId + ",改为:" + ServiceFeeRatioGradeId + "。"); 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)); }