-
Notifications
You must be signed in to change notification settings - Fork 1
Owner Module Documentation.
Overview
The owners.cpp and owners.hpp files form the Pet Management module of the Veterinary Management System (VMS). This module handles all operations related to pet records, including creation, viewing, updating, deletion, search, filtering, and import/export. Files Included
• owners.cpp: Implements the logic for all owner-related operations. • owners.hpp: Declares function prototypes and includes necessary headers.
Goals of Each Step (cpp & hpp)
Basic Structure Setup
Goal: Create a function to display the owner Menu and connect the file with the system. Explanation: This sets up the user interface portion of the owner module. It ensures users can access owner functions from the menu.
Add New Owner
Goal: Allow users to input new owner details and insert them into the database. Explanation: Gathers user input for name, address, phone number umber, Email, etc., and uses VMSDatabase::addRecord() to store it.
View All owners
Goal: Display all owners stored in the database. Explanation: Uses VMSDatabase::printTable() to show the entire owner table. Delete an owner
Goal: Enable the deletion of a pet record by owner ID. Explanation: Prompts user for Pet ID and removes the entry using VMSDatabase::deleteRecord().
Search an owner by ID
Goal: Search for a pet based on Pet ID. Explanation: Iterates over the result of getData("pets") to find and display the correct record. Import/Export CSV
Goal: Allow exporting pet data to a CSV file and importing from a CSV file. Explanation: Uses file streams to write all records to a file or load them into the database.
Header File (owners.hpp)
Function Prototypes
void add_owner(); void view_owner(); void delete_owner(); void save_owners_from_files(); void load_owners_from_files();
Header Structure
• Includes , , , , and your vms_database.hpp. • Uses #pragma once to prevent duplicate inclusions.
Integration with VMS
The pet menu is integrated with main.cpp using a simple switch-based loop that allows the user to access it from the main dashboard. Once selected, display_owner_menu() is launched, which loops until the user exits.
Notes
• All database interaction is handled via the VMSDatabase class. • All user input is validated with basic type checking. • CSV export is written in plain text with , delimiters.
By Luke Pring and Jack Turner for the Software Development 2 module at University of Roehampton, London.