public ActionResult EditUserCallBack(Models.Admin.BackGroundUserInfoModelIn InModel)
        {
            string errorType = "";
            string msg       = "OK";

            //if (Identity.LoginUserInfo.RoleType != 10)
            //{
            //    errorType = "alert";
            //    msg = "只有管理员才能修改用户信息";
            //}
            // 验证参数
            if (InModel.ID == 0)
            {
                errorType = "alert";
                msg       = "用户信息无效";
            }
            else
            {
                // 查询用户原信息
                Model.UserInfo oldUserInfo = BLL.BackgroundUserBll.GetSingleUserInfo(InModel.ID);

                // 整理用户新信息
                Model.UserInfo newUserInfo = new Model.UserInfo()
                {
                    ID       = InModel.ID,
                    RoleType = Converter.TryToInt32(InModel.RoleType, 20),
                    RealName = InModel.RealName ?? "",
                    Phone    = InModel.Phone ?? "",
                    Email    = InModel.Email ?? "",
                    QQ       = InModel.QQ ?? "",
                    HeadIcon = InModel.HeadIcon ?? ""
                };

                if (BLL.BackgroundUserBll.UpdateUserInfo(newUserInfo) == false)
                {
                    errorType = "alert";
                    msg       = "保存失败,请刷新用户列表重试";
                }
                else
                {
                    // 比较新旧用户信息,整理日志内容
                    string diffContent = BLL.BackgroundUserBll.GetDiffContent(newUserInfo, oldUserInfo);
                    // 记录日志
                    string logTitle = "修改后台用户";
                    string logMsg   = string.Format("修改用户信息:用户名【{0}】,修改信息【{1}】", oldUserInfo.UserName, diffContent);
                    BLL.BackgroundUserBll_log.AddLog(logTitle, logMsg, Request.UserHostAddress);
                }
            }
            return(Json(new { Message = msg, ErrorType = errorType }));
        }
        public ActionResult AddUserCallBack(Models.Admin.BackGroundUserInfoModelIn InModel)
        {
            string errorType = "";
            string msg       = "OK";

            if (Identity.LoginUserInfo.RoleID != 10)
            {
                errorType = "alert";
                msg       = "只有管理员才能添加用户";
            }
            // 验证参数
            else if (string.IsNullOrWhiteSpace(InModel.UserName))
            {
                errorType = "UserName";
                msg       = "请输入用户名";
            }
            else if (BLL.BackgroundUserBll.IsExistUserName(InModel.UserName))
            {
                errorType = "UserName";
                msg       = "该用户名已存在";
            }

            else if (string.IsNullOrWhiteSpace(InModel.Password))
            {
                errorType = "Password";
                msg       = "请输入密码";
            }
            else if (InModel.Password != InModel.RePassword)
            {
                errorType = "RePassword";
                msg       = "两次输入的密码不一致";
            }
            else
            {
                // 添加用户
                Model.UserInfo userInfo = new Model.UserInfo()
                {
                    UserName   = InModel.UserName,
                    PassWord   = Security.getMD5ByStr(InModel.Password),
                    RealName   = InModel.RealName ?? "",
                    RoleType   = Converter.TryToInt32(InModel.RoleType, 20),
                    Phone      = InModel.Phone ?? "",
                    Email      = InModel.Email ?? "",
                    QQ         = InModel.QQ ?? "",
                    HeadIcon   = InModel.HeadIcon ?? "",
                    CreateTime = DateTime.Now
                };
                if (BLL.BackgroundUserBll.AddUserInfo(userInfo) == false)
                {
                    errorType = "alert";
                    msg       = "添加失败,请重试";
                }
                else
                {
                    // 记录日志
                    string logTitle = "添加后台用户";
                    string logMsg   = string.Format("添加用户信息:用户名【{0}】,角色【{1}】", userInfo.UserName, userInfo.RoleType == 10 ? "管理员" : "普通用户");
                    BLL.BackgroundUserBll_log.AddLog(logTitle, logMsg, Request.UserHostAddress);
                }
            }
            return(Json(new { Message = msg, ErrorType = errorType }));
        }