예제 #1
0
        /// <summary>
        /// Ajoute tous les compteurs à la collection.
        /// </summary>
        /// <param name="moduleKey">Clef de module.</param>
        /// <param name="counterDataList">Listes des compteurs.</param>
        void ICube.ExportCounters(object moduleKey, ICollection <CounterData> counterDataList)
        {
            if (counterDataList == null)
            {
                throw new ArgumentNullException("counterDataList");
            }

            CounterData counterData;

            if (_timeCounter != null)
            {
                counterData           = new CounterData();
                counterData.ModuleKey = moduleKey;
                Cube.InitCounterData(_timeCounter, counterData, _key, _databaseName);
                counterDataList.Add(counterData);
            }

            foreach (string code in _counters.Keys)
            {
                ExternalCounter counter = _counters[code];

                counterData             = new CounterData();
                counterData.ModuleKey   = moduleKey;
                counterData.CounterCode = code;
                Cube.InitCounterData(counter, counterData, _key, _databaseName);

                counterDataList.Add(counterData);
            }
        }
예제 #2
0
        /// <summary>
        /// Ajoute un compteur au cube.
        /// </summary>
        /// <param name="counter">Données.</param>
        internal void AddCounter(CounterData counter)
        {
            if (counter.StartDate < _firstHit)
            {
                _firstHit = counter.StartDate;
            }

            string counterCode = counter.CounterCode;

            if (counterCode == null)
            {
                if (_timeCounter == null)
                {
                    _timeCounter = new ExternalCounter(this, counter);
                }
                else
                {
                    _timeCounter.Merge(counter);
                }
            }
            else
            {
                ExternalCounter externalCounter;
                if (_counters.TryGetValue(counterCode, out externalCounter))
                {
                    externalCounter.Merge(counter);
                }
                else
                {
                    _counters[counterCode] = new ExternalCounter(this, counter);
                }
            }
        }