private static void LoadTransactionData() { CsvContext cc = new CsvContext(); IEnumerable <Transaction> dataRows_namesUs = null; CsvFileDescription fileDescription_namesUs = new CsvFileDescription { SeparatorChar = '~', // default is ',' FirstLineHasColumnNames = false, EnforceCsvColumnAttribute = true, // default is false FileCultureName = "en-US", // default is the current culture, MaximumNbrExceptions = 10 }; string sourcePath = ConfigurationSettings.AppSettings["ReportDownloadLocation"]; string fileName = ""; int rownumber; if (System.IO.Directory.Exists(sourcePath)) { string[] files = System.IO.Directory.GetFiles(sourcePath); // Copy the files and overwrite destination files if they already exist. foreach (string s in files) { // Use static Path methods to extract only the file name from the path. fileName = s; dataRows_namesUs = cc.Read <Transaction>(fileName, fileDescription_namesUs); rownumber = 1; foreach (Transaction row in dataRows_namesUs) { try { if (rownumber > 2) { STG_CybersourceTransaction t = new STG_CybersourceTransaction() { FileName = System.IO.Path.GetFileName(fileName), Row_descriptor = row.TransactionRow ?? "" }; tdc.STG_CybersourceTransactions.InsertOnSubmit(t); tdc.SubmitChanges(); } rownumber++; } catch (Exception e) { Utils.OutputException(e); } } File.Delete(s); } } }
private static void LoadTransactionData() { CsvContext cc = new CsvContext(); IEnumerable<Transaction> dataRows_namesUs = null; CsvFileDescription fileDescription_namesUs = new CsvFileDescription { SeparatorChar = '~', // default is ',' FirstLineHasColumnNames = false, EnforceCsvColumnAttribute = true, // default is false FileCultureName = "en-US", // default is the current culture, MaximumNbrExceptions =10 }; string sourcePath = ConfigurationSettings.AppSettings["ReportDownloadLocation"]; string fileName = ""; int rownumber; if (System.IO.Directory.Exists(sourcePath)) { string[] files = System.IO.Directory.GetFiles(sourcePath); // Copy the files and overwrite destination files if they already exist. foreach (string s in files) { // Use static Path methods to extract only the file name from the path. fileName = s; dataRows_namesUs = cc.Read<Transaction>(fileName, fileDescription_namesUs); rownumber = 1; foreach (Transaction row in dataRows_namesUs) { try { if (rownumber > 2) { STG_CybersourceTransaction t = new STG_CybersourceTransaction() { FileName = System.IO.Path.GetFileName(fileName), Row_descriptor = row.TransactionRow ?? "" }; tdc.STG_CybersourceTransactions.InsertOnSubmit(t); tdc.SubmitChanges(); } rownumber++; } catch (Exception e) { Utils.OutputException(e); } } File.Delete(s); } } }
partial void DeleteSTG_CybersourceTransaction(STG_CybersourceTransaction instance);
partial void InsertSTG_CybersourceTransaction(STG_CybersourceTransaction instance);