Пример #1
0
        private void TraverseConfigRows(ConfigDataSet.T_ConfigDataTable configTable, Func <PaoObject, bool> traverseMethod, string configName)
        {
            var dataRows = configTable.Cast <ConfigDataSet.T_ConfigRow>();

            // 首先取出优先级较高的扩展配置
            foreach (var extendRow in dataRows)
            {
                bool useConfig = false;
                if (!extendRow.IsFilterNull())
                {
                    var filter = (IClientFilter)IOPublic.Deserialize(extendRow.Filter);
                    if (filter.Predicate(SecurityPublic.CurrentUser.UserID
                                         , SecurityPublic.CurrentUser.ComputerID))
                    {
                        useConfig = true;
                    }
                }
                else
                {
                    useConfig = true;
                }

                if (useConfig)
                {
                    var configObject = (PaoObject)IOPublic.Deserialize(extendRow.Config);
                    if (!traverseMethod(configObject))
                    {
                        return;
                    }
                }
            }
        }
Пример #2
0
        private void TraverseGlobalConfig(Func <PaoObject, bool> traverseMethod, string configName)
        {
            var configTable = new ConfigDataSet.T_ConfigDataTable();

            DataService.Value.FillAll(configTable, Sql_QueryCurrentGlobalConfig
                                      , new DataParameter("@ConfigName", configName)
                                      , new DataParameter("@SoftwareID", PaoApplication.Default.SoftwareID));

            TraverseConfigRows(configTable, traverseMethod, configName);
        }
Пример #3
0
        public void SaveLocalConfig(PaoObject configObject)
        {
            var dataService = DataService.Value;

            dataService.ExecuteBySql(Sql_DisableCurrentLocalConfig
                                     , new DataParameter("@ConfigName", configObject.ID)
                                     , new DataParameter("@ComputerID", SecurityPublic.CurrentUser.ComputerID)
                                     , new DataParameter("@SoftwareID", PaoApplication.Default.SoftwareID));

            var configTable = new ConfigDataSet.T_ConfigDataTable();
            var configRow   = configTable.AddT_ConfigRow(Guid.NewGuid()
                                                         , PaoApplication.Default.SoftwareID
                                                         , SecurityPublic.CurrentUser.ComputerID
                                                         , configObject.ID
                                                         , Int32.MaxValue
                                                         , DateTime.Now
                                                         , DateTime.MaxValue
                                                         , null
                                                         , IOPublic.Serialize <byte[]>(configObject));

            dataService.UpdateTable(configTable, "T_Config");
        }
Пример #4
0
        public void SaveGlobalConfig(PaoObject configObject, int priority, IClientFilter clientFilter)
        {
            var dataService = DataService.Value;

            SecurityPublic.DemandPermission(ID, Permission_SaveGlobalConfig);
            dataService.ExecuteBySql(Sql_DisableCurrentLocalConfig
                                     , new DataParameter("@ConfigName", configObject.ID)
                                     , new DataParameter("@SoftwareID", PaoApplication.Default.SoftwareID));

            var configTable = new ConfigDataSet.T_ConfigDataTable();
            var configRow   = configTable.AddT_ConfigRow(Guid.NewGuid()
                                                         , PaoApplication.Default.SoftwareID
                                                         , null
                                                         , configObject.ID
                                                         , priority
                                                         , DateTime.Now
                                                         , DateTime.MaxValue
                                                         , IOPublic.Serialize <byte[]>(clientFilter)
                                                         , IOPublic.Serialize <byte[]>(configObject));

            dataService.UpdateTable(configTable, "T_Config");
        }