예제 #1
0
        static async Task Main(string[] args)
        {
            try
            {
                if (args.Length <= 0)
                {
                    throw new ArgumentNullException("Give the path to Hyperspin.' RetroDbImporter C:\\Hyperspin'");
                }

                if (args.Length <= 1)
                {
                    throw new ArgumentNullException("Give the path to Rocketlauncher.' RetroDbImporter C:\\Hyperspin I:\\Rocketlauncher'");
                }

                IBulkImport bulkImport = new BulkImport(@"Data Source=RetroDb.db", "hyperspin", args[0], args[1]);

                bulkImport.ImportProgressChanged += BulkImport_ImportProgressChanged;;

                await bulkImport.ImportAsync();
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.Message);
            }
            finally
            {
                System.Console.Read();
            }
        }
예제 #2
0
        public async Task DoBulkHyperspinImport()
        {
            IBulkImport bulkImport = new BulkImport(Constants.CONN_STRING, "hyperspin", @"I:\Hyperspin", @"I:\Rocketlauncher");

            Assert.True(bulkImport?.FrontEnd?.FePath == @"I:\Hyperspin");

            bulkImport.ImportProgressChanged += BulkImport_ImportProgressChanged;;
            await bulkImport.ImportAsync();
        }
예제 #3
0
        public int ProcessCommit(string batchId, TenantViewModel tenant)
        {
            int        bulkImportId = int.Parse(batchId);
            BulkImport bulkImport   = BulkImportRepository.Single(x => x.BulkImportId == bulkImportId);

            ConvertedAssetsDto convertedAssets = BuildAssetsClearLookups(bulkImport.ImportText, tenant.TenantId);

            CommitImport(convertedAssets.Assets);
            return(convertedAssets.Assets.Count());
        }
예제 #4
0
        public BulkUploadViewModel PrepareImport(HttpPostedFileBase importedCsv)
        {
            BulkImport bulkImportResponse = new BulkImport();
            string     csvRaw             = ConvertCsvFileToString(importedCsv);

            BatchId = BackupImport(csvRaw);
            BulkUploadViewModel assetsToCommit = BuildAssetsForDisplay(csvRaw, 0);

            return(assetsToCommit);
        }
예제 #5
0
        public BulkUploadViewModel PrepareImport(int batchId)
        {
            BulkImport bulkImport = BulkImportRepository.Single(x => x.BulkImportId == batchId);

            if (bulkImport != null)
            {
                BulkUploadViewModel assetsToCommit = BuildAssetsForDisplay(bulkImport.ImportText, 0);
                return(assetsToCommit);
            }
            return(new BulkUploadViewModel());
        }
예제 #6
0
        public string BackupImport(string importCsvAsString)
        {
            BulkImport bulkImport = new BulkImport
            {
                ImportText = importCsvAsString,
                TenantId   = 3
            };

            BulkImportRepository.Create(bulkImport);
            BulkImportRepository.Save();
            return(bulkImport.BulkImportId.ToString());
        }
예제 #7
0
        public static async Task <bool> Import([ActivityTrigger] int batch, ILogger log)
        {
            log.LogInformation($"Prepare documents for batch {batch}");
            string partitionKey = Environment.GetEnvironmentVariable("PartitionKey");
            int    docsPerBatch;

            int.TryParse(Environment.GetEnvironmentVariable("DocsPerBatch"), out docsPerBatch);
            List <string> documentsToImportInBatch = CosmosHelper.DocumentBatch(partitionKey, docsPerBatch, batch);
            await BulkImport.BulkImportDocuments(documentsToImportInBatch);

            return(true);
        }
        public BulkImportDocument ToContaract(BulkImport bulkImport)
        {
            if (bulkImport == null)
            {
                throw new ArgumentNullException(nameof(bulkImport));
            }

            return(new BulkImportDocument
            {
                Id = 12345,
                UploadedAt = bulkImport.EntryDate
            });
        }
예제 #9
0
        public void ImportWithExcelControlFile()
        {
            var                fn         = Path.GetTempFileName();
            SQLiteServer       svr        = new SQLiteServer(fn);
            TimeSeriesDatabase db         = new TimeSeriesDatabase(svr);
            var                xlsControl = Path.Combine(TestData.DataPath, "bulk-import-template.xlsx");

            BulkImport.Import(db, xlsControl);

            var cs = db.Factory.GetCalculationSeries(TimeInterval.Daily, "tablename='daily_ger_fb'");

            Assert.AreEqual("khydromet", cs[0].Properties.Get("program"));
            Assert.AreEqual("DailyMidnight(instant_%site%_fb)", cs[0].Expression);

            Console.WriteLine(fn);
        }
예제 #10
0
        protected override void ProcessBlock(NBitcoin.Indexer.BlockInfo block, BulkImport <Notify> bulk)
        {
            var notif = new NewBlockNotificationData()
            {
                Header  = block.Block.Header,
                BlockId = block.BlockId,
                Height  = block.Height
            };

            foreach (var newBlock in _Subscriptions.GetNewBlocks())
            {
                bulk.Add("o", new Notify(new Notification()
                {
                    Subscription = newBlock,
                    Data         = notif
                }));
            }
        }
예제 #11
0
 /// <summary>
 /// Ask user to select template for importing multiple series.
 /// then import all series defined in the first sheet of the workbook.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void importUsingTemplateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         DB.SuspendTreeUpdates();
         if (openExcelDialog.ShowDialog() == DialogResult.OK)
         {
             BulkImport.Import(DB, openExcelDialog.FileName);
             DatabaseChanged();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         DB.ResumeTreeUpdates();
     }
 }
        private void AddImportIntelliFlo(ISession session)
        {
            const string importId = "3EB27ADC-9404-4451-BD70-F3E091F36339";

            var import = new BulkImport
            {
                Id              = 1234,
                EntryDate       = new DateTime(2002, 01, 01, 0, 0, 0, DateTimeKind.Utc),
                LastUpdatedDate = new DateTime(2002, 01, 01, 0, 0, 0, DateTimeKind.Utc),
            };

            var query = session.Query <BulkImport>().Where(x => x.Id == 12345);

            if (query.Any())
            {
                return;
            }

            session.Save(import);
        }