コード例 #1
0
        /// <summary>
        /// Counts the person details from city and state dictionary
        /// </summary>
        static void CountForPersonFromCityOrState()
        {
            AddressBook addressBook = new AddressBook();

            addressBook.GetCount();
        }
コード例 #2
0
        /// <summary>
        /// Displays person's name from city or state
        /// </summary>
        static void GetDetailsUsingCityOrState()
        {
            AddressBook addressBook = new AddressBook();

            addressBook.GetPersonFromCityOrState();
        }
コード例 #3
0
        /// <summary>
        /// Displays the contacts from city and state list.
        /// </summary>
        static void DisplayContactsFromCityAndStateList()
        {
            AddressBook addressBook = new AddressBook();

            addressBook.DisplayCityAndStateDictionary();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Address Book Program!");
            bool flag = true;

            while (flag)
            {
                Console.WriteLine("1: Add New Address Book \n2: Add Contacts \n3: Edit Contacts \n4: Delete Contacts \n5: Display Contacts \n6: Search contact using city or state name \n7: Display city and state list \n8: Count person from city or state \n9: Write to .txt file \n10: Write to .csv file \n11: Write to .json file");
                string      options     = Console.ReadLine();
                AddressBook addressBook = new AddressBook();
                /// <summary>
                /// To select from different options available
                /// </summary>
                switch (options)
                {
                case "1":
                    AddAdressBook();
                    break;

                case "2":
                    AddContactToAddressBook();
                    break;

                case "3":
                    EditContactInAdressBook();
                    break;

                case "4":
                    DeleteContactFromAddressBook();
                    break;

                case "5":
                    DisplayContactsFromAddressBook();
                    break;

                case "6":
                    GetDetailsUsingCityOrState();
                    break;

                case "7":
                    DisplayContactsFromCityAndStateList();
                    break;

                case "8":
                    CountForPersonFromCityOrState();
                    break;

                case "9":
                    addressBook.WriteFileIO();
                    break;

                case "10":
                    addressBook.WriteInCSVFormat();
                    break;

                case "11":
                    addressBook.WriteInJsonFormat();
                    break;

                default:
                    flag = false;
                    break;
                }
            }
        }