示例#1
0
        /// <summary>
        /// Update the track with the received data
        /// </summary>
        /// <param name="mvTrackInfo"></param>
        public void Update(DBTrackInfo mvTrackInfo)
        {
            List <DBSourceInfo> sources;

            lock (trackDetailSources) sources = new List <DBSourceInfo>(trackDetailSources);

            // unlock the mv fields for the first iteration
            mvTrackInfo.ProtectExistingValuesFromCopy(false);

            // first update from the primary source of this data
            int providerCount = 0;

            if (mvTrackInfo.PrimarySource != null && mvTrackInfo.PrimarySource.Provider != null)
            {
                UpdateResults success = mvTrackInfo.PrimarySource.Provider.UpdateTrack(mvTrackInfo);
                logger.Debug("*** UPDATE: Track='{0}', Provider='{1}', Version={2}, Result={3}", mvTrackInfo.Track, mvTrackInfo.PrimarySource.Provider.Name, mvTrackInfo.PrimarySource.Provider.Version, success.ToString());
                providerCount++;
            }

            foreach (DBSourceInfo currSource in sources)
            {
                if (currSource.IsDisabled(DataType.TRACKDETAIL))
                {
                    continue;
                }

                if (currSource == mvTrackInfo.PrimarySource)
                {
                    continue;
                }

                providerCount++;

                if (providerCount <= mvCentralCore.Settings.DataProviderRequestLimit || mvCentralCore.Settings.DataProviderRequestLimit == 0)
                {
                    UpdateResults success = currSource.Provider.UpdateTrack(mvTrackInfo);
                    logger.Debug("*** UPDATE: Track='{0}', Provider='{1}', Version={2}, Result={3}", mvTrackInfo.Track, currSource.Provider.Name, currSource.Provider.Version, success.ToString());
                }
                else
                {
                    // stop update
                    break;
                }

                if (mvCentralCore.Settings.UseTranslator)
                {
                    mvTrackInfo.Translate();
                }
            }
        }
        /// <summary>
        /// Update the track with the received data
        /// </summary>
        /// <param name="mvTrackInfo"></param>
        public void Update(DBTrackInfo mvTrackInfo)
        {
            List<DBSourceInfo> sources;
              lock (trackDetailSources) sources = new List<DBSourceInfo>(trackDetailSources);

              // unlock the mv fields for the first iteration
              mvTrackInfo.ProtectExistingValuesFromCopy(false);

              // first update from the primary source of this data
              int providerCount = 0;
              if (mvTrackInfo.PrimarySource != null && mvTrackInfo.PrimarySource.Provider != null)
              {
            UpdateResults success = mvTrackInfo.PrimarySource.Provider.UpdateTrack(mvTrackInfo);
            logger.Debug("*** UPDATE: Track='{0}', Provider='{1}', Version={2}, Result={3}", mvTrackInfo.Track, mvTrackInfo.PrimarySource.Provider.Name, mvTrackInfo.PrimarySource.Provider.Version, success.ToString());
            providerCount++;
              }

              foreach (DBSourceInfo currSource in sources)
              {
            if (currSource.IsDisabled(DataType.TRACKDETAIL))
              continue;

            if (currSource == mvTrackInfo.PrimarySource)
              continue;

            providerCount++;

            if (providerCount <= mvCentralCore.Settings.DataProviderRequestLimit || mvCentralCore.Settings.DataProviderRequestLimit == 0)
            {
              UpdateResults success = currSource.Provider.UpdateTrack(mvTrackInfo);
              logger.Debug("*** UPDATE: Track='{0}', Provider='{1}', Version={2}, Result={3}", mvTrackInfo.Track, currSource.Provider.Name, currSource.Provider.Version, success.ToString());
            }
            else
            {
              // stop update
              break;
            }

            if (mvCentralCore.Settings.UseTranslator)
            {
              mvTrackInfo.Translate();
            }
              }
        }