/// <summary> /// Adds an e-mail address when the source text is not null and not the text NULL. /// </summary> private static void TryAddEmailAddress(ImportPerson importPerson, Person person) { if (!string.IsNullOrEmpty(importPerson.Email) && importPerson.Email != "NULL") { person.EmailAddresses.Add(importPerson.Email, ConvertType(importPerson.EmailType)); } }
/// <summary> /// Adds a phone number when the source text is not null and not the text NULL. /// </summary> private static void TryAddPhoneNumber(ImportPerson importPerson, Person person) { if (!string.IsNullOrEmpty(importPerson.PhoneNumber) && importPerson.PhoneNumber != "NULL") { person.PhoneNumbers.Add(importPerson.PhoneNumber, ContactType.Business); } }
/// <summary> /// Draws statistics on the screen. /// </summary> private static void UpdateUI(int success, int failed, long elapsed, double perSecond, ImportPerson importPerson) { Console.SetCursorPosition(0, 0); Console.WriteLine(string.Format("Currently importing: {0} {1}", importPerson.FirstName, importPerson.LastName).PadRight(79)); Console.WriteLine(string.Format("Records per second: {0}", Convert.ToInt32(perSecond)).PadRight(79)); TimeSpan timespan = TimeSpan.FromSeconds(Convert.ToInt32(elapsed / 1000)); Console.WriteLine(string.Format("Running for: {0}", timespan.ToString("c")).PadRight(79)); Console.WriteLine("Successfully imported: {0}", success); Console.WriteLine("Failed to import: {0}", failed); }