/// <summary> /// Loads teh rejection file /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTryLoadRejectionFile_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(txtRejectionFile.Text)) { txtRejectionFileLoadResults.Text = ""; CsvParser<FlatRejectionRecord> csvParser = new CsvParser<FlatRejectionRecord>(); csvParser.ValidationErrorOccurred += new CsvParser<FlatRejectionRecord>.ValidationErrorOccuredHandler(csvParser_RejectionErrorOccurred); try { txtRejectionFileLoadResults.Text += "Start reading file...\r\n"; _flatRejectionFile = new FlatRejectionFile(csvParser.ReadFromFile(txtRejectionFile.Text, ";", chkHasHeaders.Checked)); txtRejectionFileLoadResults.Text += "\r\nEnd reading file."; txtRejectionFileLoadResults.Text += string.Format("Total {0} of {1} lines imported.", csvParser.ImportedLineCount, csvParser.TotalLineCount); if (_flatRejectionFile.GetInvoiceCount() > 0 || _flatCargoFile.GetInvoiceCount() > 0) this.btnNext.Enabled = true; else this.btnNext.Enabled = false; } catch (IOException ex) { txtRejectionFileLoadResults.AppendText(ex.Message + "\r\n"); } catch (Exception ex) { txtRejectionFileLoadResults.AppendText(ex.Message + "\r\n"); } } }