Example #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));
      }
Example #2
0
        public JsonResult InsertAgent(JMP.MDL.CoAgent jmpagent)
        {
            object obj = new { success = 0, msg = "添加失败!" };

            jmpagent.Password = DESEncrypt.Encrypt(jmpagent.Password);
            jmpagent.ServiceFeeRatioGradeId = _coAgentService.FindMax(" select top 1 Id  from   CoServiceFeeRatioGrade where  AgentPushMoneyRatio in(select  max(AgentPushMoneyRatio)   from CoServiceFeeRatioGrade )");
            jmpagent.RoleId = int.Parse(ConfigurationManager.AppSettings["AgentRoleId"]);
            try
            {
                if (jmpagent.Classify == 0)
                {
                    jmpagent.PersonalPhotoPath = string.IsNullOrEmpty(jmpagent.PersonalPhotoPath) ? "" : jmpagent.PersonalPhotoPath;
                }
                else
                {
                    jmpagent.BusinessLicensePhotoPath = string.IsNullOrEmpty(jmpagent.BusinessLicensePhotoPath) ? "" : jmpagent.BusinessLicensePhotoPath;
                    jmpagent.PersonalPhotoPath        = string.IsNullOrEmpty(jmpagent.PersonalPhotoPath) ? " " : jmpagent.PersonalPhotoPath;
                }

                jmpagent.QQ             = string.IsNullOrEmpty(jmpagent.QQ) ? "" : jmpagent.QQ;
                jmpagent.ContactAddress = string.IsNullOrEmpty(jmpagent.ContactAddress) ? " " : jmpagent.ContactAddress;
                jmpagent.CreatedOn      = DateTime.Now;
                jmpagent.CreatedById    = UserInfo.UserId;
                jmpagent.CreatedByName  = UserInfo.UserName;
                jmpagent.OwnerId        = UserInfo.UserId;
                jmpagent.OwnerName      = UserInfo.UserName;
                bool flag = false;
                flag = _coAgentService.Insert(jmpagent) > 0;
                obj  = new { success = flag ? 1 : 0, msg = flag ? "添加成功!" : "添加失败!" };
                //写日志
                if (flag)
                {
                    Logger.CreateLog("添加代理商", jmpagent);
                }
            }
            catch (Exception ex)
            {
                obj = new { success = 0, msg = "添加异常!" };

                Logger.OperateLog("添加代理商报错", ex.ToString());
            }
            return(Json(obj));
        }