Ejemplo n.º 1
0
        public ActionResult EditPlatUserPwd(AccountPasswordChangeModel model)
        {
            JsonModel jm = new JsonModel();

            //如果表单模型验证成功
            if (ModelState.IsValid)
            {
                UserSessionModel sessionModel = (UserSessionModel)Session[ConstantParam.SESSION_USERINFO];
                var id = sessionModel.UserID;

                // 若当前登录用户为平台用户
                IPlatformUserBLL platformUserBll = BLLFactory <IPlatformUserBLL> .GetBLL("PlatformUserBLL");

                T_PlatformUser platformUser = platformUserBll.GetEntity(m => m.Id == model.UserId && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                if (platformUser != null)
                {
                    platformUser.Password = PropertyUtils.GetMD5Str(model.Password);
                    // 保存到数据库
                    platformUserBll.Update(platformUser);

                    //日志记录
                    jm.Content = PropertyUtils.ModelToJsonString(model);
                }
                else
                {
                    jm.Msg = "该用户不存在";
                }
            }
            else
            {
                // 保存异常日志
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult EditUserPwd(AccountPasswordChangeModel model)
        {
            JsonModel jm = new JsonModel();

            //如果表单模型验证成功
            if (ModelState.IsValid)
            {
                //获取要修改密码的用户
                ICompanyUserBLL companyUserBll = BLLFactory <ICompanyUserBLL> .GetBLL("CompanyUserBLL");

                T_CompanyUser companyUser = companyUserBll.GetEntity(m => m.Id == model.UserId && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                if (companyUser != null)
                {
                    companyUser.Password = PropertyUtils.GetMD5Str(model.Password);
                    // 保存到数据库
                    companyUserBll.Update(companyUser);

                    //日志记录
                    jm.Content = PropertyUtils.ModelToJsonString(model);
                }
                else
                {
                    jm.Msg = "该用户不存在";
                }
            }
            else
            {
                // 保存异常日志
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public ActionResult EditPlatUserPwd()
        {
            UserSessionModel sessionModel = (UserSessionModel)Session[ConstantParam.SESSION_USERINFO];
            var id = sessionModel.UserID;

            IPlatformUserBLL platformUserBll = BLLFactory <IPlatformUserBLL> .GetBLL("PlatformUserBLL");

            var userInfo = platformUserBll.GetEntity(index => index.Id == id && index.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            if (userInfo != null)
            {
                AccountPasswordChangeModel platformUserModel = new AccountPasswordChangeModel();
                platformUserModel.UserId   = userInfo.Id;
                platformUserModel.UserName = userInfo.UserName;
                return(View(platformUserModel));
            }
            else
            {
                return(RedirectToAction("Index", "Platform"));
            }
        }
Ejemplo n.º 4
0
        public ActionResult EditUserPwd()
        {
            UserSessionModel sessionModel = (UserSessionModel)Session[ConstantParam.SESSION_USERINFO];
            var id = sessionModel.UserID;

            //获取要修改密码的总公司用户
            ICompanyUserBLL companyUserBll = BLLFactory <ICompanyUserBLL> .GetBLL("CompanyUserBLL");

            T_CompanyUser companyUser = companyUserBll.GetEntity(m => m.Id == id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            if (companyUser != null)
            {
                AccountPasswordChangeModel model = new AccountPasswordChangeModel();
                model.UserId   = companyUser.Id;
                model.UserName = companyUser.UserName;
                return(View(model));
            }
            else
            {
                return(RedirectToAction("Index", "CompanyPlatform"));
            }
        }