public string import(StreamReader file) { List <string> failedLines = new List <string>(); string line = ""; while ((line = file.ReadLine()) != null && line != "") { Registrant newReg = new Registrant(); if (newReg.import(line)) { if (newReg.hasData()) { addRegistrant(newReg); } } else { failedLines.Add(line); } } if (failedLines.Count > 0) { string msg = ""; failedLines.ForEach(l => msg += l + "\n"); MessageBox.Show("Registrant import failure", msg, MessageBoxButtons.OK); } return(line); }
private void addRegistrantToolStripMenuItem_Click(object sender, EventArgs e) { Registrant reg = new Registrant(); RegistrantEditor regEditor = new RegistrantEditor(ref reg); regEditor.ShowDialog(); if (regEditor.DialogResult == DialogResult.OK && reg.hasData()) { DataManager.RegistrantManager.addRegistrant(reg); groupRegistrants.refreshRegistrants(DataManager.CurrentDivision); } }