Beispiel #1
0
 public ActionResult SubmitForm(Sys_UserModel userEntity, Sys_UserLogOnModel userLogOnEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         userEntity.F_Id = keyValue;
         var LoginInfo = OperatorProvider.Provider.GetCurrent();
         if (LoginInfo != null)
         {
             userEntity.F_LastModifyUserId = LoginInfo.UserId;
         }
         userEntity.F_LastModifyTime = DateTime.Now;
         userbll.Update(userEntity);
     }
     else
     {
         userEntity.F_Id = Common.GuId();
         var LoginInfo = OperatorProvider.Provider.GetCurrent();
         if (LoginInfo != null)
         {
             userEntity.F_CreatorUserId = LoginInfo.UserId;
         }
         userEntity.F_CreatorTime        = DateTime.Now;
         userLogOnEntity.F_Id            = userEntity.F_Id;
         userLogOnEntity.F_UserId        = userEntity.F_Id;
         userLogOnEntity.F_UserSecretkey = Md5.md5(Common.CreateNo(), 16).ToLower();
         userLogOnEntity.F_UserPassword  = Md5.md5(DESEncrypt.Encrypt(Md5.md5(userLogOnEntity.F_UserPassword, 32).ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower();
         userbll.Add(userEntity);
         ulbll.Add(userLogOnEntity);
     }
     return(Success("操作成功。"));
 }
Beispiel #2
0
 public ActionResult SubmitForm(Sys_User userEntity, string keyValue)
 {
     try
     {
         bool i = false;
         if (keyValue == "" || keyValue == null)
         {
             userEntity.F_CreatorUserId = OperatorProvider.Provider.GetCurrent().UserCode;
             userEntity.F_CreatorTime   = DateTime.Now;
             userEntity.F_Id            = System.Guid.NewGuid().ToString();
             i = userApp.Add(userEntity);
         }
         else
         {
             userEntity.F_Id = keyValue;
             userEntity.F_LastModifyUserId = OperatorProvider.Provider.GetCurrent().UserCode;
             userEntity.F_LastModifyTime   = DateTime.Now;
             string[] notstr = { "F_Password", "F_HeadIcon", "F_SecurityLevel", "F_Signature", "F_CreatorUserId", "F_CreatorTime" };
             i = userApp.Update(userEntity, notstr);
         }
         if (i)
         {
             return(Success());
         }
         else
         {
             return(Warning());
         }
     }
     catch (Exception ex)
     {
         return(Error(ex.Message));
     }
 }
        public JsonResult UpdatePwd(string OldPwd, string NewPwd)
        {
            ExecuteResult Er    = new ExecuteResult();
            var           model = userbll.GetModelById <sys_user>(base.SysUser.KeyId);

            if (model != null && model.PassWord == MD5Provider.getStringMd5Hash(OldPwd))
            {
                model.PassWord = MD5Provider.getStringMd5Hash(NewPwd);
                Er.Result      = userbll.Update <sys_user>(model) > 0;
                Er.Message     = Er.Result ? "密码更新成功" : "密码更新失败";
            }
            else
            {
                Er.Result  = false;
                Er.Message = "您输入的旧密码与系统原密码不匹配";
            }
            return(Json(Er));
        }