Example #1
0
        /// UC 3: Adds the new contact into DB table.
        public static void AddNewContactDetails()
        {
            AddressBookRepository repository = new AddressBookRepository();
            AddressBookModel      model      = new AddressBookModel();

            model.FirstName       = "Neha";
            model.LastName        = "Singh";
            model.Address         = "MANSAROVAR";
            model.City            = "jaipur";
            model.State           = "Rajasthan";
            model.Zip             = 788776;
            model.PhoneNumber     = 887788779;
            model.EmailId         = "*****@*****.**";
            model.AddressBookName = "neha";
            model.AddressBookType = "Friend";
            Console.WriteLine(repository.AddDataToTable(model) ? "Record inserted successfully\n" : "Failed");
        }
Example #2
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();
        }