The Contact Management System is a C# application that provides a basic framework for managing contact and country information. It utilizes ADO.NET to interact with a SQL Server database, allowing for CRUD (Create, Read, Update, Delete) operations on contact and country records.
DataAccessLayer/
clsServerInfo.cs
: Contains the server connection string.stContact.cs
: Defines thestContact
structure representing a contact.stCountry.cs
: Defines thestCountry
structure representing a country.clsContactDB.cs
: Provides methods for CRUD operations on contact records.clsCountryDB.cs
: Provides methods for CRUD operations on country records.clsDataAccessLayer.cs
: An empty class placeholder for future data access methods.
To use this project, you need to set up a SQL Server database and configure the connection string.
- .NET Framework (version compatible with your development environment)
- SQL Server (or another compatible database server)
- Clone the Repository
git clone https://github.com/EngenMe/contact-management-system.git
cd contact-management-system
- Configure the Connection String
Open the clsServerInfo.cs
file and update the ConnectionString
to match your SQL Server configuration:
public static string ConnectionString = "Server=.;Database=DB_Contacts;User Id=sa;Password=sa123456;";
Ensure the database named DB_Contacts
exists, or create it with the appropriate schema.
- Build and Run
Open the solution in Visual Studio (or another C# IDE), build the project, and run it. You can now interact with the database through the provided classes.
GetLineRecord(int ContactID)
: Retrieves a contact by its ID.AddRecordToContactDB(stContact NewContact)
: Adds a new contact to the database.UpdateRecordInContactDB(int ContactID, stContact NewContact)
: Updates an existing contact record.DeleteRecordInContactDB(int ContactID)
: Deletes a contact record.GetAllContactIDs()
: Gets a list of all contact IDs.GetAllContactsFromContactsDB()
: Retrieves a DataTable with all contact records.IsContactExist(int ContactID)
: Checks if a contact exists by ID.IsContactExist(stContact Contact)
: Checks if a contact exists based on the provided contact information.
GetLineRecord(int CountryID)
: Retrieves a country by its ID.GetLineRecord(string CountryName)
: Retrieves a country by its name.AddRecordToCountryDB(stCountry NewCountry)
: Adds a new country to the database.UpdateRecordInCountryDB(int CountryID, stCountry NewCountry)
: Updates an existing country record.DeleteRecordInCountryDB(int CountryID)
: Deletes a country record.GetAllCountryIDs()
: Gets a list of all country IDs.GetAllCountryNames()
: Retrieves a list of all country names.GetAllCountriesFromCountriesDB()
: Retrieves a DataTable with all country records.IsCountryExist(int CountryID)
: Checks if a country exists by ID.
Feel free to fork the repository and submit pull requests for any improvements or bug fixes.
This project is licensed under the MIT License - see the [LICENSE](LICENSE)
file for details.