private static void Export(string filename, HugoDataSet.ConfirmationCorrectionsDataTable table) { if (System.IO.File.Exists(filename)) { System.IO.File.Delete(filename); } StreamWriter output = new StreamWriter(filename, false, System.Text.Encoding.ASCII); string outputLine; // start clean, in case you call export multiple times _tradersMail.Clear(); try { // Write header row output.WriteLine(s_header); s_reportBody = new StringBuilder(); s_reportBody.AppendLine(s_header); // Write each data row foreach (HugoDataSet.ConfirmationCorrectionsRow row in table) { if (row.TradeMediumName != "Willy-Nilly") { if (String.IsNullOrEmpty(row.OptionSymbol)) { outputLine = BuildStockConfirmationCorrectionLine(row); } else { outputLine = BuildOptionConfirmationCorrectionLine(row); } output.WriteLine(outputLine); s_reportBody.AppendLine(outputLine); // if have to send e-mails to traders if (Properties.Settings.Default.SendReportToTraders && (row.AccountNumber != null)) { SendEmailToTraders(outputLine, row); } } } } catch (Exception) { throw; } finally { output.Close(); } }
/// <summary> /// Creates a report sender which creates the reports which we send to Pax. /// These reports tell Pax which trades we think need to be added or deleted from our accounts. /// </summary> public ReportSender(HugoDataSet.ConfirmationCorrectionsDataTable dataTable) { m_dataTable = dataTable; if (String.IsNullOrEmpty(Properties.Settings.Default.ReportsDirectory)) { m_reportsDir = Directory.GetCurrentDirectory(); } else { m_reportsDir = Properties.Settings.Default.ReportsDirectory; } }