void action(string choose) { string surnameIN = ""; string nameIN = ""; string patronymicIN = ""; string phoneIN = ""; string countryIN = ""; string birthIN = ""; string orgIN = ""; string postIN = ""; string otherIN = ""; switch (choose.ToUpper()) { case "ADD": Console.WriteLine("Enter the name of contact"); nameIN = Console.ReadLine(); while (nameIN == null) { Console.WriteLine("Invalid data entered"); nameIN = Console.ReadLine(); } Console.WriteLine("Enter the surname of contact"); surnameIN = Console.ReadLine(); while (surnameIN == null) { Console.WriteLine("Invalid data entered"); surnameIN = Console.ReadLine(); } Console.WriteLine("Enter the patronymic of contact"); patronymicIN = Console.ReadLine(); while (patronymicIN == null) { Console.WriteLine("Invalid data entered"); patronymicIN = Console.ReadLine(); } Console.WriteLine("Enter the phone of contact"); phoneIN = Console.ReadLine(); while (phoneIN == null) { Console.WriteLine("Invalid data entered"); phoneIN = Console.ReadLine(); } Console.WriteLine("Enter the country of contact"); countryIN = Console.ReadLine(); while (countryIN == null) { Console.WriteLine("Invalid data entered"); countryIN = Console.ReadLine(); } Console.WriteLine("Enter the birthday of contact"); birthIN = Console.ReadLine(); while (birthIN == null) { Console.WriteLine("Invalid data entered"); birthIN = Console.ReadLine(); } Console.WriteLine("Enter the organization of contact (if this box is empty, enter '-')"); orgIN = Console.ReadLine(); while (orgIN == null) { Console.WriteLine("Invalid data entered"); orgIN = Console.ReadLine(); } Console.WriteLine("Enter the post in organization of contact (if this box is empty, enter '-')"); postIN = Console.ReadLine(); while (postIN == null) { Console.WriteLine("Invalid data entered"); postIN = Console.ReadLine(); } Console.WriteLine("Enter the other info about contact (if this box is empty, enter '-')"); otherIN = Console.ReadLine(); while (otherIN == null) { Console.WriteLine("Invalid data entered "); otherIN = Console.ReadLine(); } ; Phone.IN(surnameIN, nameIN, patronymicIN, phoneIN, countryIN, birthIN, orgIN, postIN, otherIN); break; case "DELETE": find(choose, surnameIN, nameIN, patronymicIN, countryIN, birthIN); break; case "EDIT": find(choose, surnameIN, nameIN, patronymicIN, countryIN, birthIN); break; case "LIST": if (Phone.empty()) { Console.WriteLine("-----------------\nThe list is empty\n-----------------"); } else { Phone.showAll(delegate(data a) { Console.WriteLine("-----------------\nName --- {0}\nSurname --- {1}\nPhone number --- {2}\n-----------------", a.name, a.surname, a.phone); }); } break; case "CONTACT": data one = find(choose, surnameIN, nameIN, patronymicIN, countryIN, birthIN); if (one != null) { Console.WriteLine("-----------------\nName --- {0}\nSurname --- {1}\nPatronymic --- {2}\nPhone number --- {3}\nCountry --- {4}\nBirthday --- {5}\nOrganization --- {6}\nPost --- {7}\nOther --- {8}\n-----------------", one.name, one.surname, one.patronymic, one.phone, one.country, one.birth, one.org, one.post, one.other); } else { Console.WriteLine("Đ•his user does not exist"); } break; } }
public void IN(string surnameIN, string nameIN, string patronymicIN, string phoneIN, string countryIN, string birthIN, string orgIN, string postIN, string otherIN) { data contact = new data(surnameIN, nameIN, patronymicIN, phoneIN, countryIN, birthIN, orgIN, postIN, otherIN); Contacts.Add(contact); }
public void remove(data a) { Contacts.Remove(a); }