예제 #1
0
 /// <summary>
 /// 用户登录
 /// </summary>
 /// <param name="userName"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public int UserLogin(string userName, string password, out UserInfo info)
 {
     info = GetModel<UserInfo>("UserName", userName);
     if (info == null)
         return RT.User_NotExist_UserName;
     if (info.Password != DEncrypt.Encrypt(password))
         return RT.User_Error_Password;
     return RT.Success;
 }
예제 #2
0
 public ActionResult UserAdd(UserInfo info)
 {
     if (string.IsNullOrEmpty(info.ID))
     {
         info.ID = GuidHelper.GetUniqueID();
         info.Password = DEncrypt.Encrypt(info.Password);
         if (UserService.Insert<UserInfo>(info))
         {
             Result.IsOk = true;
             Result.Msg = "添加成功";
         }
         else
         {
             Result.IsOk = false;
             Result.Msg = "添加失败";
         }
     }
     else
     {
         if (UserService.Update<UserInfo>(info))
         {
             Result.IsOk = true;
             Result.Msg = "更新成功";
         }
         else
         {
             Result.IsOk = false;
             Result.Msg = "更新失败";
         }
     }
     Result.RedirectUrl = "/User/UserList";
     return Json(Result);
 }