Пример #1
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="actionContext"></param>
        /// <param name="httpContext"></param>
        /// <returns></returns>
        public Forward UpdateUser(ActionContext actionContext, HttpContext httpContext)
        {
            AjaxForwardUtils.InitResponse(httpContext.Response);
            JavaScriptObject jsonObj = new JavaScriptObject();

            try
            {
                long userID = long.Parse(httpContext.Request.Params["id"]);
                if (-1 != userID)
                {
                    string password           = httpContext.Request.Params["p"];
                    string newEncryptPassword = this.userService.ChangeUserPasswordOne(null, userID, password);
                    //  Domain = userInfoService.Load(userInfoID);
                    //httpContext.Response.Write("ok");
                    jsonObj.Add("newEncryptPassword", newEncryptPassword);
                    return(AjaxForwardUtils.SuccessForward(httpContext, jsonObj, "USERINFO.CHANGE_PASSWORD.WEB.SUCCESS", null));
                }
                if (logger.IsDebugEnabled)
                {
                    logger.Debug("update:" + userID);
                }
                return(null);
            }
            catch (Exception e)
            {
                return(AjaxForwardUtils.ExceptionForward(httpContext, jsonObj, e));
            }
        }
Пример #2
0
        /// <summary>
        /// 获取OUInfo的详细信息
        /// </summary>
        /// <param name="actionContext"></param>
        /// <param name="httpContext"></param>
        /// <returns>null</returns>
        public Forward GetDetail(ActionContext actionContext, HttpContext httpContext)
        {
            AjaxForwardUtils.InitResponse(httpContext.Response);
            JavaScriptObject json = new JavaScriptObject();

            try
            {
                string unid = RequestUtils.GetStringParameter(httpContext, "unid", null);
                logger.Debug("unid:" + unid);
                if (string.IsNullOrEmpty(unid))
                {
                    MsgException e = new MsgException("OUInfo的Unid不能为空,需要在请求参数中包含有效的OUInfo的Unid值!");
                    logger.Error(e.Message, e);
                    return(AjaxForwardUtils.ExceptionForward(httpContext, json, e));
                }

                OUInfo ouInfo = this.ouInfoService.Load(unid);
                if (ouInfo == null)
                {
                    MsgException e = new MsgException("指定Unid的OUInfo在系统中不存在:unid=" + unid);
                    logger.Error(e.Message, e);
                    return(AjaxForwardUtils.ExceptionForward(httpContext, json, e));
                }

                string jsonStr = JavaScriptConvert.SerializeObject(ouInfo);
                if (logger.IsDebugEnabled)
                {
                    logger.Debug("json=" + jsonStr);
                }
                httpContext.Response.Write(jsonStr);
                return(null);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                return(AjaxForwardUtils.ExceptionForward(httpContext, json, e));
            }
        }