Пример #1
0
        public List <ConfigEntity> GetConfigData(string configAppID, string configAppType, string configCluster, string configStation)
        {
            List <ConfigEntity> entityList = null;

            KeyValue[] options               = new KeyValue[] { };
            KeyValue[] configContext         = new KeyValue[] { new KeyValue("CONFIG_APPID", configAppID), new KeyValue("CONFIG_APPTYPE", configAppType), new KeyValue("CONFIG_CLUSTER", configCluster), new KeyValue("CONFIG_STATION", configStation) };
            KeyValue[] parameterFilter       = new KeyValue[] { new KeyValue("PARAMETER_SCOPE", configAppType) };
            string[]   parameterResultKeys   = new string[] { };
            string[]   parameterResultValues = new string[] { };
            string[]   resultKeys            = new string[] { "CONFIG_VALUE", "PARAMETER_ID", "PARAMETER_INDEX", "PARAMETER_NAME" };
            string[]   resultValues          = new string[] { };
            int        errorCode             = imsapi.configGetValues(sessionContext, options, configContext, parameterFilter, parameterResultKeys, out parameterResultValues, resultKeys, out resultValues);

            LogHelper.Info("Api configGetValues error code=" + errorCode);
            if (errorCode == 0)
            {
                int loop  = resultKeys.Length;
                int count = resultValues.Length;
                entityList = new List <ConfigEntity>();
                for (int i = 0; i < count; i += loop)
                {
                    ConfigEntity entity = new ConfigEntity();
                    entity.CONFIG_VALUE    = resultValues[i + 0];
                    entity.PARAMETER_ID    = resultValues[i + 1];
                    entity.PARAMETER_INDEX = resultValues[i + 2];
                    entity.PARAMETER_NAME  = resultValues[i + 3];
                    entityList.Add(entity);
                }
            }
            return(entityList);
        }