Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to AddressBook System program using ADO.NET");
            ///Creating Instance object of AddressBookRepository class.
            AddressBookRepository repository = new AddressBookRepository();

            ///UC1 Creating a method for checking for the validity of the connection.
            repository.EnsureDataBaseConnection();
            /// UC2 Getting all the stored records in the address book service table by fetching all the records
            repository.GetAllContact();
            /// UC 3: Adds the new contact into DB table.
            AddNewContactDetails();
            /// UC 4 Ability to Edit the contactType of the existing contact.
            Console.WriteLine(repository.EditContactUsingName("Neha", "Singh", "Friend") ? "Update done successfully\n" : "Update failed");
            /// UC5 Ability to  Deletes the contact with given first name and last name.
            Console.WriteLine(repository.DeleteContact("Neha", "Singh") ? "Deleted Contact successfully\n" : "Update failed");
            /// UC6 Retrieves the contacts from a given state or city.
            repository.RetrieveContactFromCityOrStateName();
            ///  UC7 Gets the count of people in a state or city.
            GetCountByCityOrState();
        }