private async Task UpdateRunDateAsync()
        {
            await appRepository.DeleteOneAsync <RunDateSaveDB>(r => r.Symbol.Equals(SecAnalKey));

            var currentRunDateSave = new RunDateSave
            {
                ProcessName = SecAnalKey,
                LastRunTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds()
            };
            var currentRunDateSaveDb = mapper.Map <RunDateSaveDB>(currentRunDateSave);

            currentRunDateSaveDb = (RunDateSaveDB)DBValuesSetup.SetAppDocValues(currentRunDateSaveDb);
            await appRepository.AddOneAsync <RunDateSaveDB>(currentRunDateSaveDb);

            await DBValuesSetup.CreateIndex <RunDateSaveDB>(appRepository);
        }
Exemplo n.º 2
0
        private async Task SaveCurrentRunDate()
        {
            try
            {
                await appRepository.DeleteOneAsync <RunDateSaveDB>(r => r.Symbol.Equals(PricingDataKey));

                var currentRunDateSave = new RunDateSave
                {
                    ProcessName = PricingDataKey,
                    LastRunTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds()
                };
                var currentRunDateSaveDb = mapper.Map <RunDateSaveDB>(currentRunDateSave);
                currentRunDateSaveDb = (RunDateSaveDB)DBValuesSetup.SetAppDocValues(currentRunDateSaveDb);
                await appRepository.AddOneAsync <RunDateSaveDB>(currentRunDateSaveDb);

                await DBValuesSetup.CreateIndex <RunDateSaveDB>(appRepository);
            }
            catch (Exception ex)
            {
                logger.LogError($"Error while updating Run Date for {PricingDataKey}");
                logger.LogError($"Error details \n\t{ex.Message}");
            }
        }