public JsonResult DeviceRetryLockPost(string app_sj_need_auth, string user_default_status, string namelist_black_or_white, string user_unlock_auto_enabled, string user_unlock_auto_hours,
            string lock_user_farto_lasttime_hours, string lock_count_mode, string allowed_wrong_times_when_login)
        {
            Hashtable result = new Hashtable();
            List<GlobalParam> parms = new List<GlobalParam>();//Bo.BoFactory.GetGlobalParamBO.LoadGlobalParam();

            GlobalParam parm = new GlobalParam();

            //parm.ConfigKey = "app_sj_need_auth";
            //parm.ConfigValue = app_sj_need_auth;
            //parms.Add(parm);

            //parm = new GlobalParam();
            //parm.ConfigKey = "user_default_status";
            //parm.ConfigValue = user_default_status;
            //parms.Add(parm);

            //parm = new GlobalParam();
            //parm.ConfigKey = "namelist_black_or_white";
            //parm.ConfigValue = namelist_black_or_white;
            //parms.Add(parm);

            parm = new GlobalParam();
            parm.ConfigKey = "device_unlock_auto_enabled";
            parm.ConfigValue = user_unlock_auto_enabled;
            parms.Add(parm);

            parm = new GlobalParam();
            parm.ConfigKey = "device_unlock_auto_hours";
            parm.ConfigValue = user_unlock_auto_hours;
            parms.Add(parm);

            parm = new GlobalParam();
            parm.ConfigKey = "lock_device_farto_lasttime_hours";
            parm.ConfigValue = lock_user_farto_lasttime_hours;
            parms.Add(parm);

            parm = new GlobalParam();
            parm.ConfigKey = "lock_device_count_mode";
            parm.ConfigValue = lock_count_mode;
            parms.Add(parm);

            //parm = new GlobalParam();
            //parm.ConfigKey = "allowed_wrong_times_when_login";
            //parm.ConfigValue = allowed_wrong_times_when_login;
            //parms.Add(parm);

            Bo.BoFactory.GetGlobalParamBO.SaveGlobalParam(parms);
            bool r = true;// Bo.BoFactory.GetCommonBO.UnLockDevice(deviceid, CurrentUser.UserUId);
            result["r"] = r;
            result["d"] = "设备重试锁定设置" + (r ? "成功!" : "失败!");

            return Json(result);
        }
        public JsonResult SaveDeviceAuthSetting(string enableDeviceAuth)
        {
            enableDeviceAuth = Server.UrlEncode(enableDeviceAuth);
            GlobalParam p = Bo.BoFactory.GetGlobalParamBO.GetGlobalParam("device_need_auth");
            if (p == null)
            {
                p = new GlobalParam();
                p.ConfigKey = "device_need_auth";
            }
            p.ConfigValue = enableDeviceAuth;
            Bo.BoFactory.GetGlobalParamBO.Save(p);
            string val = enableDeviceAuth == "1" ? "true" : "false";
            Hashtable hr = new Hashtable();
            Bo.BoFactory.GetSystemConfigBO.SaveSystemConfig("com.beyondbit.user.auth.apply.enable", val, hr);
            Service.ServiceReference1.ManagerServiceClient msc = new Service.ServiceReference1.ManagerServiceClient();
            msc.ResetRuntimeConfigs();

            Hashtable result = new Hashtable();

            result["r"] = true;
            result["d"] = "设备审核设置成功!";

            return Json(result);
        }
        public JsonResult SaveUserAuthSetting(string enableUserAuth)
        {
            enableUserAuth = Server.UrlEncode(enableUserAuth);
            GlobalParam p = Bo.BoFactory.GetGlobalParamBO.GetGlobalParam("user_need_auth");
            if (p == null)
            {
                p = new GlobalParam();
                p.ConfigKey = "user_need_auth";
            }
            p.ConfigValue = enableUserAuth;
            Bo.BoFactory.GetGlobalParamBO.Save(p);

            Hashtable result = new Hashtable();

            result["r"] = true;
            result["d"] = "用户审核设置成功!";

            return Json(result);
        }
        public JsonResult GlobalParamPost(string app_sj_need_auth, string user_default_status, string namelist_black_or_white, string user_unlock_auto_enabled, string user_unlock_auto_hours,
            string lock_user_farto_lasttime_hours, string lock_count_mode, string allowed_wrong_times_when_login, string disable_device_after_notpass_device, string bua_auth_url)
        {
            app_sj_need_auth = Server.UrlEncode(app_sj_need_auth);
            user_default_status = Server.UrlEncode(user_default_status);
            namelist_black_or_white = Server.UrlEncode(namelist_black_or_white);
            user_unlock_auto_enabled = Server.UrlEncode(user_unlock_auto_enabled);
            user_unlock_auto_hours = Server.UrlEncode(user_unlock_auto_hours);
            lock_user_farto_lasttime_hours = Server.UrlEncode(lock_user_farto_lasttime_hours);
            lock_count_mode = Server.UrlEncode(lock_count_mode);
            allowed_wrong_times_when_login = Server.UrlEncode(allowed_wrong_times_when_login);
            disable_device_after_notpass_device = Server.UrlEncode(disable_device_after_notpass_device);
            bua_auth_url = Server.UrlEncode(bua_auth_url);

            Hashtable result = new Hashtable();
            List<GlobalParam> parms = new List<GlobalParam>();//Bo.BoFactory.GetGlobalParamBO.LoadGlobalParam();

            GlobalParam parm = new GlobalParam();

            parm.ConfigKey = "app_sj_need_auth";
            parm.ConfigValue = app_sj_need_auth;
            parms.Add(parm);

            parm = new GlobalParam();
            parm.ConfigKey = "user_default_status";
            parm.ConfigValue = user_default_status;
            parms.Add(parm);

            parm = new GlobalParam();
            parm.ConfigKey = "namelist_black_or_white";
            parm.ConfigValue = namelist_black_or_white;
            parms.Add(parm);

            parm = new GlobalParam();
            parm.ConfigKey = "disable_device_after_notpass_device";
            parm.ConfigValue = disable_device_after_notpass_device;
            parms.Add(parm);

            parm = new GlobalParam();
            parm.ConfigKey = "bua_auth_url";
            parm.ConfigValue = bua_auth_url;
            parms.Add(parm);

            //parm = new GlobalParam();
            //parm.ConfigKey = "user_unlock_auto_hours";
            //parm.ConfigValue = user_unlock_auto_hours;
            //parms.Add(parm);

            //parm = new GlobalParam();
            //parm.ConfigKey = "lock_user_farto_lasttime_hours";
            //parm.ConfigValue = lock_user_farto_lasttime_hours;
            //parms.Add(parm);

            //parm = new GlobalParam();
            //parm.ConfigKey = "lock_count_mode";
            //parm.ConfigValue = lock_count_mode;
            //parms.Add(parm);

            //parm = new GlobalParam();
            //parm.ConfigKey = "allowed_wrong_times_when_login";
            //parm.ConfigValue = allowed_wrong_times_when_login;
            //parms.Add(parm);

            Bo.BoFactory.GetGlobalParamBO.SaveGlobalParam(parms);
            bool r = true;// Bo.BoFactory.GetCommonBO.UnLockDevice(deviceid, CurrentUser.UserUId);
            result["r"] = r;
            result["d"] = "全局参数设置" + (r ? "成功!" : "失败!");

            return Json(result);
        }