private void Insert(string tableName, IEnumerable <FiveMinutes> fiveMinutes) { foreach (var minute in fiveMinutes) { var sqlCommand = new SqlCreator().Create(tableName, minute); this.dbConnection.RunSqlCommand(sqlCommand, this.settingsProvider.GetDbConnectionString()); } }
public void UpdateDatabankOfLastFourDays(string tableName, string filePrefix) { var fileNames = this .azureStorage .GetAllFiles("mesiraziun", filePrefix) .LastFour(); var date = Time.CreateDateTimeFromFileName(fileNames.First()); var sqlCommand = new SqlCreator().CreteDeleteFrom(tableName, date); this.dbConnection.RunSqlCommand(sqlCommand, this.settingsProvider.GetDbConnectionString()); this.DoUpdate(fileNames, tableName); }
public void UpdateYear(string tableName, string filePrefix) { var fileName = this .azureStorage .GetAllFiles("mesiraziun", filePrefix) .Single(); var deleteSqlCommand = new SqlCreator().CreateDelete(tableName); this.dbConnection.RunSqlCommand(deleteSqlCommand, this.settingsProvider.GetDbConnectionString()); var text = this.azureStorage.GetCsvAsString(fileName); var entries = this.dataTableCreator.CreateYearsEntry(text); foreach (var year in entries) { Console.WriteLine("Start insert month info {0}", year.Datum); var sqlCommand = new SqlCreator().Create(tableName, year); this.dbConnection.RunSqlCommand(sqlCommand, this.settingsProvider.GetDbConnectionString()); Console.WriteLine("Finish insert day info month {0}", year.Datum); } }