From a7ad188801fc0988b0f7a3c040f5c34c06a85ab7 Mon Sep 17 00:00:00 2001 From: Joel Thomas <1914@trenser.com> Date: Tue, 19 May 2026 09:56:36 +0530 Subject: [PATCH] Setup codebase --- .gitignore | 431 ++++++++++++++++++ .../Trenser.VehicleServiceSystem.sln | 31 ++ .../Trenser.VehicleServiceSystem.cpp | 7 + .../Trenser.VehicleServiceSystem.vcxproj | 189 ++++++++ ...enser.VehicleServiceSystem.vcxproj.filters | 237 ++++++++++ .../controllers/Controller.cpp | 1 + .../controllers/Controller.h | 51 +++ .../core/patterns/Observer.cpp | 0 .../core/patterns/Observer.h | 10 + .../core/patterns/Subject.cpp | 0 .../core/patterns/Subject.h | 17 + .../datastores/DataStore.cpp | 47 ++ .../datastores/DataStore.h | 41 ++ .../factories/Factory.h | 29 ++ .../models/ComboPackage.cpp | 53 +++ .../models/ComboPackage.h | 26 ++ .../models/InventoryItem.cpp | 54 +++ .../models/InventoryItem.h | 23 + .../models/Invoice.cpp | 159 +++++++ .../models/Invoice.h | 66 +++ .../models/JobCard.cpp | 131 ++++++ .../models/JobCard.h | 58 +++ .../models/Notification.cpp | 75 +++ .../models/Notification.h | 32 ++ .../models/Service.cpp | 53 +++ .../models/Service.h | 26 ++ .../models/ServiceBooking.cpp | 146 ++++++ .../models/ServiceBooking.h | 62 +++ .../models/User.cpp | 106 +++++ .../models/User.h | 41 ++ .../AuthenticationManagementService.cpp | 3 + .../AuthenticationManagementService.h | 18 + .../services/InventoryManagementService.cpp | 1 + .../services/InventoryManagementService.h | 21 + .../NotificationManagementService.cpp | 1 + .../services/NotificationManagementService.h | 12 + .../services/PaymentManagementService.cpp | 1 + .../services/PaymentManagementService.h | 22 + .../services/ServiceManagementService.cpp | 1 + .../services/ServiceManagementService.h | 34 ++ .../services/UserManagementService.cpp | 1 + .../services/UserManagementService.h | 24 + .../utilities/Enums.h | 138 ++++++ .../utilities/InputHelper.h | 58 +++ .../utilities/Map.h | 283 ++++++++++++ .../utilities/OutputHelper.h | 24 + .../utilities/Timestamp.cpp | 204 +++++++++ .../utilities/Timestamp.h | 34 ++ .../utilities/Validator.cpp | 109 +++++ .../utilities/Validator.h | 18 + .../utilities/Vector.h | 336 ++++++++++++++ .../views/AdminMenu.cpp | 89 ++++ .../views/AdminMenu.h | 25 + .../views/CustomerMenu.cpp | 50 ++ .../views/CustomerMenu.h | 21 + .../views/TechnicianMenu.cpp | 20 + .../views/TechnicianMenu.h | 13 + .../views/UserInterface.cpp | 57 +++ .../views/UserInterface.h | 20 + 59 files changed, 3840 insertions(+) create mode 100644 .gitignore create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.sln create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.vcxproj create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.vcxproj.filters create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Observer.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Observer.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Subject.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Subject.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/datastores/DataStore.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/datastores/DataStore.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/factories/Factory.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ComboPackage.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ComboPackage.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/InventoryItem.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/InventoryItem.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Invoice.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Invoice.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/JobCard.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/JobCard.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Notification.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Notification.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Service.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Service.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/User.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/User.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/NotificationManagementService.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/NotificationManagementService.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/PaymentManagementService.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/PaymentManagementService.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/UserManagementService.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/UserManagementService.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Enums.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/InputHelper.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Map.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/OutputHelper.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Timestamp.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Timestamp.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Validator.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Validator.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Vector.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.h create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/UserInterface.cpp create mode 100644 Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/UserInterface.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fe37065 --- /dev/null +++ b/.gitignore @@ -0,0 +1,431 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates +*.env + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ + +[Dd]ebug/x64/ +[Dd]ebugPublic/x64/ +[Rr]elease/x64/ +[Rr]eleases/x64/ +bin/x64/ +obj/x64/ + +[Dd]ebug/x86/ +[Dd]ebugPublic/x86/ +[Rr]elease/x86/ +[Rr]eleases/x86/ +bin/x86/ +obj/x86/ + +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +[Aa][Rr][Mm]64[Ee][Cc]/ +bld/ +[Oo]bj/ +[Oo]ut/ +[Ll]og/ +[Ll]ogs/ + +# Build results on 'Bin' directories +**/[Bb]in/* +# Uncomment if you have tasks that rely on *.refresh files to move binaries +# (https://github.com/github/gitignore/pull/3736) +#!**/[Bb]in/*.refresh + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* +*.trx + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Approval Tests result files +*.received.* + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.idb +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +# but not Directory.Build.rsp, as it configures directory-level build defaults +!Directory.Build.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +**/.paket/paket.exe +paket-files/ + +# FAKE - F# Make +**/.fake/ + +# CodeRush personal settings +**/.cr/personal + +# Python Tools for Visual Studio (PTVS) +**/__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +#tools/** +#!tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog +MSBuild_Logs/ + +# AWS SAM Build and Temporary Artifacts folder +.aws-sam + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +**/.mfractor/ + +# Local History for Visual Studio +**/.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +**/.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# CSV Files +*.csv diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.sln b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.sln new file mode 100644 index 0000000..aea10d2 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.37111.16 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Trenser.VehicleServiceSystem", "Trenser.VehicleServiceSystem\Trenser.VehicleServiceSystem.vcxproj", "{39066B41-9568-48D7-BC70-E5EE9C486859}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {39066B41-9568-48D7-BC70-E5EE9C486859}.Debug|x64.ActiveCfg = Debug|x64 + {39066B41-9568-48D7-BC70-E5EE9C486859}.Debug|x64.Build.0 = Debug|x64 + {39066B41-9568-48D7-BC70-E5EE9C486859}.Debug|x86.ActiveCfg = Debug|Win32 + {39066B41-9568-48D7-BC70-E5EE9C486859}.Debug|x86.Build.0 = Debug|Win32 + {39066B41-9568-48D7-BC70-E5EE9C486859}.Release|x64.ActiveCfg = Release|x64 + {39066B41-9568-48D7-BC70-E5EE9C486859}.Release|x64.Build.0 = Release|x64 + {39066B41-9568-48D7-BC70-E5EE9C486859}.Release|x86.ActiveCfg = Release|Win32 + {39066B41-9568-48D7-BC70-E5EE9C486859}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5B3BC42E-4DF6-437B-8271-9EFE2EC0644A} + EndGlobalSection +EndGlobal diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.cpp new file mode 100644 index 0000000..eff3229 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.cpp @@ -0,0 +1,7 @@ +#include "UserInterface.h" + +int main() +{ + UserInterface userInterface; + userInterface.run(); +} diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.vcxproj b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.vcxproj new file mode 100644 index 0000000..a65c46d --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.vcxproj @@ -0,0 +1,189 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {39066b41-9568-48d7-bc70-e5ee9c486859} + TrenserVehicleServiceSystem + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(ProjectDir)models;$(ProjectDir)controllers;$(ProjectDir)factories;$(ProjectDir)views;$(ProjectDir)services;$(ProjectDir)utilities;$(ProjectDir)core\patterns;$(ProjectDir)datastores;%(AdditionalIncludeDirectories) + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(ProjectDir)models;$(ProjectDir)controllers;$(ProjectDir)factories;$(ProjectDir)views;$(ProjectDir)services;$(ProjectDir)utilities;$(ProjectDir)core\patterns;$(ProjectDir)datastores;%(AdditionalIncludeDirectories) + + + Console + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.vcxproj.filters b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.vcxproj.filters new file mode 100644 index 0000000..77d0509 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem.vcxproj.filters @@ -0,0 +1,237 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {fc4022ec-cad1-4c5b-b5e3-87bdf86cdee3} + + + {8c0e50bf-dbb3-4956-954a-e9bc7108a8f5} + + + {6fc56811-874c-4c53-a31c-09c5da36f98a} + + + {dade4e36-41ab-463b-a4f2-346219bf4bc8} + + + {994018a4-a8e6-4dcd-9b5b-161fe467ea1a} + + + {bf335df2-eccb-452b-99a0-be92078a30c8} + + + {d668bff5-2da8-4200-aa0e-bd9db89c0ecf} + + + {ad539cf4-b697-49b9-a999-4729618139d1} + + + {94a14e13-7aaa-4f08-bcb2-618873e5198e} + + + {defecdb5-b5c7-488d-a9d4-553755129f9c} + + + {b5d0f583-e687-416b-8c80-cd0d0037bc94} + + + {a2807ab4-4d53-4e18-b4cd-13d0d552b057} + + + {05ab7ce1-f55a-4c76-96ed-f855a79921b9} + + + {423a60cb-8b4e-41f5-9c05-80cc9a91dfba} + + + {49f35205-bfa9-4f04-a9b3-9b74d33640d6} + + + {1b53d284-7064-416f-9293-2bc17fa44b0c} + + + {8057b93d-51a9-42df-b06e-01ce395f6308} + + + + + Source Files + + + Source Files\Utilities + + + Source Files\Utilities + + + Source Files\Controllers + + + Source Files\Views + + + Source Files\Views + + + Source Files\Views + + + Source Files\Views + + + Source Files\Services + + + Source Files\Services + + + Source Files\Services + + + Source Files\Services + + + Source Files\Services + + + Source Files\DataStores + + + Source Files\Services + + + Source Files\Core\Patterns + + + Source Files\Core\Patterns + + + Source Files\Models + + + Source Files\Models + + + Source Files\Models + + + Source Files\Models + + + Source Files\Models + + + Source Files\Models + + + Source Files\Models + + + Source Files\Models + + + + + Header Files\Utilities + + + Header Files\Utilities + + + Header Files\Utilities + + + Header Files\Utilities + + + Header Files\Utilities + + + Header Files\Utilities + + + Header Files\Factories + + + Header Files\Controllers + + + Header Files\Views + + + Header Files\Views + + + Header Files\Views + + + Header Files\Views + + + Header Files\Services + + + Header Files\Services + + + Header Files\Services + + + Header Files\Services + + + Header Files\Services + + + Header Files\DataStores + + + Header Files\Services + + + Header Files\Core\Patterns + + + Header Files\Core\Patterns + + + Header Files\Models + + + Header Files\Models + + + Header Files\Utilities + + + Header Files\Models + + + Header Files\Models + + + Header Files\Models + + + Header Files\Models + + + Header Files\Models + + + Header Files\Models + + + \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.cpp new file mode 100644 index 0000000..31f0129 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.cpp @@ -0,0 +1 @@ +#include "Controller.h" diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.h new file mode 100644 index 0000000..638b751 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.h @@ -0,0 +1,51 @@ +#pragma once +#include "Map.h" +#include +#include "Enums.h" + +class Service; +class ComboPackage; +class InventoryItem; +class ServiceBooking; +class User; +class JobCard; +class Invoice; +class Notification; + +class Controller +{ +public: + bool login(const std::string& username, const std::string& password); + void logout(); + void changePassword(const std::string& newPassword); + void createCustomer(const std::string& username, const std::string& password, const std::string& email, const std::string& phone); + User* const getAuthenticatedUser(); + void createTechnician(const std::string& username, const std::string& password, const std::string& email, const std::string& phone); + void updateUserDetails(const std::string& email, const std::string& phone); + util::Map getServices(); + util::Map getComboPackages(); + void purchaseService(const util::Vector& serviceIDs, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel); + void purchaseComboPackage(const std::string& comboPackageID, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel); + util::Map getInventoryItems(); + InventoryItem* getInventoryItem(const std::string& inventoryItemID); + void addInventoryItem(const std::string& partName, int quantity, double price); + void removeInventoryItem(const std::string& inventoryItemID); + util::Map getServiceBookings(); + util::Map getServiceBookingsByUser(); + util::Map getUsers(); + util::Map getUsers(util::UserType type); + void createJobCard(const std::string& bookingID, const std::string& technicianID, const std::string& serviceID); + void createService(const std::string& name, const util::Vector& inventoryItemIDs, double laborCost); + void removeService(const std::string& serviceID); + util::Map getJobCardsByUser(); + void completeJob(const std::string& jobID); + void removeUser(const std::string& userID); + void createComboPackage(const std::string& name, const util::Vector& serviceIDs, double discountPercentage); + void removeComboPackage(const std::string& comboPackageID); + util::Map getInvoicesByUser(); + void completePayment(const std::string& invoiceID, util::PaymentMode paymentMode); + util::Vector getNotifications(); + void deleteNotification(const std::string& notificationID); + void configureNotifications(const std::string& userID, bool paymentNotifications, bool serviceNotifications); + void runSystemChecks(); +}; \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Observer.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Observer.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Observer.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Observer.h new file mode 100644 index 0000000..98f0efa --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Observer.h @@ -0,0 +1,10 @@ +#pragma once + +class Notification; + +class Observer +{ +public: + virtual ~Observer() = default; + virtual void update(Notification* notification) = 0; +}; \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Subject.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Subject.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Subject.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Subject.h new file mode 100644 index 0000000..add51b7 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/core/patterns/Subject.h @@ -0,0 +1,17 @@ +#pragma once +#include +#include "Map.h" + +class User; +class Notification; + +class Subject +{ +protected: + util::Map m_observers; +public: + virtual ~Subject() = default; + virtual void attach(User* user) = 0; + virtual void detach(User* user) = 0; + virtual void notify(Notification* notification) = 0; +}; \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/datastores/DataStore.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/datastores/DataStore.cpp new file mode 100644 index 0000000..dd0e016 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/datastores/DataStore.cpp @@ -0,0 +1,47 @@ +#include "DataStore.h" + +DataStore& DataStore::getInstance() +{ + static DataStore dataStore; + return dataStore; +} + +util::Map& DataStore::getUsers() +{ + return m_users; +} + +util::Map& DataStore::getServices() +{ + return m_services; +} + +util::Map& DataStore::getComboPackages() +{ + return m_comboPackages; +} + +util::Map& DataStore::getServiceBookings() +{ + return m_serviceBookings; +} + +util::Map& DataStore::getJobCards() +{ + return m_jobCards; +} + +util::Map& DataStore::getInventoryItems() +{ + return m_inventoryItems; +} + +util::Map& DataStore::getInvoices() +{ + return m_invoices; +} + +util::Map& DataStore::getPayments() +{ + return m_payments; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/datastores/DataStore.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/datastores/DataStore.h new file mode 100644 index 0000000..924e8e4 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/datastores/DataStore.h @@ -0,0 +1,41 @@ +#pragma once + +#include +#include "Map.h" + +class User; +class Service; +class ComboPackage; +class ServiceBooking; +class JobCard; +class InventoryItem; +class Invoice; +class Payment; + +class DataStore +{ +private: + util::Map m_users; + util::Map m_services; + util::Map m_comboPackages; + util::Map m_serviceBookings; + util::Map m_jobCards; + util::Map m_inventoryItems; + util::Map m_invoices; + util::Map m_payments; + DataStore() {} +public: + static DataStore& getInstance(); + DataStore(const DataStore&) = delete; + DataStore& operator=(const DataStore&) = delete; + DataStore(DataStore&&) = delete; + DataStore& operator=(DataStore&&) = delete; + util::Map& getUsers(); + util::Map& getServices(); + util::Map& getComboPackages(); + util::Map& getServiceBookings(); + util::Map& getJobCards(); + util::Map& getInventoryItems(); + util::Map& getInvoices(); + util::Map& getPayments(); +}; \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/factories/Factory.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/factories/Factory.h new file mode 100644 index 0000000..1b4ae62 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/factories/Factory.h @@ -0,0 +1,29 @@ +/* + * File: Factory.h + * Description: Provides a generic factory utility to create objects dynamically. + * Author: Trenser + * Created: 18-May-2026 + */ + +#pragma once +#include + +class Factory +{ +public: + + /* + * Function: getObject + * Description: Creates and returns a dynamically allocated object of type T. + * Parameters: + * T - the type of object to be created + * Args - constructor arguments forwarded to T's constructor + * Returns: + * T* - pointer to the newly created object + */ + template + static T* getObject(Args&&... args) + { + return new T(std::forward(args)...); + } +}; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ComboPackage.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ComboPackage.cpp new file mode 100644 index 0000000..300ebfc --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ComboPackage.cpp @@ -0,0 +1,53 @@ +#include "ComboPackage.h" + +int ComboPackage::m_uid = 0; + +ComboPackage::ComboPackage() + : m_id("CMP" + std::to_string(++m_uid)), + m_discountPercentage(0.0) {} + +ComboPackage::ComboPackage(const std::string& packageName, double discountPercentage, const util::Map& services) + : m_id("CMP" + std::to_string(++m_uid)), + m_packageName(packageName), + m_discountPercentage(discountPercentage), + m_services(services) {} + +const std::string& ComboPackage::getId() const +{ + return m_id; +} + +const std::string& ComboPackage::getPackageName() const +{ + return m_packageName; +} + +double ComboPackage::getDiscountPercentage() const +{ + return m_discountPercentage; +} + +const util::Map& ComboPackage::getServices() const +{ + return m_services; +} + +void ComboPackage::setId(const std::string& id) +{ + m_id = id; +} + +void ComboPackage::setPackageName(const std::string& packageName) +{ + m_packageName = packageName; +} + +void ComboPackage::setDiscountPercentage(double discountPercentage) +{ + m_discountPercentage = discountPercentage; +} + +void ComboPackage::setServices(const util::Map& services) +{ + m_services = services; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ComboPackage.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ComboPackage.h new file mode 100644 index 0000000..38a04a1 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ComboPackage.h @@ -0,0 +1,26 @@ +#pragma once +#include +#include "Map.h" + +class Service; + +class ComboPackage +{ +private: + static int m_uid; + std::string m_id; + std::string m_packageName; + double m_discountPercentage; + util::Map m_services; +public: + ComboPackage(); + ComboPackage(const std::string& packageName, double discountPercentage, const util::Map& services); + const std::string& getId() const; + const std::string& getPackageName() const; + double getDiscountPercentage() const; + const util::Map& getServices() const; + void setId(const std::string& id); + void setPackageName(const std::string& packageName); + void setDiscountPercentage(double discountPercentage); + void setServices(const util::Map& services); +}; \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/InventoryItem.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/InventoryItem.cpp new file mode 100644 index 0000000..8a0f367 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/InventoryItem.cpp @@ -0,0 +1,54 @@ +#include "InventoryItem.h" + +int InventoryItem::m_uid = 0; + +InventoryItem::InventoryItem() + : m_id("IIM" + std::to_string(++m_uid)), + m_quantity(0), + m_price(0.0) {} + +InventoryItem::InventoryItem(const std::string& partName, int quantity, double price) + : m_id("IIM" + std::to_string(++m_uid)), + m_partName(partName), + m_quantity(quantity), + m_price(price) {} + +const std::string& InventoryItem::getId() const +{ + return m_id; +} + +const std::string& InventoryItem::getPartName() const +{ + return m_partName; +} + +int InventoryItem::getQuantity() const +{ + return m_quantity; +} + +double InventoryItem::getPrice() const +{ + return m_price; +} + +void InventoryItem::setId(const std::string& id) +{ + m_id = id; +} + +void InventoryItem::setPartName(const std::string& partName) +{ + m_partName = partName; +} + +void InventoryItem::setQuantity(int quantity) +{ + m_quantity = quantity; +} + +void InventoryItem::setPrice(double price) +{ + m_price = price; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/InventoryItem.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/InventoryItem.h new file mode 100644 index 0000000..9c23e04 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/InventoryItem.h @@ -0,0 +1,23 @@ +#pragma once +#include + +class InventoryItem +{ +private: + static int m_uid; + std::string m_id; + std::string m_partName; + int m_quantity; + double m_price; +public: + InventoryItem(); + InventoryItem(const std::string& partName, int quantity, double price); + const std::string& getId() const; + const std::string& getPartName() const; + int getQuantity() const; + double getPrice() const; + void setId(const std::string& id); + void setPartName(const std::string& partName); + void setQuantity(int quantity); + void setPrice(double price); +}; \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Invoice.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Invoice.cpp new file mode 100644 index 0000000..ba7bc84 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Invoice.cpp @@ -0,0 +1,159 @@ +#include "Invoice.h" + +int Invoice::m_uid = 0; + +Invoice::Invoice() + : m_id("INV" + std::to_string(++m_uid)), + m_booking(nullptr), + m_laborCost(0.0), + m_partsCost(0.0), + m_discountPercentage(0.0), + m_totalAmount(0.0), + m_paymentMethod(util::PaymentMode()), + m_status(util::PaymentStatus()) {} + +Invoice::Invoice( + const std::string& bookingId, + ServiceBooking* booking, + const util::Timestamp& invoiceDate, + double laborCost, const util::Map& parts, + double partsCost, + double discountPercentage, + double totalAmount, + const util::Timestamp& paymentDate, + util::PaymentMode paymentMethod, + util::PaymentStatus status + ) + : m_id("INV" + std::to_string(++m_uid)), + m_bookingId(bookingId), + m_booking(booking), + m_invoiceDate(invoiceDate), + m_laborCost(laborCost), + m_parts(parts), + m_partsCost(partsCost), + m_discountPercentage(discountPercentage), + m_totalAmount(totalAmount), + m_paymentDate(paymentDate), + m_paymentMethod(paymentMethod), + m_status(status) {} + +const std::string& Invoice::getId() const +{ + return m_id; +} + +const std::string& Invoice::getBookingId() const +{ + return m_bookingId; +} + +ServiceBooking* Invoice::getBooking() const +{ + return m_booking; +} + +const util::Timestamp& Invoice::getInvoiceDate() const +{ + return m_invoiceDate; +} + +double Invoice::getLaborCost() const +{ + return m_laborCost; +} + +const util::Map& Invoice::getParts() const +{ + return m_parts; +} + +double Invoice::getPartsCost() const +{ + return m_partsCost; +} + +double Invoice::getDiscountPercentage() const +{ + return m_discountPercentage; +} + +double Invoice::getTotalAmount() const +{ + return m_totalAmount; +} + +const util::Timestamp& Invoice::getPaymentDate() const +{ + return m_paymentDate; +} + +util::PaymentMode Invoice::getPaymentMethod() const +{ + return m_paymentMethod; +} + +util::PaymentStatus Invoice::getStatus() const +{ + return m_status; +} + +void Invoice::setId(const std::string& id) +{ + m_id = id; +} + +void Invoice::setBookingId(const std::string& bookingId) +{ + m_bookingId = bookingId; +} + +void Invoice::setBooking(ServiceBooking* booking) +{ + m_booking = booking; +} + +void Invoice::setInvoiceDate(const util::Timestamp& invoiceDate) +{ + m_invoiceDate = invoiceDate; +} + +void Invoice::setLaborCost(double laborCost) +{ + m_laborCost = laborCost; +} + +void Invoice::setParts(const util::Map& parts) +{ + m_parts = parts; +} + +void Invoice::setPartsCost(double partsCost) +{ + m_partsCost = partsCost; +} + +void Invoice::setDiscountPercentage(double discountPercentage) +{ + m_discountPercentage = discountPercentage; +} + +void Invoice::setTotalAmount(double totalAmount) +{ + m_totalAmount = totalAmount; +} + +void Invoice::setPaymentDate(const util::Timestamp& paymentDate) +{ + m_paymentDate = paymentDate; +} + +void Invoice::setPaymentMethod(util::PaymentMode paymentMethod) +{ + m_paymentMethod = paymentMethod; +} + +void Invoice::setStatus(util::PaymentStatus status) +{ + m_status = status; +} diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Invoice.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Invoice.h new file mode 100644 index 0000000..212d33f --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Invoice.h @@ -0,0 +1,66 @@ +#pragma once +#include +#include "Map.h" +#include "Timestamp.h" +#include "Enums.h" + +class ServiceBooking; +class InventoryItem; + +class Invoice +{ +private: + static int m_uid; + std::string m_id; + std::string m_bookingId; + ServiceBooking* m_booking; + util::Timestamp m_invoiceDate; + double m_laborCost; + util::Map m_parts; + double m_partsCost; + double m_discountPercentage; + double m_totalAmount; + util::Timestamp m_paymentDate; + util::PaymentMode m_paymentMethod; + util::PaymentStatus m_status; + +public: + Invoice(); + Invoice( + const std::string& bookingId, + ServiceBooking* booking, + const util::Timestamp& invoiceDate, + double laborCost, const util::Map& parts, + double partsCost, + double discountPercentage, + double totalAmount, + const util::Timestamp& paymentDate, + util::PaymentMode paymentMethod, + util::PaymentStatus status + ); + const std::string& getId() const; + const std::string& getBookingId() const; + ServiceBooking* getBooking() const; + const util::Timestamp& getInvoiceDate() const; + double getLaborCost() const; + const util::Map& getParts() const; + double getPartsCost() const; + double getDiscountPercentage() const; + double getTotalAmount() const; + const util::Timestamp& getPaymentDate() const; + util::PaymentMode getPaymentMethod() const; + util::PaymentStatus getStatus() const; + void setId(const std::string& id); + void setBookingId(const std::string& bookingId); + void setBooking(ServiceBooking* booking); + void setInvoiceDate(const util::Timestamp& invoiceDate); + void setLaborCost(double laborCost); + void setParts(const util::Map& parts); + void setPartsCost(double partsCost); + void setDiscountPercentage(double discountPercentage); + void setTotalAmount(double totalAmount); + void setPaymentDate(const util::Timestamp& paymentDate); + void setPaymentMethod(util::PaymentMode paymentMethod); + void setStatus(util::PaymentStatus status); +}; \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/JobCard.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/JobCard.cpp new file mode 100644 index 0000000..04e9195 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/JobCard.cpp @@ -0,0 +1,131 @@ +#include "JobCard.h" + +int JobCard::m_uid = 0; + +JobCard::JobCard() + : m_id("JC" + std::to_string(++m_uid)), + m_booking(nullptr), + m_service(nullptr), + m_technician(nullptr), + m_status(ServiceJobStatus()) {} + +JobCard::JobCard(const std::string& bookingId, + ServiceBooking* booking, + Service* service, + const std::string& serviceId, + const std::string& technicianId, + User* technician, + const util::Timestamp& assignedDate, + ServiceJobStatus status, + const util::Timestamp& completionDate +) + : m_id("JC" + std::to_string(++m_uid)), + m_bookingId(bookingId), + m_booking(booking), + m_service(service), + m_serviceId(serviceId), + m_technicianId(technicianId), + m_technician(technician), + m_assignedDate(assignedDate), + m_status(status), + m_completionDate(completionDate) {} + +const std::string& JobCard::getId() const +{ + return m_id; +} + +const std::string& JobCard::getBookingId() const +{ + return m_bookingId; +} + +ServiceBooking* JobCard::getBooking() const +{ + return m_booking; +} + +Service* JobCard::getService() const +{ + return m_service; +} + +const std::string& JobCard::getServiceId() const +{ + return m_serviceId; +} + +const std::string& JobCard::getTechnicianId() const +{ + return m_technicianId; +} + +User* JobCard::getTechnician() const +{ + return m_technician; +} + +const util::Timestamp& JobCard::getAssignedDate() const +{ + return m_assignedDate; +} + +ServiceJobStatus JobCard::getStatus() const +{ + return m_status; +} + +const util::Timestamp& JobCard::getCompletionDate() const +{ + return m_completionDate; +} + +void JobCard::setId(const std::string& id) +{ + m_id = id; +} + +void JobCard::setBookingId(const std::string& bookingId) +{ + m_bookingId = bookingId; +} + +void JobCard::setBooking(ServiceBooking* booking) +{ + m_booking = booking; +} + +void JobCard::setService(Service* service) +{ + m_service = service; +} + +void JobCard::setServiceId(const std::string& serviceId) +{ + m_serviceId = serviceId; +} + +void JobCard::setTechnicianId(const std::string& technicianId) +{ + m_technicianId = technicianId; +} + +void JobCard::setTechnician(User* technician) +{ + m_technician = technician; +} + +void JobCard::setAssignedDate(const util::Timestamp& assignedDate) +{ + m_assignedDate = assignedDate; +} + +void JobCard::setStatus(ServiceJobStatus status) +{ + m_status = status; +} + +void JobCard::setCompletionDate(const util::Timestamp& completionDate) +{ + m_completionDate = completionDate; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/JobCard.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/JobCard.h new file mode 100644 index 0000000..15a8a5d --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/JobCard.h @@ -0,0 +1,58 @@ +#pragma once +#include +#include "Timestamp.h" + +class ServiceBooking; +class Service; +class User; + +enum class ServiceJobStatus : int; + +class JobCard +{ +private: + static int m_uid; + std::string m_id; + std::string m_bookingId; + ServiceBooking* m_booking; + Service* m_service; + std::string m_serviceId; + std::string m_technicianId; + User* m_technician; + util::Timestamp m_assignedDate; + ServiceJobStatus m_status; + util::Timestamp m_completionDate; + +public: + JobCard(); + JobCard(const std::string& bookingId, + ServiceBooking* booking, + Service* service, + const std::string& serviceId, + const std::string& technicianId, + User* technician, + const util::Timestamp& assignedDate, + ServiceJobStatus status, + const util::Timestamp& completionDate + ); + const std::string& getId() const; + const std::string& getBookingId() const; + ServiceBooking* getBooking() const; + Service* getService() const; + const std::string& getServiceId() const; + const std::string& getTechnicianId() const; + User* getTechnician() const; + const util::Timestamp& getAssignedDate() const; + ServiceJobStatus getStatus() const; + const util::Timestamp& getCompletionDate() const; + void setId(const std::string& id); + void setBookingId(const std::string& bookingId); + void setBooking(ServiceBooking* booking); + void setService(Service* service); + void setServiceId(const std::string& serviceId); + void setTechnicianId(const std::string& technicianId); + void setTechnician(User* technician); + void setAssignedDate(const util::Timestamp& assignedDate); + void setStatus(ServiceJobStatus status); + void setCompletionDate(const util::Timestamp& completionDate); +}; \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Notification.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Notification.cpp new file mode 100644 index 0000000..dc3ed1d --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Notification.cpp @@ -0,0 +1,75 @@ +#include "Notification.h" + +int Notification::m_uid = 0; + +Notification::Notification() + : m_id("NOT" + std::to_string(++m_uid)), + m_recipient(nullptr) {} + +Notification::Notification(const std::string& recipientUserId, User* recipient, const std::string& title, const std::string& message, const util::Timestamp& createdAt) + : m_id("NOT" + std::to_string(++m_uid)), + m_recipientUserId(recipientUserId), + m_recipient(recipient), + m_title(title), + m_message(message), + m_createdAt(createdAt) {} + +const std::string& Notification::getId() const +{ + return m_id; +} + +const std::string& Notification::getRecipientUserId() const +{ + return m_recipientUserId; +} + +User* Notification::getRecipient() const +{ + return m_recipient; +} + +const std::string& Notification::getTitle() const +{ + return m_title; +} + +const std::string& Notification::getMessage() const +{ + return m_message; +} + +const util::Timestamp& Notification::getCreatedAt() const +{ + return m_createdAt; +} + +void Notification::setId(const std::string& id) +{ + m_id = id; +} + +void Notification::setRecipientUserId(const std::string& recipientUserId) +{ + m_recipientUserId = recipientUserId; +} + +void Notification::setRecipient(User* recipient) +{ + m_recipient = recipient; +} + +void Notification::setTitle(const std::string& title) +{ + m_title = title; +} + +void Notification::setMessage(const std::string& message) +{ + m_message = message; +} + +void Notification::setCreatedAt(const util::Timestamp& createdAt) +{ + m_createdAt = createdAt; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Notification.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Notification.h new file mode 100644 index 0000000..f86499e --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Notification.h @@ -0,0 +1,32 @@ +#pragma once +#include +#include "Timestamp.h" + +class User; + +class Notification +{ +private: + static int m_uid; + std::string m_id; + std::string m_recipientUserId; + User* m_recipient; + std::string m_title; + std::string m_message; + util::Timestamp m_createdAt; +public: + Notification(); + Notification(const std::string& recipientUserId, User* recipient, const std::string& title, const std::string& message, const util::Timestamp& createdAt); + const std::string& getId() const; + const std::string& getRecipientUserId() const; + User* getRecipient() const; + const std::string& getTitle() const; + const std::string& getMessage() const; + const util::Timestamp& getCreatedAt() const; + void setId(const std::string& id); + void setRecipientUserId(const std::string& recipientUserId); + void setRecipient(User* recipient); + void setTitle(const std::string& title); + void setMessage(const std::string& message); + void setCreatedAt(const util::Timestamp& createdAt); +}; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Service.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Service.cpp new file mode 100644 index 0000000..c49b2e4 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Service.cpp @@ -0,0 +1,53 @@ +#include "Service.h" + +int Service::m_uid = 0; + +Service::Service() + : m_id("SRV" + std::to_string(++m_uid)), + m_laborCost(0.0) {} + +Service::Service(const std::string& name, const util::Map& requiredInventoryItems, double laborCost) + : m_id("SRV" + std::to_string(++m_uid)), + m_name(name), + m_requiredInventoryItems(requiredInventoryItems), + m_laborCost(laborCost) {} + +const std::string& Service::getId() const +{ + return m_id; +} + +const std::string& Service::getName() const +{ + return m_name; +} + +const util::Map& Service::getRequiredInventoryItems() const +{ + return m_requiredInventoryItems; +} + +double Service::getLaborCost() const +{ + return m_laborCost; +} + +void Service::setId(const std::string& id) +{ + m_id = id; +} + +void Service::setName(const std::string& name) +{ + m_name = name; +} + +void Service::setRequiredInventoryItems(const util::Map& requiredInventoryItems) +{ + m_requiredInventoryItems = requiredInventoryItems; +} + +void Service::setLaborCost(double laborCost) +{ + m_laborCost = laborCost; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Service.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Service.h new file mode 100644 index 0000000..1b3fbf0 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/Service.h @@ -0,0 +1,26 @@ +#pragma once +#include +#include "Map.h" + +class InventoryItem; + +class Service +{ +private: + static int m_uid; + std::string m_id; + std::string m_name; + util::Map m_requiredInventoryItems; + double m_laborCost; +public: + Service(); + Service(const std::string& name, const util::Map& requiredInventoryItems, double laborCost); + const std::string& getId() const; + const std::string& getName() const; + const util::Map& getRequiredInventoryItems() const; + double getLaborCost() const; + void setId(const std::string& id); + void setName(const std::string& name); + void setRequiredInventoryItems(const util::Map& requiredInventoryItems); + void setLaborCost(double laborCost); +}; \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.cpp new file mode 100644 index 0000000..1fdfaf0 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.cpp @@ -0,0 +1,146 @@ +#include "ServiceBooking.h" + +int ServiceBooking::m_uid = 0; + +ServiceBooking::ServiceBooking() + : m_id("SRV" + std::to_string(++m_uid)), + m_customer(nullptr), + m_discountPercentage(0.0) {} + +ServiceBooking::ServiceBooking( + const std::string& id, + util::ServiceJobStatus status, + const util::Map& services, + const std::string& customerId, + User* customer, + const std::string& vehicleNumber, + const std::string& vehicleBrand, + const std::string& vehicleModel, + const std::string& assignedTechnicianId, + const std::string& assignedTechnician, + double discountPercentage +) + : m_id("SRV" + std::to_string(++m_uid)), + m_status(status), + m_services(services), + m_customerId(customerId), + m_customer(customer), + m_vehicleNumber(vehicleNumber), + m_vehicleBrand(vehicleBrand), + m_vehicleModel(vehicleModel), + m_assignedTechnicianId(assignedTechnicianId), + m_assignedTechnician(assignedTechnician), + m_discountPercentage(discountPercentage) +{ +} + +const std::string& ServiceBooking::getId() const +{ + return m_id; +} + +util::ServiceJobStatus ServiceBooking::getStatus() const +{ + return m_status; +} + +const util::Map& ServiceBooking::getServices() const +{ + return m_services; +} + +const std::string& ServiceBooking::getCustomerId() const +{ + return m_customerId; +} + +User* ServiceBooking::getCustomer() const +{ + return m_customer; +} + +const std::string& ServiceBooking::getVehicleNumber() const +{ + return m_vehicleNumber; +} + +const std::string& ServiceBooking::getVehicleBrand() const +{ + return m_vehicleBrand; +} + +const std::string& ServiceBooking::getVehicleModel() const +{ + return m_vehicleModel; +} + +const std::string& ServiceBooking::getAssignedTechnicianId() const +{ + return m_assignedTechnicianId; +} + +const std::string& ServiceBooking::getAssignedTechnician() const +{ + return m_assignedTechnician; +} + +double ServiceBooking::getDiscountPercentage() const +{ + return m_discountPercentage; +} + +void ServiceBooking::setId(const std::string& id) +{ + m_id = id; +} + +void ServiceBooking::setStatus(const util::ServiceJobStatus& status) +{ + m_status = status; +} + +void ServiceBooking::setServices(const util::Map& services) +{ + m_services = services; +} + +void ServiceBooking::setCustomerId(const std::string& customerId) +{ + m_customerId = customerId; +} + +void ServiceBooking::setCustomer(User* customer) +{ + m_customer = customer; +} + +void ServiceBooking::setVehicleNumber(const std::string& vehicleNumber) +{ + m_vehicleNumber = vehicleNumber; +} + +void ServiceBooking::setVehicleBrand(const std::string& vehicleBrand) +{ + m_vehicleBrand = vehicleBrand; +} + +void ServiceBooking::setVehicleModel(const std::string& vehicleModel) +{ + m_vehicleModel = vehicleModel; +} + +void ServiceBooking::setAssignedTechnicianId(const std::string& assignedTechnicianId) +{ + m_assignedTechnicianId = assignedTechnicianId; +} + +void ServiceBooking::setAssignedTechnician(const std::string& assignedTechnician) +{ + m_assignedTechnician = assignedTechnician; +} + +void ServiceBooking::setDiscountPercentage(double discountPercentage) +{ + m_discountPercentage = discountPercentage; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.h new file mode 100644 index 0000000..5ecc1b0 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.h @@ -0,0 +1,62 @@ +#pragma once +#include +#include "Map.h" +#include "Enums.h" + +class Service; +class User; + +class ServiceBooking +{ +private: + static int m_uid; + std::string m_id; + util::ServiceJobStatus m_status; + util::Map m_services; + std::string m_customerId; + User* m_customer; + std::string m_vehicleNumber; + std::string m_vehicleBrand; + std::string m_vehicleModel; + std::string m_assignedTechnicianId; + std::string m_assignedTechnician; + double m_discountPercentage; +public: + ServiceBooking(); + ServiceBooking( + const std::string& id, + util::ServiceJobStatus status, + const util::Map& services, + const std::string& customerId, + User* customer, + const std::string& vehicleNumber, + const std::string& vehicleBrand, + const std::string& vehicleModel, + const std::string& assignedTechnicianId, + const std::string& assignedTechnician, + double discountPercentage + ); + const std::string& getId() const; + util::ServiceJobStatus getStatus() const; + const util::Map& getServices() const; + const std::string& getCustomerId() const; + User* getCustomer() const; + const std::string& getVehicleNumber() const; + const std::string& getVehicleBrand() const; + const std::string& getVehicleModel() const; + const std::string& getAssignedTechnicianId() const; + const std::string& getAssignedTechnician() const; + double getDiscountPercentage() const; + void setId(const std::string& id); + void setStatus(const util::ServiceJobStatus& status); + void setServices(const util::Map& services); + void setCustomerId(const std::string& customerId); + void setCustomer(User* customer); + void setVehicleNumber(const std::string& vehicleNumber); + void setVehicleBrand(const std::string& vehicleBrand); + void setVehicleModel(const std::string& vehicleModel); + void setAssignedTechnicianId(const std::string& assignedTechnicianId); + void setAssignedTechnician(const std::string& assignedTechnician); + void setDiscountPercentage(double discountPercentage); +}; \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/User.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/User.cpp new file mode 100644 index 0000000..4ac1ce6 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/User.cpp @@ -0,0 +1,106 @@ +#include "User.h" +#include "Notification.h" +#include "Enums.h" + +int User::m_uid = 0; + +User::User() + : m_id("USR" + std::to_string(++m_uid)), + m_type(util::UserType()) {} + +User::User(const std::string& userName, const std::string& password, const std::string& name, const std::string& phone, const std::string& email, util::UserType role) + : m_id("USR" + std::to_string(++m_uid)), + m_userName(userName), + m_password(password), + m_name(name), + m_phone(phone), + m_email(email), + m_type(role) {} + +User::~User() +{ + for (int index = 0; index < m_notifications.getSize(); index++) + { + delete m_notifications.getValues()[index]; + } +} + +const std::string& User::getId() const +{ + return m_id; +} + +const std::string& User::getUserName() const +{ + return m_userName; +} + +const std::string& User::getPassword() const +{ + return m_password; +} + +const std::string& User::getName() const +{ + return m_name; +} + +const std::string& User::getPhone() const +{ + return m_phone; +} + +const std::string& User::getEmail() const +{ + return m_email; +} + +util::Map& User::getNotifications() +{ + return m_notifications; +} + +util::UserType User::getUserType() const +{ + return m_type; +} + +void User::setId(const std::string& id) +{ + m_id = id; +} + +void User::setUserName(const std::string& userName) +{ + m_userName = userName; +} + +void User::setPassword(const std::string& password) +{ + m_password = password; +} + +void User::setName(const std::string& name) +{ + m_name = name; +} + +void User::setPhone(const std::string& phone) +{ + m_phone = phone; +} + +void User::setEmail(const std::string& email) +{ + m_email = email; +} + +void User::addNotification(Notification* notification) +{ + m_notifications.insert(notification->getId(), notification); +} + +void User::setRole(util::UserType role) +{ + m_type = role; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/User.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/User.h new file mode 100644 index 0000000..9bc848c --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/User.h @@ -0,0 +1,41 @@ +#pragma once +#include +#include "Map.h" +#include "Observer.h" +#include "Enums.h" + +class Notification; + +class User : public Observer +{ +private: + static int m_uid; + std::string m_id; + std::string m_userName; + std::string m_password; + std::string m_name; + std::string m_phone; + std::string m_email; + util::Map m_notifications; + util::UserType m_type; +public: + User(); + User(const std::string& userName, const std::string& password, const std::string& name, const std::string& phone, const std::string& email, util::UserType role); + ~User(); + const std::string& getId() const; + const std::string& getUserName() const; + const std::string& getPassword() const; + const std::string& getName() const; + const std::string& getPhone() const; + const std::string& getEmail() const; + util::Map& getNotifications(); + util::UserType getUserType() const; + void setId(const std::string& id); + void setUserName(const std::string& userName); + void setPassword(const std::string& password); + void setName(const std::string& name); + void setPhone(const std::string& phone); + void setEmail(const std::string& email); + void addNotification(Notification* notification); + void setRole(util::UserType role); +}; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.cpp new file mode 100644 index 0000000..ca07fee --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.cpp @@ -0,0 +1,3 @@ +#include "AuthenticationManagementService.h" + +User* AuthenticationManagementService::m_authenticatedUser = nullptr; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.h new file mode 100644 index 0000000..ee0ed91 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.h @@ -0,0 +1,18 @@ +#pragma once +#include +#include "DataStore.h" + +class User; + +class AuthenticationManagementService +{ +private: + static User* m_authenticatedUser; + DataStore& m_dataStore; +public: + AuthenticationManagementService() : m_dataStore(DataStore::getInstance()) {} + bool login(const std::string& username, const std::string& password); + void logout(); + void changePassword(const std::string& newPassword); + User* getAuthenticatedUser(); +}; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.cpp new file mode 100644 index 0000000..39ef719 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.cpp @@ -0,0 +1 @@ +#include "InventoryManagementService.h" diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.h new file mode 100644 index 0000000..9008824 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.h @@ -0,0 +1,21 @@ +#pragma once +#include +#include "Map.h" +#include "NotificationManagementService.h" +#include "DataStore.h" + +class InventoryItem; + +class InventoryManagementService : public NotificationManagementService +{ +private: + DataStore& m_dataStore; +public: + InventoryManagementService() : m_dataStore(DataStore::getInstance()) {} + util::Map getInventoryItems(); + InventoryItem* getInventoryItem(const std::string& inventoryItemID); + void addInventoryItem(const std::string& partName, int quantity, double price); + void removeInventoryItem(const std::string& inventoryItemID); + void sendLowStockAlerts(); + void sendNotification(User* user, const std::string& title, const std::string& message); +}; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/NotificationManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/NotificationManagementService.cpp new file mode 100644 index 0000000..cc23059 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/NotificationManagementService.cpp @@ -0,0 +1 @@ +#include "NotificationManagementService.h" diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/NotificationManagementService.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/NotificationManagementService.h new file mode 100644 index 0000000..401f2a8 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/NotificationManagementService.h @@ -0,0 +1,12 @@ +#pragma once +#include +#include "Subject.h" +#include "User.h" + +class NotificationManagementService : public Subject +{ +public: + virtual void sendNotification(User* recipient, const std::string& title, const std::string& message) = 0; + virtual void attach(User* user) = 0; + virtual void detach(User* user) = 0; +}; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/PaymentManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/PaymentManagementService.cpp new file mode 100644 index 0000000..786ebcf --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/PaymentManagementService.cpp @@ -0,0 +1 @@ +#include "PaymentManagementService.h" diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/PaymentManagementService.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/PaymentManagementService.h new file mode 100644 index 0000000..1b0d89a --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/PaymentManagementService.h @@ -0,0 +1,22 @@ +#pragma once +#include +#include "Map.h" +#include "NotificationManagementService.h" +#include "Enums.h" +#include "DataStore.h" + +class ServiceBooking; +class Invoice; + +class PaymentManagementService : public NotificationManagementService +{ +private: + DataStore& m_dataStore; +public: + PaymentManagementService() : m_dataStore(DataStore::getInstance()) {} + void generateInvoice(ServiceBooking* booking); + util::Map getInvoices(const std::string& customerID); + void completePayment(const std::string& invoiceID, util::PaymentMode paymentMode); + void sendPaymentReminders(); + void sendNotification(User* user, const std::string& title, const std::string& message); +}; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp new file mode 100644 index 0000000..156c12b --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp @@ -0,0 +1 @@ +#include "ServiceManagementService.h" diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.h new file mode 100644 index 0000000..dcef432 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.h @@ -0,0 +1,34 @@ +#pragma once +#include +#include "Map.h" +#include "NotificationManagementService.h" +#include "DataStore.h" + +class Service; +class ComboPackage; +class ServiceBooking; +class JobCard; + +class ServiceManagementService : public NotificationManagementService +{ +private: + DataStore& m_dataStore; +public: + ServiceManagementService() : m_dataStore(DataStore::getInstance()) {} + util::Map getServices(); + util::Map getComboPackages(); + void purchaseService(const util::Vector& serviceIDs, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel); + void purchaseComboPackage(const std::string& comboPackageID, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel); + util::Map getServiceBookings(); + util::Map getServiceBookings(const std::string& customerID); + void createJobCard(const std::string& bookingID, const std::string& technicianID, const std::string& serviceID); + void createService(const std::string& name, const util::Vector& inventoryItemIDs, double laborCost); + void removeService(const std::string& serviceID); + util::Map getJobCards(const std::string& technicianID); + void completeJob(const std::string& jobID); + void cancelCustomerServiceBookings(const std::string& customerID); + void cancelTechnicianJobs(const std::string& technicianID); + void createComboPackage(const std::string& name, const util::Vector& serviceIDs, double discountPercentage); + void removeComboPackage(const std::string& comboPackageID); + void sendNotification(User* user, const std::string& title, const std::string& message); +}; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/UserManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/UserManagementService.cpp new file mode 100644 index 0000000..2a5bd9e --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/UserManagementService.cpp @@ -0,0 +1 @@ +#include "UserManagementService.h" diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/UserManagementService.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/UserManagementService.h new file mode 100644 index 0000000..bb7a85a --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/UserManagementService.h @@ -0,0 +1,24 @@ +#pragma once +#include +#include "Map.h" +#include "Enums.h" +#include "DataStore.h" + +class User; +class Notification; + +class UserManagementService +{ +private: + DataStore& m_dataStore; +public: + UserManagementService() : m_dataStore(DataStore::getInstance()) {} + void createUser(const std::string& username, const std::string& password, const std::string& email, const std::string& phone, util::UserType type); + void updateUserDetails(const std::string& userID, const std::string& email, const std::string& phone); + util::Map getUsers(); + util::Map getUsers(util::UserType type); + User* getUser(const std::string& userID); + void removeUser(const std::string& userID); + util::Vector getUserNotifications(const std::string& userID); + void deleteNotification(const std::string& notificationID, const std::string& userID); +}; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Enums.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Enums.h new file mode 100644 index 0000000..a9eb8e5 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Enums.h @@ -0,0 +1,138 @@ +#pragma once +#include + +namespace util +{ + enum class UserType + { + ADMIN, + TECHNICIAN, + CUSTOMER + }; + + enum class PaymentMode + { + ONLINE, + OFFLINE + }; + + enum class PaymentStatus + { + PENDING, + COMPLETED + }; + + enum class ServiceJobStatus + { + STARTED, + COMPLETED + }; + + inline std::string getUserTypeString(UserType type) + { + switch (type) + { + case UserType::ADMIN: + return "ADMIN"; + case UserType::TECHNICIAN: + return "TECHNICIAN"; + case UserType::CUSTOMER: + return "CUSTOMER"; + } + throw std::invalid_argument("Invalid UserType"); + } + + inline UserType getUserType(const std::string& value) + { + if (value == "ADMIN") + { + return UserType::ADMIN; + } + if (value == "TECHNICIAN") + { + return UserType::TECHNICIAN; + } + if (value == "CUSTOMER") + { + return UserType::CUSTOMER; + } + throw std::invalid_argument("Invalid UserType string"); + } + + inline std::string getPaymentModeString(PaymentMode mode) + { + switch (mode) + { + case PaymentMode::ONLINE: + return "ONLINE"; + case PaymentMode::OFFLINE: + return "OFFLINE"; + } + throw std::invalid_argument("Invalid PaymentMode"); + } + + inline PaymentMode getPaymentMode(const std::string& value) + { + if (value == "ONLINE") + { + return PaymentMode::ONLINE; + } + if (value == "OFFLINE") + { + return PaymentMode::OFFLINE; + } + throw std::invalid_argument("Invalid PaymentMode string"); + } + + inline std::string getPaymentStatusString(PaymentStatus status) + { + switch (status) + { + case PaymentStatus::PENDING: + return "PENDING"; + case PaymentStatus::COMPLETED: + return "COMPLETED"; + } + throw std::invalid_argument("Invalid PaymentStatus"); + } + + inline PaymentStatus getPaymentStatus(const std::string& value) + { + if (value == "PENDING") + { + return PaymentStatus::PENDING; + } + + if (value == "COMPLETED") + { + return PaymentStatus::COMPLETED; + } + + throw std::invalid_argument("Invalid PaymentStatus string"); + } + + inline std::string getServiceJobStatusString(ServiceJobStatus status) + { + switch (status) + { + case ServiceJobStatus::STARTED: + return "STARTED"; + case ServiceJobStatus::COMPLETED: + return "COMPLETED"; + } + throw std::invalid_argument("Invalid ServiceJobStatus"); + } + + inline ServiceJobStatus getServiceJobStatus(const std::string& value) + { + if (value == "STARTED") + { + return ServiceJobStatus::STARTED; + } + if (value == "COMPLETED") + { + return ServiceJobStatus::COMPLETED; + } + throw std::invalid_argument("Invalid ServiceJobStatus string"); + } +} diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/InputHelper.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/InputHelper.h new file mode 100644 index 0000000..d8fee08 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/InputHelper.h @@ -0,0 +1,58 @@ +/* + * File: InputHelper.h + * Description: Handles input validation and error handling + * Author: Trenser + * Created: 18-May-2026 + */ + +#pragma once +#include +#include +#include +#include + +namespace util +{ + /* + * Function: read + * Description: Reads input from console into a variable of type T. + * Parameters: + * value - reference to a variable of type T where the input will be stored + * Returns: + * void - throws runtime_error if input is invalid + */ + template + inline void read(T& value) + { + if (!(std::cin >> value)) + { + std::cin.clear(); + std::cin.ignore(std::numeric_limits::max(), '\n'); + throw std::runtime_error("Invalid console input"); + } + } + + /* + * Function: read + * Description: Reads a line of text input from console into a string. + * Parameters: + * value - reference to a string where the input will be stored + * Returns: + * void - no return value + */ + inline void read(std::string& value) + { + std::getline(std::cin >> std::ws, value); + } + + /* + * Function: pressEnter + * Description: Pauses execution until the user presses Enter. + * Parameters: None + * Returns: void - no return value + */ + inline void pressEnter() + { + system("pause"); + } +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Map.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Map.h new file mode 100644 index 0000000..6a2967f --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Map.h @@ -0,0 +1,283 @@ +/* + * File: Map.h + * Description: Provides a generic key-value map container implementation. + * Author: Trenser + * Created: 18-May-2026 + */ + +#pragma once +#include "Vector.h" + +namespace util +{ + template + class Map + { + private: + class Entry + { + public: + K key; + V value; + Entry() : key(K{}), value(V{}) {} + Entry(const K& key, const V& value) + { + this->key = key; + this->value = value; + } + bool operator==(const Entry& other) const + { + return key == other.key; + } + }; + Vector entries; + public: + /* + * Function: Map + * Description: Default constructor for Map. + * Parameters: None + * Returns: + * Map object + */ + Map() {} + + /* + * Function: insert + * Description: Inserts a key-value pair into the map. + * Updates the value if the key already exists. + * Parameters: + * key - key to insert + * value - value associated with the key + * Returns: + * void - no return value + */ + void insert(const K& key, const V& value) + { + int index = find(key); + if (index != -1) + { + entries[index].value = value; + return; + } + entries.push_back(Entry(key, value)); + } + + /* + * Function: remove + * Description: Removes an entry with the given key from the map. + * Parameters: + * key - key of the entry to remove + * Returns: + * bool - true if the entry was removed, false otherwise + */ + bool remove(const K& key) + { + int index = find(key); + if (index == -1) + { + return false; + } + entries.removeAt(index); + return true; + } + + /* + * Function: containsKey + * Description: Checks whether the map contains a given key. + * Parameters: + * key - key to search for + * Returns: + * bool - true if the key exists, false otherwise + */ + bool containsKey(const K& key) const + { + return find(key) != -1; + } + + /* + * Function: find + * Description: Finds the index of an entry with the given key. + * Parameters: + * key - key to search for + * Returns: + * int - index of the entry if found, otherwise -1 + */ + int find(const K& key) const + { + for (int index = 0; index < entries.getSize(); index++) + { + if (entries[index].key == key) + { + return index; + } + } + return -1; + } + + /* + * Function: findIf + * Description: Finds the index of an entry matching a custom predicate. + * Parameters: + * predicate - callable object used for matching entries + * Returns: + * int - index of the matching entry if found, otherwise -1 + */ + template + int findIf(Predicate predicate) const + { + for (int index = 0; index < entries.getSize(); index++) + { + if (predicate(entries[index].key, entries[index].value)) + { + return index; + } + } + return -1; + } + + /* + * Function: operator[] + * Description: Returns a reference to the value associated with the key. + * Inserts a default value if the key does not exist. + * Parameters: + * key - key associated with the value + * Returns: + * V& - reference to the value associated with the key + */ + V& operator[](const K& key) + { + int index = find(key); + if (index == -1) + { + insert(key, V()); + index = find(key); + } + return entries[index].value; + } + + /* + * Function: operator[] + * Description: Returns a constant reference to the value associated with the key. + * Parameters: + * key - key associated with the value + * Returns: + * const V& - constant reference to the value associated with the key + */ + const V& operator[](const K& key) const + { + int index = find(key); + return entries[index].value; + } + + /* + * Function: getSize + * Description: Returns the number of entries in the map. + * Parameters: None + * Returns: + * int - number of entries in the map + */ + int getSize() const + { + return entries.getSize(); + } + + /* + * Function: isEmpty + * Description: Checks whether the map is empty. + * Parameters: None + * Returns: + * bool - true if the map is empty, false otherwise + */ + bool isEmpty() const + { + return entries.isEmpty(); + } + + /* + * Function: clear + * Description: Removes all entries from the map. + * Parameters: None + * Returns: + * void - no return value + */ + void clear() + { + entries.clear(); + } + + /* + * Function: getKeys + * Description: Returns a vector containing all keys in the map. + * Parameters: None + * Returns: + * Vector - vector containing all keys + */ + Vector getKeys() const + { + Vector keys; + for (int index = 0; index < entries.getSize(); index++) + { + keys.push_back(entries[index].key); + } + return keys; + } + + /* + * Function: getValues + * Description: Returns a vector containing all values in the map. + * Parameters: None + * Returns: + * Vector - vector containing all values + */ + Vector getValues() const + { + Vector values; + + for (int index = 0; index < entries.getSize(); index++) + { + values.push_back(entries[index].value); + } + return values; + } + + /* + * Function: getKeyAt + * Description: Returns the key at the specified internal index. + * Parameters: + * index - internal index of the entry + * Returns: + * const K& - constant reference to the key + */ + const K& getKeyAt(int index) const + { + return entries[index].key; + } + + /* + * Function: getValueAt + * Description: Returns the value at the specified internal index. + * Parameters: + * index - internal index of the entry + * Returns: + * V& - reference to the value + */ + V& getValueAt(int index) + { + return entries[index].value; + } + + /* + * Function: getValueAt + * Description: Returns a constant reference to the value + * at the specified internal index. + * Parameters: + * index - internal index of the entry + * Returns: + * const V& - constant reference to the value + */ + const V& getValueAt(int index) const + { + return entries[index].value; + } + }; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/OutputHelper.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/OutputHelper.h new file mode 100644 index 0000000..12b61a3 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/OutputHelper.h @@ -0,0 +1,24 @@ +/* + * File: OutputHelper.h + * Description: Provides functions to help with console output. + * Author: Trenser + * Created: 18-May-2026 + */ + +#pragma once +#include + +namespace util +{ + /* + * Function: clear + * Description: Clears the console screen output. + * Parameters: None + * Returns: + * void - no return value + */ + inline void clear() + { + std::cout << "\x1B[2J\x1B[H" << std::flush; + } +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Timestamp.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Timestamp.cpp new file mode 100644 index 0000000..b515a20 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Timestamp.cpp @@ -0,0 +1,204 @@ +/* + * File: Timestamp.cpp + * Description: + * Provides a utility class for representing and manipulating time values. + * Supports conversion between string and time formats, duration calculations + * (hours, minutes, seconds), date extraction, and comparison operators. + * + * Author: Trenser + * Created: 18-May-2026 + */ + +#include +#include +#include +#include "Timestamp.h" + + /* + * Function: Timestamp + * Description: + * Default constructor that initializes the timestamp + * to the current system time. + * Parameters: + * None + * Returns: + * Timestamp object + */ +util::Timestamp::Timestamp() +{ + m_time = std::time(nullptr); +} + +/* + * Function: Timestamp (overloaded) + * Description: + * Constructor that initializes the timestamp + * with a given time value. + * Parameters: + * timeValue - time_t value representing a specific time + * Returns: + * Timestamp object + */ +util::Timestamp::Timestamp(std::time_t timeValue) +{ + m_time = timeValue; +} + +/* + * Function: fromString + * Description: + * Creates a Timestamp object from a formatted string. + * Parameters: + * timeString - string in the format "YYYY-MM-DD HH:MM:SS" + * Returns: + * Timestamp object representing the parsed time + */ +util::Timestamp util::Timestamp::fromString(const std::string& timeString) +{ + std::tm timeStruct = {}; + std::istringstream inputStream(timeString); + inputStream >> std::get_time(&timeStruct, "%Y-%m-%d %H:%M:%S"); + if (inputStream.fail()) + { + throw std::runtime_error("Invalid time format"); + } + std::time_t parsedTimestamp = std::mktime(&timeStruct); + return Timestamp(parsedTimestamp); +} + +/* + * Function: toString + * Description: + * Converts the Timestamp object into a formatted string. + * Parameters: + * None + * Returns: + * string - formatted as "YYYY-MM-DD HH:MM:SS" + */ +std::string util::Timestamp::toString() const +{ + std::tm timeStruct = {}; + localtime_s(&timeStruct, &m_time); + std::ostringstream outputStream; + outputStream << std::put_time(&timeStruct, "%Y-%m-%d %H:%M:%S"); + return outputStream.str(); +} + +/* + * Function: getDurationInSeconds + * Description: + * Calculates the duration between two timestamps in seconds. + * Parameters: + * startTimestamp - starting time + * endTimestamp - ending time + * Returns: + * double - duration in seconds + */ +double util::Timestamp::getDurationInSeconds(const Timestamp& startTimestamp, const Timestamp& endTimestamp) +{ + return std::difftime(endTimestamp.m_time, startTimestamp.m_time); +} + +/* + * Function: getDurationInMinutes + * Description: + * Calculates the duration between two timestamps in minutes. + * Parameters: + * startTimestamp - starting time + * endTimestamp - ending time + * Returns: + * double - duration in minutes + */ +double util::Timestamp::getDurationInMinutes(const Timestamp& startTimestamp, const Timestamp& endTimestamp) +{ + return getDurationInSeconds(startTimestamp, endTimestamp) / 60.0; +} + +/* + * Function: getDurationInHours + * Description: + * Calculates the duration between two timestamps in hours. + * Parameters: + * startTimestamp - starting time + * endTimestamp - ending time + * Returns: + * double - duration in hours + */ +double util::Timestamp::getDurationInHours(const Timestamp& startTimestamp, const Timestamp& endTimestamp) +{ + return getDurationInSeconds(startTimestamp, endTimestamp) / 3600.0; +} + +/* + * Function: operator< + * Description: + * Compares two timestamps to check + * if one is earlier than the other. + * Parameters: + * other - Timestamp to compare against + * Returns: + * bool - true if current timestamp is earlier + */ +bool util::Timestamp::operator<(const Timestamp& other) const +{ + return m_time < other.m_time; +} + +/* + * Function: operator> + * Description: + * Compares two timestamps to check + * if one is later than the other. + * Parameters: + * other - Timestamp to compare against + * Returns: + * bool - true if current timestamp is later + */ +bool util::Timestamp::operator>(const Timestamp& other) const +{ + return m_time > other.m_time; +} + +/* + * Function: operator<= + * Description: + * Compares two timestamps to check + * if one is earlier or equal. + * Parameters: + * other - Timestamp to compare against + * Returns: + * bool - true if current timestamp is earlier or equal + */ +bool util::Timestamp::operator<=(const Timestamp& other) const +{ + return m_time <= other.m_time; +} + +/* + * Function: operator>= + * Description: + * Compares two timestamps to check + * if one is later or equal. + * Parameters: + * other - Timestamp to compare against + * Returns: + * bool - true if current timestamp is later or equal + */ +bool util::Timestamp::operator>=(const Timestamp& other) const +{ + return m_time >= other.m_time; +} + +/* + * Function: operator== + * Description: + * Compares two timestamps for equality. + * Parameters: + * other - Timestamp to compare against + * Returns: + * bool - true if both timestamps are equal + */ +bool util::Timestamp::operator==(const Timestamp& other) const +{ + return m_time == other.m_time; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Timestamp.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Timestamp.h new file mode 100644 index 0000000..1fa805a --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Timestamp.h @@ -0,0 +1,34 @@ +/* + * File: Timestamp.h + * Description: Provides a utility class for representing and manipulating time values. + * Supports conversion between string and time formats, duration calculations + * (hours, minutes, seconds), date extraction, and comparison operators. + * Author: Trenser + * Created: 18-May-2026 + */ + +#pragma once +#include +#include + +namespace util +{ + class Timestamp + { + private: + std::time_t m_time; + Timestamp(std::time_t time); + public: + Timestamp(); + static Timestamp fromString(const std::string& timeString); + std::string toString() const; + static double getDurationInHours(const Timestamp&, const Timestamp&); + static double getDurationInMinutes(const Timestamp&, const Timestamp&); + static double getDurationInSeconds(const Timestamp&, const Timestamp&); + bool operator>(const Timestamp&) const; + bool operator<(const Timestamp&) const; + bool operator>=(const Timestamp&) const; + bool operator<=(const Timestamp&) const; + bool operator==(const Timestamp&) const; + }; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Validator.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Validator.cpp new file mode 100644 index 0000000..b2ed37d --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Validator.cpp @@ -0,0 +1,109 @@ +/* + * File: Validator.cpp + * Description: Validates inputs like phone number, email, password + * Author: Trenser + * Created: 18-May-2026 + */ + +#include +#include +#include "Validator.h" + + /* + * Function: isPhoneNumberValid + * Description: Validates whether the given string is a valid phone number. + * Parameters: + * phoneNumber - string containing the phone number to validate + * Returns: + * bool - true if the phone number is valid (10 digits, all numeric), false otherwise + */ +bool util::isPhoneNumberValid(const std::string& phoneNumber) +{ + if (phoneNumber.size() != 10) + { + return false; + } + return std::all_of(phoneNumber.begin(), phoneNumber.end(), + [](char character) + { + return std::isdigit(character); + } + ); +} + +/* + * Function: isEmailValid + * Description: Validates whether the given string is a properly formatted email address. + * Parameters: + * email - string containing the email address to validate + * Returns: + * bool - true if the email contains exactly one '@' character and is not at the start or end, false otherwise + */ +bool util::isEmailValid(const std::string& email) +{ + size_t index = email.find('@'); + if (index == std::string::npos) + { + return false; + } + if (email.find('@', index + 1) != std::string::npos) + { + return false; + } + if (index == 0 || index == email.size() - 1) + { + return false; + } + return true; +} + +/* + * Function: isPasswordValid + * Description: Validates whether the given string meets password requirements. + * Parameters: + * password - string containing the password to validate + * Returns: + * bool - true if the password is valid, false otherwise + * Notes: + * - Must not equal the default password + * - Must be at least 8 characters long + * - Must contain at least one uppercase letter, one lowercase letter, + * one digit, and one special character + * - Must not contain whitespace + */ +bool util::isPasswordValid(const std::string& password) +{ + if (password.length() < 8) + { + return false; + } + bool hasUpper = false; + bool hasLower = false; + bool hasDigit = false; + bool hasSpecial = false; + for (char character : password) + { + if (std::isspace(static_cast(character))) + { + return false; + } + if (std::isupper(static_cast(character))) + { + hasUpper = true; + } + else if (std::islower(static_cast(character))) + { + hasLower = true; + } + else if (std::isdigit(static_cast(character))) + { + hasDigit = true; + } + else + { + hasSpecial = true; + } + } + + return hasUpper && hasLower && hasDigit && hasSpecial; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Validator.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Validator.h new file mode 100644 index 0000000..8602e4e --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Validator.h @@ -0,0 +1,18 @@ +/* + * File: Validator.h + * Description: Validates inputs like phone number, email, password + * Author: Trenser + * Created: 18-May-2026 + */ + +#pragma once +#include +#include +#include + +namespace util +{ + bool isPhoneNumberValid(const std::string&); + bool isEmailValid(const std::string&); + bool isPasswordValid(const std::string&); +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Vector.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Vector.h new file mode 100644 index 0000000..a9e96cc --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/utilities/Vector.h @@ -0,0 +1,336 @@ +/* + * File: Vector.h + * Description: Provides a generic dynamic array container implementation. + * Author: Trenser + * Created: 18-May-2026 + */ + +#pragma once +#include + +namespace util +{ + template + class Vector + { + private: + T* data; + int size; + int capacity; + + /* + * Function: resize + * Description: Resizes the internal storage capacity of the vector. + * Parameters: + * newCapacity - new storage capacity for the vector + * Returns: + * void - no return value + */ + void resize(int newCapacity) + { + T* newData = new T[newCapacity]; + for (int index = 0; index < size; index++) + { + newData[index] = data[index]; + } + delete[] data; + data = newData; + capacity = newCapacity; + } + + public: + /* + * Function: Vector + * Description: Default constructor for Vector. + * Parameters: None + * Returns: + * Vector object + */ + Vector() + { + capacity = 4; + size = 0; + data = new T[capacity]; + } + + /* + * Function: Vector + * Description: Copy constructor for Vector. + * Parameters: + * other - Vector object to copy from + * Returns: + * Vector object + */ + Vector(const Vector& other) + { + size = other.size; + capacity = other.capacity; + data = new T[capacity]; + for (int index = 0; index < size; index++) + { + data[index] = other.data[index]; + } + } + + /* + * Function: Vector + * Description: Move constructor for Vector. + * Parameters: + * other - Vector object to move from + * Returns: + * Vector object + */ + Vector(Vector&& other) + { + data = other.data; + size = other.size; + capacity = other.capacity; + other.data = nullptr; + other.size = 0; + other.capacity = 0; + } + + /* + * Function: operator= + * Description: Copy assignment operator for Vector. + * Parameters: + * other - Vector object to copy from + * Returns: + * Vector& - reference to the current Vector object + */ + Vector& operator=(const Vector& other) + { + if (this == &other) + { + return *this; + } + delete[] data; + size = other.size; + capacity = other.capacity; + data = new T[capacity]; + for (int index = 0; index < size; index++) + { + data[index] = other.data[index]; + } + return *this; + } + + /* + * Function: operator= + * Description: Move assignment operator for Vector. + * Parameters: + * other - Vector object to move from + * Returns: + * Vector& - reference to the current Vector object + */ + Vector& operator=(Vector&& other) + { + if (this == &other) + { + return *this; + } + delete[] data; + data = other.data; + size = other.size; + capacity = other.capacity; + other.data = nullptr; + other.size = 0; + other.capacity = 0; + return *this; + } + + /* + * Function: ~Vector + * Description: Destructor for Vector. + * Parameters: None + * Returns: + * void - no return value + */ + ~Vector() + { + delete[] data; + } + + /* + * Function: push_back + * Description: Appends an element to the end of the vector. + * Parameters: + * value - element to append + * Returns: + * void - no return value + */ + void push_back(const T& value) + { + if (size >= capacity) + { + resize(capacity * 2); + } + data[size++] = value; + } + + /* + * Function: removeAt + * Description: Removes the element at the specified position. + * Parameters: + * position - index of the element to remove + * Returns: + * void - no return value + */ + void removeAt(int position) + { + if (position < 0 || position >= size) + { + return; + } + for (int index = position; index < size - 1; index++) + { + data[index] = data[index + 1]; + } + size--; + } + + /* + * Function: remove + * Description: Removes the first occurrence of the specified value. + * Parameters: + * value - element to remove + * Returns: + * bool - true if the element was removed, false otherwise + */ + bool remove(const T& value) + { + int index = find(value); + if (index == -1) + { + return false; + } + removeAt(index); + return true; + } + + /* + * Function: clear + * Description: Removes all elements from the vector. + * Parameters: None + * Returns: + * void - no return value + */ + void clear() + { + size = 0; + } + + /* + * Function: getSize + * Description: Returns the number of elements in the vector. + * Parameters: None + * Returns: + * int - number of elements in the vector + */ + int getSize() const + { + return size; + } + + /* + * Function: isEmpty + * Description: Checks whether the vector is empty. + * Parameters: None + * Returns: + * bool - true if the vector is empty, false otherwise + */ + bool isEmpty() const + { + return size == 0; + } + + /* + * Function: contains + * Description: Checks whether the vector contains the specified value. + * Parameters: + * value - value to search for + * Returns: + * bool - true if the value exists, false otherwise + */ + bool contains(const T& value) const + { + return find(value) != -1; + } + + /* + * Function: find + * Description: Finds the index of the specified value. + * Parameters: + * value - value to search for + * Returns: + * int - index of the value if found, otherwise -1 + */ + int find(const T& value) const + { + for (int index = 0; index < size; index++) + { + if (data[index] == value) + { + return index; + } + } + return -1; + } + + /* + * Function: findIf + * Description: Finds the index of an element matching a custom predicate. + * Parameters: + * predicate - callable object used for matching elements + * Returns: + * int - index of the matching element if found, otherwise -1 + */ + template + int findIf(Predicate predicate) const + { + for (int index = 0; index < size; index++) + { + if (predicate(data[index])) + { + return index; + } + } + return -1; + } + + /* + * Function: operator[] + * Description: Returns a reference to the element at the specified index. + * Parameters: + * index - index of the element + * Returns: + * T& - reference to the element + */ + T& operator[](int index) + { + if (index < 0 || index >= size) + { + throw std::out_of_range("Index out of range"); + } + return data[index]; + } + + /* + * Function: operator[] + * Description: Returns a constant reference to the element + * at the specified index. + * Parameters: + * index - index of the element + * Returns: + * const T& - constant reference to the element + */ + const T& operator[](int index) const + { + if (index < 0 || index >= size) + { + throw std::out_of_range("Index out of range"); + } + return data[index]; + } + }; +} \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp new file mode 100644 index 0000000..0432f3c --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp @@ -0,0 +1,89 @@ +#include "AdminMenu.h" +#include "InputHelper.h" +#include "OutputHelper.h" + +void AdminMenu::showMenu() +{ + bool isMenuActive = true; + while (isMenuActive) + { + try + { + int choice; + util::clear(); + std::cout << "" << std::endl; + util::read(choice); + if (!handleOperation(choice)) + { + isMenuActive = false; + } + } + catch (const std::exception& e) + { + std::cout << "Exception: " << e.what() << std::endl; + util::pressEnter(); + } + } +} + +bool AdminMenu::handleOperation(int choice) +{ + return false; +} + + +void AdminMenu::logout() +{ +} + +void AdminMenu::changePassword() +{ +} + +void AdminMenu::viewStockLevels() +{ +} + +void AdminMenu::addInventoryItem() +{ +} + +void AdminMenu::removeInventoryItem() +{ +} + +void AdminMenu::checkStockAvailability() +{ +} + +void AdminMenu::assignJob() +{ +} + +void AdminMenu::createService() +{ +} + +void AdminMenu::removeService() +{ +} + +void AdminMenu::addTechnician() +{ +} + +void AdminMenu::removeUser() +{ +} + +void AdminMenu::createComboPackages() +{ +} + +void AdminMenu::removeComboPackage() +{ +} + +void AdminMenu::viewNotifications() +{ +} diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.h new file mode 100644 index 0000000..05fdd84 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.h @@ -0,0 +1,25 @@ +#pragma once +#include "Controller.h" + +class AdminMenu +{ +private: + Controller m_controller; + bool handleOperation(int choice); +public: + void showMenu(); + void logout(); + void changePassword(); + void viewStockLevels(); + void addInventoryItem(); + void removeInventoryItem(); + void checkStockAvailability(); + void assignJob(); + void createService(); + void removeService(); + void addTechnician(); + void removeUser(); + void createComboPackages(); + void removeComboPackage(); + void viewNotifications(); +}; \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp new file mode 100644 index 0000000..c9cc854 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp @@ -0,0 +1,50 @@ +#include "CustomerMenu.h" + +void CustomerMenu::showMenu() +{ +} + +bool CustomerMenu::handleOperation(int choice) +{ + return false; +} + +void CustomerMenu::logout() +{ +} + +void CustomerMenu::changePassword() +{ +} + +void CustomerMenu::updateDetails() +{ +} + +void CustomerMenu::selectService() +{ +} + +void CustomerMenu::selectComboPackage() +{ +} + +void CustomerMenu::viewServiceHistory() +{ +} + +void CustomerMenu::completePayments() +{ +} + +void CustomerMenu::viewInvoices() +{ +} + +void CustomerMenu::viewNotifications() +{ +} + +void CustomerMenu::configureNotifications() +{ +} diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.h new file mode 100644 index 0000000..886cf62 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.h @@ -0,0 +1,21 @@ +#pragma once +#include "Controller.h" + +class CustomerMenu +{ +private: + Controller m_controller; + bool handleOperation(int choice); +public: + void showMenu(); + void logout(); + void changePassword(); + void updateDetails(); + void selectService(); + void selectComboPackage(); + void viewServiceHistory(); + void completePayments(); + void viewInvoices(); + void viewNotifications(); + void configureNotifications(); +}; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.cpp new file mode 100644 index 0000000..91b2a14 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.cpp @@ -0,0 +1,20 @@ +#include "TechnicianMenu.h" +#include "InputHelper.h" +#include "OutputHelper.h" + +void TechnicianMenu::showMenu() +{ +} + +bool TechnicianMenu::handleOperation(int choice) +{ + return false; +} + +void TechnicianMenu::completeJob() +{ +} + +void TechnicianMenu::viewNotifications() +{ +} diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.h new file mode 100644 index 0000000..c366d9b --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.h @@ -0,0 +1,13 @@ +#pragma once +#include "Controller.h" + +class TechnicianMenu +{ +private: + Controller m_controller; + bool handleOperation(int choice); +public: + void showMenu(); + void completeJob(); + void viewNotifications(); +}; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/UserInterface.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/UserInterface.cpp new file mode 100644 index 0000000..48c17e5 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/UserInterface.cpp @@ -0,0 +1,57 @@ +#include "UserInterface.h" +#include "InputHelper.h" +#include "OutputHelper.h" + +void UserInterface::run() const +{ + bool isMenuActive = true; + while (isMenuActive) + { + try + { + int choice; + util::clear(); + std::cout << "Vehicle Service System\n1. Login\n2. Register Customer\n3. Exit\nEnter your Choice: "; + util::read(choice); + if (!handleOperation(choice)) + { + isMenuActive = false; + } + } + catch (const std::exception& e) + { + std::cout << "Exception: " << e.what() << std::endl; + util::pressEnter(); + } + } +} + +bool UserInterface::handleOperation(int choice) const +{ + switch (choice) + { + case 1: + login(); + break; + case 2: + registerCustomer(); + break; + case 3: + std::cout << "Exiting..." << std::endl; + return false; + default: + std::cout << "Enter a valid choice!" << std::endl; + util::pressEnter(); + } + return true; +} + +void UserInterface::login() const +{ + +} + +void UserInterface::registerCustomer() const +{ + +} diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/UserInterface.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/UserInterface.h new file mode 100644 index 0000000..d7fc250 --- /dev/null +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/UserInterface.h @@ -0,0 +1,20 @@ +#pragma once +#include "Controller.h" +#include "AdminMenu.h" +#include "TechnicianMenu.h" +#include "CustomerMenu.h" + +class UserInterface +{ +private: + Controller m_controller; + AdminMenu m_adminMenu; + TechnicianMenu m_technicianMenu; + CustomerMenu m_customerMenu; + bool handleOperation(int choice) const; +public: + UserInterface() {} + void run() const; + void login() const; + void registerCustomer() const; +};