Ejemplo n.º 1
0
        public void Import()
        {
            Logger.LogInformation("Starting import");
            var stopwatch = Stopwatch.StartNew();

            // Get Import Source
            var source = ImportRepository.GetSource(rootsmagicSourceId);

            // Get Source Type
            //var sourceType = ImportRep.GetSourceType(source.SourceTypeId);

            // Create log
            var logId = ImportRepository.AddLog(new ImportLog
            {
                SourceId = source.Id,
                Imported = DateTime.UtcNow,
                Status   = 0,
            });

            SaveData(logId, RootsMagic.GetChildren());
            SaveData(logId, RootsMagic.GetCitations());
            SaveData(logId, RootsMagic.GetEvents());
            SaveData(logId, RootsMagic.GetFactTypes());
            SaveData(logId, RootsMagic.GetFamilies());
            SaveData(logId, RootsMagic.GetMediaLinks());
            SaveData(logId, RootsMagic.GetMultimedia());
            SaveData(logId, RootsMagic.GetNames());
            SaveData(logId, RootsMagic.GetPersons());
            SaveData(logId, RootsMagic.GetPlaces());
            SaveData(logId, RootsMagic.GetRoles());
            SaveData(logId, RootsMagic.GetSources());
            SaveData(logId, RootsMagic.GetSourceTemplates());
            SaveData(logId, RootsMagic.GetUrls());
            SaveData(logId, RootsMagic.GetWitnesses());

            stopwatch.Stop();
            Logger.LogInformation("Elapsed time: {0}", stopwatch.Elapsed.ToString(@"mm\:ss\.fff"));
        }