/// <summary>
        /// Adds the details of persons.
        /// UC7
        /// </summary>
        public void AddDetailsOfPersons(string firstName, string lastName, string address, string city, string state, int zip, double phoneNo, string eMail)
        {
            /// Creates an instance of class Contact Person
            /// For Adding the details in the list addressbooklist
            ContactPerson contactPerson     = new ContactPerson(firstName, lastName, address, city, state, zip, phoneNo, eMail);
            bool          checkForDuplicacy = CheckForDuplicacy(firstName, lastName);

            if (checkForDuplicacy == true)
            {
                addressBookList.Add(contactPerson);
                Console.WriteLine("detail succesfully added");
                //ReadingContactsFromCsvFile(addressBookList);
                //WritingContactsFromCsvFile(addressBookList);

                ///Adding details into dictionaryByState with state as key
                if (Program.dictionaryByState.ContainsKey(contactPerson.state))
                {
                    Program.dictionaryByState[contactPerson.state].Add(contactPerson);
                }
                else
                {
                    List <ContactPerson> list = new List <ContactPerson>();
                    list.Add(contactPerson);
                    Program.dictionaryByState.Add(contactPerson.state, list);
                }

                ///Adding details into dictionaryByCity with city as key
                if (Program.dictionaryByCity.ContainsKey(contactPerson.city))
                {
                    Program.dictionaryByCity[contactPerson.city].Add(contactPerson);
                }
                else
                {
                    List <ContactPerson> list = new List <ContactPerson>();
                    list.Add(contactPerson);
                    Program.dictionaryByCity.Add(contactPerson.city, list);
                }
            }
        }
Exemplo n.º 2
0
        public void AddDetailsOfPersons(string firstName, string lastName, string address, string city, string state, int zip, double phoneNo, string eMail)
        {
            ContactPerson contactPerson = new ContactPerson(firstName, lastName, address, city, state, zip, phoneNo, eMail);

            addressBookList.Add(contactPerson);
        }