public void IsFeatureEnabledTest_FeatureEnabledAllowViaGroupAndId()
        {
            string featureKey = FeatureKey.RemoteExecution;
            string loginId = "TestId";
            FeatureAccess cfg = new FeatureAccess();
            cfg.FeatureId = featureKey;
            cfg.Enabled = true;
            FeatureAccess[] accessCfg = new FeatureAccess[] { cfg };

            AccessSetting allow = new AccessSetting();
            allow.GroupName = "EpicSuccessGroup";
            AccessSetting allow2 = new AccessSetting();
            allow2.LoginId = loginId;
            cfg.Allow = new AccessSetting[] { allow, allow2 };

            List<string> adGroups = new List<string>();
            adGroups.Add("IrreleventGroup1");
            adGroups.Add("EpicSuccessGroup");
            adGroups.Add("IrreleventGroup2");

            bool expected = true;
            bool actual;
            actual = FeatureAccessHelper.IsFeatureEnabled(featureKey, loginId, adGroups, accessCfg);
            Assert.AreEqual(expected, actual);
        }
        public static bool UpdateAccessSetting(AccessSetting set)
        {
            IWCFService.ISeatManageService seatService = WcfAccessProxy.ServiceProxy.CreateChannelSeatManageService();
            bool error = false;

            try
            {
                return(seatService.UpdateAccessSetting(set));
            }
            catch (Exception ex)
            {
                error = true;
                SeatManageComm.WriteLog.Write("更新门禁接口设置失败:" + ex.Message);
                return(false);
            }
            finally
            {
                ICommunicationObject ICommObjectService = seatService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
        /// <summary>
        /// 更新门禁接口设置
        /// </summary>
        /// <param name="set"></param>
        /// <returns></returns>
        public bool UpdateAccessSetting(AccessSetting set)
        {
            string strSet = set.ToString();

            SqlParameter[] parameters =
            {
                new SqlParameter("@ServiceSet",   SqlDbType.Text),
                new SqlParameter("@ServiceSetID", SqlDbType.Int, 4)
            };
            parameters[0].Value = strSet;
            parameters[1].Value = 4;
            return(t_sm_service.Update(strSet, parameters));
        }
        public static bool UpdateAccessSetting(AccessSetting set)
        {
            IWCFService.ISeatManageService seatService = new WcfServiceForSeatManage.SeatManageDateService();
            bool error = false;

            try
            {
                return(seatService.UpdateAccessSetting(set));
            }
            catch (Exception ex)
            {
                error = true;
                SeatManageComm.WriteLog.Write("更新门禁接口设置失败:" + ex.Message);
                return(false);
            }
        }
        public void IsFeatureEnabledTest_FeatureEnabledAllowUser()
        {
            string featureKey = FeatureKey.RemoteExecution;
            string loginId = "TestId";
            FeatureAccess cfg = new FeatureAccess();
            cfg.FeatureId = featureKey;
            cfg.Enabled = true;
            FeatureAccess[] accessCfg = new FeatureAccess[] { cfg };
            AccessSetting allow = new AccessSetting();
            allow.LoginId = loginId;
            cfg.Allow = new AccessSetting[] { allow };

            bool expected = true;
            bool actual;
            actual = FeatureAccessHelper.IsFeatureEnabled(featureKey, loginId, new List<string>(), accessCfg);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 6
0
        public void Init()
        {
            AccessSetting acsSetting = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetSetting <AccessSetting>();

            if (acsSetting != null && acsSetting.Accesses != null && acsSetting.Accesses.Count > 0)
            {
                AccessInfo defaultAcs = new AccessInfo {
                    ID = 0, Name = string.Empty
                };
                List <AccessInfo> list = new List <AccessInfo>();
                list.Insert(0, defaultAcs);
                list.AddRange(acsSetting.Accesses);
                this.DataSource = list;
            }
            this.DisplayMember = "Name";
            this.ValueMember   = "ID";
            this.DropDownStyle = ComboBoxStyle.DropDownList;
        }
Exemplo n.º 7
0
        /// <summary>
        /// 通过权限组名称获取权限组ID,权限组名称为空时表示所有权限,返回0,没有找到的返回-1
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        private int GetAccessID(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(0);
            }

            SysParaSettingsBll sbll          = new SysParaSettingsBll(AppConifg.Current.ParkingConnection);
            AccessSetting      accessSetting = sbll.GetOrCreateSetting <AccessSetting>();
            AccessInfo         access        = null;

            if (accessSetting.Accesses != null)
            {
                access = accessSetting.Accesses.FirstOrDefault(item => item.Name == name);
            }
            if (access != null)
            {
                return(access.ID);
            }

            return(-1);
        }
Exemplo n.º 8
0
 public bool DownloadAccessSettingToEntrance(int entranceID, AccessSetting ascLevel)
 {
     try
     {
         if (_Channel != null)
         {
             return(_Channel.DownloadAccessSettingToEntrance(entranceID, ascLevel));
         }
     }
     catch (CommunicationException)
     {
         if (ParkAdapterConnectFail != null)
         {
             ParkAdapterConnectFail(this, EventArgs.Empty);
         }
     }
     catch (Exception ex)
     {
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
     return(false);
 }
        public void IsFeatureEnabledTest_FeatureEnabledDenyGroup()
        {
            string featureKey = FeatureKey.RemoteExecution;
            string loginId = "TestId";
            FeatureAccess cfg = new FeatureAccess();
            cfg.FeatureId = featureKey;
            cfg.Enabled = true;
            FeatureAccess[] accessCfg = new FeatureAccess[] { cfg };

            AccessSetting deny = new AccessSetting();
            deny.GroupName = "EpicFailGroup";
            cfg.Deny = new AccessSetting[] { deny };

            List<string> adGroups = new List<string>();
            adGroups.Add("IrreleventGroup1");
            adGroups.Add("EpicFailGroup");
            adGroups.Add("IrreleventGroup2");

            bool expected = false;
            bool actual;
            actual = FeatureAccessHelper.IsFeatureEnabled(featureKey, loginId,adGroups , accessCfg);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 10
0
 public bool DownloadAccessSettingToEntrance(int entranceID, AccessSetting ascLevel)
 {
     return(_Park.DownloadAccessSettingToEntrance(entranceID, ascLevel));
 }
Exemplo n.º 11
0
 public bool DownloadAccessSetting(AccessSetting ascLevel)
 {
     return(_Park.DownloadAccessSetting(ascLevel));
 }
Exemplo n.º 12
0
 public override bool ApplyAccessSetting(AccessSetting accessSetting)
 {
     return(false);
 }
Exemplo n.º 13
0
        /// <summary>
        /// 同步系统设置
        /// </summary>
        private bool SyncSystemOptions()
        {
            NotifyMsg(Resources.Resource1.FrmSyncDataToStandby_SynchronizingOptions);
            NotifyProgress(8, 0);

            bool          success = true;
            CommandResult result  = null;

            SysParaSettingsBll masterssb  = new SysParaSettingsBll(AppSettings.CurrentSetting.CurrentMasterConnect);
            SysParaSettingsBll standbyssb = new SysParaSettingsBll(AppSettings.CurrentSetting.CurrentStandbyConnect);

            UserSetting us = masterssb.GetSetting <UserSetting>();

            success = us != null ? success : false;
            if (us != null)
            {
                result  = standbyssb.SaveSetting <UserSetting>(us);
                success = result.Result == ResultCode.Successful;
                NotifyProgress(null, null);
            }
            if (us != null && result.Result == ResultCode.Successful)
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_UserSetting, Resources.Resource1.Form_Success));
            }
            else
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_UserSetting, Resources.Resource1.Form_Fail), Color.Red);
            }

            HolidaySetting hs = masterssb.GetSetting <HolidaySetting>();

            success = hs != null ? success : false;
            if (hs != null)
            {
                result  = standbyssb.SaveSetting <HolidaySetting>(hs);
                success = result.Result == ResultCode.Successful;
                NotifyProgress(null, null);
            }
            if (hs != null && result.Result == ResultCode.Successful)
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_HolidaySetting, Resources.Resource1.Form_Success));
            }
            else
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_HolidaySetting, Resources.Resource1.Form_Fail), Color.Red);
            }

            AccessSetting acs = masterssb.GetSetting <AccessSetting>();

            success = acs != null ? success : false;
            if (acs != null)
            {
                result  = standbyssb.SaveSetting <AccessSetting>(acs);
                success = result.Result == ResultCode.Successful;
                NotifyProgress(null, null);
            }
            if (acs != null && result.Result == ResultCode.Successful)
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_AccessSetting, Resources.Resource1.Form_Success));
            }
            else
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_AccessSetting, Resources.Resource1.Form_Fail), Color.Red);
            }

            TariffSetting ts = masterssb.GetSetting <TariffSetting>();

            success = ts != null ? success : false;
            if (ts != null)
            {
                result  = standbyssb.SaveSetting <TariffSetting>(ts);
                success = result.Result == ResultCode.Successful;
                NotifyProgress(null, null);
            }
            if (ts != null && result.Result == ResultCode.Successful)
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_TariffSetting, Resources.Resource1.Form_Success));
            }
            else
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_TariffSetting, Resources.Resource1.Form_Fail), Color.Red);
            }

            CarTypeSetting cts = masterssb.GetSetting <CarTypeSetting>();

            success = cts != null ? success : false;
            if (cts != null)
            {
                result  = standbyssb.SaveSetting <CarTypeSetting>(cts);
                success = result.Result == ResultCode.Successful;
                NotifyProgress(null, null);
            }
            if (cts != null && result.Result == ResultCode.Successful)
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_CarTypeSetting, Resources.Resource1.Form_Success));
            }
            else
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_CarTypeSetting, Resources.Resource1.Form_Fail), Color.Red);
            }

            CustomCardTypeSetting ccts = masterssb.GetSetting <CustomCardTypeSetting>();

            success = ccts != null ? success : false;
            if (ccts != null)
            {
                result  = standbyssb.SaveSetting <CustomCardTypeSetting>(ccts);
                success = result.Result == ResultCode.Successful;
                NotifyProgress(null, null);
            }
            if (ccts != null && result.Result == ResultCode.Successful)
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_CustomCardTypeSetting, Resources.Resource1.Form_Success));
            }
            else
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_CustomCardTypeSetting, Resources.Resource1.Form_Fail), Color.Red);
            }

            BaseCardTypeSetting bcts = masterssb.GetSetting <BaseCardTypeSetting>();

            success = bcts != null ? success : false;
            if (bcts != null)
            {
                result  = standbyssb.SaveSetting <BaseCardTypeSetting>(bcts);
                success = result.Result == ResultCode.Successful;
                NotifyProgress(null, null);
            }
            if (bcts != null && result.Result == ResultCode.Successful)
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_BaseCardTypeSetting, Resources.Resource1.Form_Success));
            }
            else
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_BaseCardTypeSetting, Resources.Resource1.Form_Fail), Color.Red);
            }

            KeySetting ks = masterssb.GetSetting <KeySetting>();

            success = ks != null ? success : false;
            if (ks != null)
            {
                result  = standbyssb.SaveSetting <KeySetting>(ks);
                success = result.Result == ResultCode.Successful;
                NotifyProgress(null, null);
            }
            if (ks != null && result.Result == ResultCode.Successful)
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_KeySetting, Resources.Resource1.Form_Success));
            }
            else
            {
                NotifyInfo(string.Format("{0}{1}", Resources.Resource1.FrmSyncDataToStandby_KeySetting, Resources.Resource1.Form_Fail), Color.Red);
            }

            NotifyMsg(Resources.Resource1.FrmSyncDataToStandby_OptionsFinish);

            return(success);
        }
Exemplo n.º 14
0
 /// <summary>
 /// 应用通道权限
 /// </summary>
 /// <param name="accessSetting"></param>
 public abstract bool ApplyAccessSetting(AccessSetting accessSetting);