コード例 #1
0
      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));
      }
コード例 #2
0
      public JsonResult CheckEmail(string cval, string uid)
      {
          bool flag = userBll.ExistsEmail(cval, uid);

          return(Json(new { success = flag, mess = flag ? "已存在该邮件地址!" : "不存在邮件地址!" }));
      }