public JsonResult InitSingle() { #region 权限控制 int[] iRangePage = { AddPageNodeId, EditPageNodeId, DetailPageNodeId }; int iCurrentPageNodeId = RequestParameters.Pint("NodeId"); var tempAuth = Utits.IsNodePageAuth(iRangePage, iCurrentPageNodeId); if (tempAuth.ErrorType != 1) { return(Json(tempAuth)); } #endregion #region InitSingle Guid ID = RequestParameters.PGuid("ID"); if (ID != Guid.Empty) { var usersBll = new UsersBll(); var item = usersBll.GetObjectById(ID); var szDetailModel = new ResultDetail(); szDetailModel.Entity = item; szDetailModel.ErrorType = 1; return(Json(szDetailModel)); } else { var sRetrunModel = new ResultMessage(); sRetrunModel.ErrorType = 0; sRetrunModel.MessageContent = "参数错误."; return(Json(sRetrunModel)); } #endregion }
/// <summary> /// 修改密码 /// </summary> /// <returns></returns> public JsonResult ModifyPassword() { Guid iUSERID = Utits.CurrentUserID; if (iUSERID == Guid.Empty) { var sRetrunModel = new ResultMessage(); sRetrunModel.ErrorType = 3; sRetrunModel.MessageContent = "未登录."; return(Json(sRetrunModel)); } string szOldPassword = RequestParameters.Pstring("OldPassword"); if (szOldPassword.Length <= 0) { var sRetrunModel = new ResultMessage(); sRetrunModel.ErrorType = 0; sRetrunModel.MessageContent = "旧密码不能为空."; return(Json(sRetrunModel)); } string szNewPassword = RequestParameters.Pstring("NewPassword"); if (szNewPassword.Length <= 0) { var sRetrunModel = new ResultMessage(); sRetrunModel.ErrorType = 0; sRetrunModel.MessageContent = "新密码不能为空."; return(Json(sRetrunModel)); } var cBll = new UsersBll(); var item = cBll.GetObjectById(iUSERID); if (item == null) { var sRetrunModel = new ResultMessage(); sRetrunModel.ErrorType = 0; sRetrunModel.MessageContent = "用户名不存在."; return(Json(sRetrunModel)); } if (CommonLib.HashEncrypt.BgPassWord(szOldPassword) != item.Password) { var sRetrunModel = new ResultMessage(); sRetrunModel.ErrorType = 0; sRetrunModel.MessageContent = "旧密码有误."; return(Json(sRetrunModel)); } string iNewPassword = HashEncrypt.BgPassWord(szNewPassword); bool isFlag = cBll.ChangePassword(item.UserID, iNewPassword); if (isFlag) { var sRetrunModel = new ResultMessage(); sRetrunModel.ErrorType = 1; sRetrunModel.MessageContent = "操作成功."; return(Json(sRetrunModel)); } else { var sRetrunModel = new ResultMessage(); sRetrunModel.ErrorType = 0; sRetrunModel.MessageContent = "操作失败."; return(Json(sRetrunModel)); } }