Setup codebase
This commit is contained in:
+431
@@ -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
|
||||
@@ -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
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
#include "UserInterface.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
UserInterface userInterface;
|
||||
userInterface.run();
|
||||
}
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{39066b41-9568-48d7-bc70-e5ee9c486859}</ProjectGuid>
|
||||
<RootNamespace>TrenserVehicleServiceSystem</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)models;$(ProjectDir)controllers;$(ProjectDir)factories;$(ProjectDir)views;$(ProjectDir)services;$(ProjectDir)utilities;$(ProjectDir)core\patterns;$(ProjectDir)datastores;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)models;$(ProjectDir)controllers;$(ProjectDir)factories;$(ProjectDir)views;$(ProjectDir)services;$(ProjectDir)utilities;$(ProjectDir)core\patterns;$(ProjectDir)datastores;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="controllers\Controller.cpp" />
|
||||
<ClCompile Include="core\patterns\Observer.cpp" />
|
||||
<ClCompile Include="core\patterns\Subject.cpp" />
|
||||
<ClCompile Include="datastores\DataStore.cpp" />
|
||||
<ClCompile Include="models\ComboPackage.cpp" />
|
||||
<ClCompile Include="models\InventoryItem.cpp" />
|
||||
<ClCompile Include="models\Invoice.cpp" />
|
||||
<ClCompile Include="models\JobCard.cpp" />
|
||||
<ClCompile Include="models\Notification.cpp" />
|
||||
<ClCompile Include="models\Service.cpp" />
|
||||
<ClCompile Include="models\ServiceBooking.cpp" />
|
||||
<ClCompile Include="models\User.cpp" />
|
||||
<ClCompile Include="services\AuthenticationManagementService.cpp" />
|
||||
<ClCompile Include="services\InventoryManagementService.cpp" />
|
||||
<ClCompile Include="services\NotificationManagementService.cpp" />
|
||||
<ClCompile Include="services\PaymentManagementService.cpp" />
|
||||
<ClCompile Include="services\ServiceManagementService.cpp" />
|
||||
<ClCompile Include="services\UserManagementService.cpp" />
|
||||
<ClCompile Include="Trenser.VehicleServiceSystem.cpp" />
|
||||
<ClCompile Include="utilities\Timestamp.cpp" />
|
||||
<ClCompile Include="utilities\Validator.cpp" />
|
||||
<ClCompile Include="views\AdminMenu.cpp" />
|
||||
<ClCompile Include="views\CustomerMenu.cpp" />
|
||||
<ClCompile Include="views\TechnicianMenu.cpp" />
|
||||
<ClCompile Include="views\UserInterface.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="controllers\Controller.h" />
|
||||
<ClInclude Include="core\patterns\Observer.h" />
|
||||
<ClInclude Include="core\patterns\Subject.h" />
|
||||
<ClInclude Include="datastores\DataStore.h" />
|
||||
<ClInclude Include="factories\Factory.h" />
|
||||
<ClInclude Include="models\ComboPackage.h" />
|
||||
<ClInclude Include="models\InventoryItem.h" />
|
||||
<ClInclude Include="models\Invoice.h" />
|
||||
<ClInclude Include="models\JobCard.h" />
|
||||
<ClInclude Include="models\Notification.h" />
|
||||
<ClInclude Include="models\Service.h" />
|
||||
<ClInclude Include="models\ServiceBooking.h" />
|
||||
<ClInclude Include="models\User.h" />
|
||||
<ClInclude Include="services\AuthenticationManagementService.h" />
|
||||
<ClInclude Include="services\InventoryManagementService.h" />
|
||||
<ClInclude Include="services\NotificationManagementService.h" />
|
||||
<ClInclude Include="services\PaymentManagementService.h" />
|
||||
<ClInclude Include="services\ServiceManagementService.h" />
|
||||
<ClInclude Include="services\UserManagementService.h" />
|
||||
<ClInclude Include="utilities\Enums.h" />
|
||||
<ClInclude Include="utilities\InputHelper.h" />
|
||||
<ClInclude Include="utilities\Map.h" />
|
||||
<ClInclude Include="utilities\OutputHelper.h" />
|
||||
<ClInclude Include="utilities\Timestamp.h" />
|
||||
<ClInclude Include="utilities\Validator.h" />
|
||||
<ClInclude Include="utilities\Vector.h" />
|
||||
<ClInclude Include="views\AdminMenu.h" />
|
||||
<ClInclude Include="views\CustomerMenu.h" />
|
||||
<ClInclude Include="views\TechnicianMenu.h" />
|
||||
<ClInclude Include="views\UserInterface.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
+237
@@ -0,0 +1,237 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Factories">
|
||||
<UniqueIdentifier>{fc4022ec-cad1-4c5b-b5e3-87bdf86cdee3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Utilities">
|
||||
<UniqueIdentifier>{8c0e50bf-dbb3-4956-954a-e9bc7108a8f5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Utilities">
|
||||
<UniqueIdentifier>{6fc56811-874c-4c53-a31c-09c5da36f98a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Views">
|
||||
<UniqueIdentifier>{dade4e36-41ab-463b-a4f2-346219bf4bc8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Services">
|
||||
<UniqueIdentifier>{994018a4-a8e6-4dcd-9b5b-161fe467ea1a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Models">
|
||||
<UniqueIdentifier>{bf335df2-eccb-452b-99a0-be92078a30c8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Models">
|
||||
<UniqueIdentifier>{d668bff5-2da8-4200-aa0e-bd9db89c0ecf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Controllers">
|
||||
<UniqueIdentifier>{ad539cf4-b697-49b9-a999-4729618139d1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Controllers">
|
||||
<UniqueIdentifier>{94a14e13-7aaa-4f08-bcb2-618873e5198e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Views">
|
||||
<UniqueIdentifier>{defecdb5-b5c7-488d-a9d4-553755129f9c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\DataStores">
|
||||
<UniqueIdentifier>{b5d0f583-e687-416b-8c80-cd0d0037bc94}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\DataStores">
|
||||
<UniqueIdentifier>{a2807ab4-4d53-4e18-b4cd-13d0d552b057}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Services">
|
||||
<UniqueIdentifier>{05ab7ce1-f55a-4c76-96ed-f855a79921b9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Core">
|
||||
<UniqueIdentifier>{423a60cb-8b4e-41f5-9c05-80cc9a91dfba}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Core\Patterns">
|
||||
<UniqueIdentifier>{49f35205-bfa9-4f04-a9b3-9b74d33640d6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Core">
|
||||
<UniqueIdentifier>{1b53d284-7064-416f-9293-2bc17fa44b0c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Core\Patterns">
|
||||
<UniqueIdentifier>{8057b93d-51a9-42df-b06e-01ce395f6308}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Trenser.VehicleServiceSystem.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utilities\Timestamp.cpp">
|
||||
<Filter>Source Files\Utilities</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utilities\Validator.cpp">
|
||||
<Filter>Source Files\Utilities</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="controllers\Controller.cpp">
|
||||
<Filter>Source Files\Controllers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="views\AdminMenu.cpp">
|
||||
<Filter>Source Files\Views</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="views\CustomerMenu.cpp">
|
||||
<Filter>Source Files\Views</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="views\TechnicianMenu.cpp">
|
||||
<Filter>Source Files\Views</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="views\UserInterface.cpp">
|
||||
<Filter>Source Files\Views</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="services\AuthenticationManagementService.cpp">
|
||||
<Filter>Source Files\Services</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="services\InventoryManagementService.cpp">
|
||||
<Filter>Source Files\Services</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="services\PaymentManagementService.cpp">
|
||||
<Filter>Source Files\Services</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="services\ServiceManagementService.cpp">
|
||||
<Filter>Source Files\Services</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="services\UserManagementService.cpp">
|
||||
<Filter>Source Files\Services</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="datastores\DataStore.cpp">
|
||||
<Filter>Source Files\DataStores</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="services\NotificationManagementService.cpp">
|
||||
<Filter>Source Files\Services</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="core\patterns\Observer.cpp">
|
||||
<Filter>Source Files\Core\Patterns</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="core\patterns\Subject.cpp">
|
||||
<Filter>Source Files\Core\Patterns</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="models\User.cpp">
|
||||
<Filter>Source Files\Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="models\Notification.cpp">
|
||||
<Filter>Source Files\Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="models\Invoice.cpp">
|
||||
<Filter>Source Files\Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="models\InventoryItem.cpp">
|
||||
<Filter>Source Files\Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="models\ServiceBooking.cpp">
|
||||
<Filter>Source Files\Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="models\Service.cpp">
|
||||
<Filter>Source Files\Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="models\JobCard.cpp">
|
||||
<Filter>Source Files\Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="models\ComboPackage.cpp">
|
||||
<Filter>Source Files\Models</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="utilities\InputHelper.h">
|
||||
<Filter>Header Files\Utilities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="utilities\Map.h">
|
||||
<Filter>Header Files\Utilities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="utilities\OutputHelper.h">
|
||||
<Filter>Header Files\Utilities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="utilities\Timestamp.h">
|
||||
<Filter>Header Files\Utilities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="utilities\Validator.h">
|
||||
<Filter>Header Files\Utilities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="utilities\Vector.h">
|
||||
<Filter>Header Files\Utilities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="factories\Factory.h">
|
||||
<Filter>Header Files\Factories</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="controllers\Controller.h">
|
||||
<Filter>Header Files\Controllers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="views\AdminMenu.h">
|
||||
<Filter>Header Files\Views</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="views\CustomerMenu.h">
|
||||
<Filter>Header Files\Views</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="views\TechnicianMenu.h">
|
||||
<Filter>Header Files\Views</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="views\UserInterface.h">
|
||||
<Filter>Header Files\Views</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="services\AuthenticationManagementService.h">
|
||||
<Filter>Header Files\Services</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="services\InventoryManagementService.h">
|
||||
<Filter>Header Files\Services</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="services\PaymentManagementService.h">
|
||||
<Filter>Header Files\Services</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="services\ServiceManagementService.h">
|
||||
<Filter>Header Files\Services</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="services\UserManagementService.h">
|
||||
<Filter>Header Files\Services</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="datastores\DataStore.h">
|
||||
<Filter>Header Files\DataStores</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="services\NotificationManagementService.h">
|
||||
<Filter>Header Files\Services</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core\patterns\Observer.h">
|
||||
<Filter>Header Files\Core\Patterns</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core\patterns\Subject.h">
|
||||
<Filter>Header Files\Core\Patterns</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="models\User.h">
|
||||
<Filter>Header Files\Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="models\Notification.h">
|
||||
<Filter>Header Files\Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="utilities\Enums.h">
|
||||
<Filter>Header Files\Utilities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="models\Invoice.h">
|
||||
<Filter>Header Files\Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="models\ServiceBooking.h">
|
||||
<Filter>Header Files\Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="models\InventoryItem.h">
|
||||
<Filter>Header Files\Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="models\Service.h">
|
||||
<Filter>Header Files\Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="models\JobCard.h">
|
||||
<Filter>Header Files\Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="models\ComboPackage.h">
|
||||
<Filter>Header Files\Models</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1 @@
|
||||
#include "Controller.h"
|
||||
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
#include "Map.h"
|
||||
#include <string>
|
||||
#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<std::string, Service*> getServices();
|
||||
util::Map<std::string, ComboPackage*> getComboPackages();
|
||||
void purchaseService(const util::Vector<std::string>& 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<std::string, InventoryItem*> 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<std::string, ServiceBooking*> getServiceBookings();
|
||||
util::Map<std::string, ServiceBooking*> getServiceBookingsByUser();
|
||||
util::Map<std::string, User*> getUsers();
|
||||
util::Map<std::string, User*> 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<std::string>& inventoryItemIDs, double laborCost);
|
||||
void removeService(const std::string& serviceID);
|
||||
util::Map<std::string, JobCard*> getJobCardsByUser();
|
||||
void completeJob(const std::string& jobID);
|
||||
void removeUser(const std::string& userID);
|
||||
void createComboPackage(const std::string& name, const util::Vector<std::string>& serviceIDs, double discountPercentage);
|
||||
void removeComboPackage(const std::string& comboPackageID);
|
||||
util::Map<std::string, Invoice*> getInvoicesByUser();
|
||||
void completePayment(const std::string& invoiceID, util::PaymentMode paymentMode);
|
||||
util::Vector<Notification*> getNotifications();
|
||||
void deleteNotification(const std::string& notificationID);
|
||||
void configureNotifications(const std::string& userID, bool paymentNotifications, bool serviceNotifications);
|
||||
void runSystemChecks();
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
class Notification;
|
||||
|
||||
class Observer
|
||||
{
|
||||
public:
|
||||
virtual ~Observer() = default;
|
||||
virtual void update(Notification* notification) = 0;
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Map.h"
|
||||
|
||||
class User;
|
||||
class Notification;
|
||||
|
||||
class Subject
|
||||
{
|
||||
protected:
|
||||
util::Map<std::string, User*> m_observers;
|
||||
public:
|
||||
virtual ~Subject() = default;
|
||||
virtual void attach(User* user) = 0;
|
||||
virtual void detach(User* user) = 0;
|
||||
virtual void notify(Notification* notification) = 0;
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
#include "DataStore.h"
|
||||
|
||||
DataStore& DataStore::getInstance()
|
||||
{
|
||||
static DataStore dataStore;
|
||||
return dataStore;
|
||||
}
|
||||
|
||||
util::Map<std::string, User*>& DataStore::getUsers()
|
||||
{
|
||||
return m_users;
|
||||
}
|
||||
|
||||
util::Map<std::string, Service*>& DataStore::getServices()
|
||||
{
|
||||
return m_services;
|
||||
}
|
||||
|
||||
util::Map<std::string, ComboPackage*>& DataStore::getComboPackages()
|
||||
{
|
||||
return m_comboPackages;
|
||||
}
|
||||
|
||||
util::Map<std::string, ServiceBooking*>& DataStore::getServiceBookings()
|
||||
{
|
||||
return m_serviceBookings;
|
||||
}
|
||||
|
||||
util::Map<std::string, JobCard*>& DataStore::getJobCards()
|
||||
{
|
||||
return m_jobCards;
|
||||
}
|
||||
|
||||
util::Map<std::string, InventoryItem*>& DataStore::getInventoryItems()
|
||||
{
|
||||
return m_inventoryItems;
|
||||
}
|
||||
|
||||
util::Map<std::string, Invoice*>& DataStore::getInvoices()
|
||||
{
|
||||
return m_invoices;
|
||||
}
|
||||
|
||||
util::Map<std::string, Payment*>& DataStore::getPayments()
|
||||
{
|
||||
return m_payments;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "Map.h"
|
||||
|
||||
class User;
|
||||
class Service;
|
||||
class ComboPackage;
|
||||
class ServiceBooking;
|
||||
class JobCard;
|
||||
class InventoryItem;
|
||||
class Invoice;
|
||||
class Payment;
|
||||
|
||||
class DataStore
|
||||
{
|
||||
private:
|
||||
util::Map<std::string, User*> m_users;
|
||||
util::Map<std::string, Service*> m_services;
|
||||
util::Map<std::string, ComboPackage*> m_comboPackages;
|
||||
util::Map<std::string, ServiceBooking*> m_serviceBookings;
|
||||
util::Map<std::string, JobCard*> m_jobCards;
|
||||
util::Map<std::string, InventoryItem*> m_inventoryItems;
|
||||
util::Map<std::string, Invoice*> m_invoices;
|
||||
util::Map<std::string, Payment*> 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<std::string, User*>& getUsers();
|
||||
util::Map<std::string, Service*>& getServices();
|
||||
util::Map<std::string, ComboPackage*>& getComboPackages();
|
||||
util::Map<std::string, ServiceBooking*>& getServiceBookings();
|
||||
util::Map<std::string, JobCard*>& getJobCards();
|
||||
util::Map<std::string, InventoryItem*>& getInventoryItems();
|
||||
util::Map<std::string, Invoice*>& getInvoices();
|
||||
util::Map<std::string, Payment*>& getPayments();
|
||||
};
|
||||
@@ -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 <utility>
|
||||
|
||||
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<typename T, typename... Args>
|
||||
static T* getObject(Args&&... args)
|
||||
{
|
||||
return new T(std::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
@@ -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<std::string, Service*>& 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<std::string, Service*>& 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<std::string, Service*>& services)
|
||||
{
|
||||
m_services = services;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#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<std::string, Service*> m_services;
|
||||
public:
|
||||
ComboPackage();
|
||||
ComboPackage(const std::string& packageName, double discountPercentage, const util::Map<std::string, Service*>& services);
|
||||
const std::string& getId() const;
|
||||
const std::string& getPackageName() const;
|
||||
double getDiscountPercentage() const;
|
||||
const util::Map<std::string, Service*>& getServices() const;
|
||||
void setId(const std::string& id);
|
||||
void setPackageName(const std::string& packageName);
|
||||
void setDiscountPercentage(double discountPercentage);
|
||||
void setServices(const util::Map<std::string, Service*>& services);
|
||||
};
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
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);
|
||||
};
|
||||
@@ -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<int,
|
||||
InventoryItem*>& 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<int, InventoryItem*>& 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<int, InventoryItem*>& 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;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#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<int, InventoryItem*> 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<int,
|
||||
InventoryItem*>& 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<int, InventoryItem*>& 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<int, InventoryItem*>& 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);
|
||||
};
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#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);
|
||||
};
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#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);
|
||||
};
|
||||
@@ -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<std::string, InventoryItem*>& 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<std::string, InventoryItem*>& 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<std::string, InventoryItem*>& requiredInventoryItems)
|
||||
{
|
||||
m_requiredInventoryItems = requiredInventoryItems;
|
||||
}
|
||||
|
||||
void Service::setLaborCost(double laborCost)
|
||||
{
|
||||
m_laborCost = laborCost;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Map.h"
|
||||
|
||||
class InventoryItem;
|
||||
|
||||
class Service
|
||||
{
|
||||
private:
|
||||
static int m_uid;
|
||||
std::string m_id;
|
||||
std::string m_name;
|
||||
util::Map<std::string, InventoryItem*> m_requiredInventoryItems;
|
||||
double m_laborCost;
|
||||
public:
|
||||
Service();
|
||||
Service(const std::string& name, const util::Map<std::string, InventoryItem*>& requiredInventoryItems, double laborCost);
|
||||
const std::string& getId() const;
|
||||
const std::string& getName() const;
|
||||
const util::Map<std::string, InventoryItem*>& getRequiredInventoryItems() const;
|
||||
double getLaborCost() const;
|
||||
void setId(const std::string& id);
|
||||
void setName(const std::string& name);
|
||||
void setRequiredInventoryItems(const util::Map<std::string, InventoryItem*>& requiredInventoryItems);
|
||||
void setLaborCost(double laborCost);
|
||||
};
|
||||
@@ -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<std::string,
|
||||
Service*>& 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<std::string, Service*>& 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<std::string, Service*>& 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;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#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<std::string, Service*> 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<std::string,
|
||||
Service*>& 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<std::string, Service*>& 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<std::string, Service*>& 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);
|
||||
};
|
||||
@@ -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<std::string, Notification*>& 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;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#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<std::string, Notification*> 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<std::string, Notification*>& 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);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
#include "AuthenticationManagementService.h"
|
||||
|
||||
User* AuthenticationManagementService::m_authenticatedUser = nullptr;
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#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();
|
||||
};
|
||||
+1
@@ -0,0 +1 @@
|
||||
#include "InventoryManagementService.h"
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#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<std::string, InventoryItem*> 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);
|
||||
};
|
||||
+1
@@ -0,0 +1 @@
|
||||
#include "NotificationManagementService.h"
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#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;
|
||||
};
|
||||
+1
@@ -0,0 +1 @@
|
||||
#include "PaymentManagementService.h"
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#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<std::string, Invoice*> 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);
|
||||
};
|
||||
+1
@@ -0,0 +1 @@
|
||||
#include "ServiceManagementService.h"
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#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<std::string, Service*> getServices();
|
||||
util::Map<std::string, ComboPackage*> getComboPackages();
|
||||
void purchaseService(const util::Vector<std::string>& 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<std::string, ServiceBooking*> getServiceBookings();
|
||||
util::Map<std::string, ServiceBooking*> 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<std::string>& inventoryItemIDs, double laborCost);
|
||||
void removeService(const std::string& serviceID);
|
||||
util::Map<std::string, JobCard*> 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<std::string>& serviceIDs, double discountPercentage);
|
||||
void removeComboPackage(const std::string& comboPackageID);
|
||||
void sendNotification(User* user, const std::string& title, const std::string& message);
|
||||
};
|
||||
+1
@@ -0,0 +1 @@
|
||||
#include "UserManagementService.h"
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#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<std::string, User*> getUsers();
|
||||
util::Map<std::string, User*> getUsers(util::UserType type);
|
||||
User* getUser(const std::string& userID);
|
||||
void removeUser(const std::string& userID);
|
||||
util::Vector<Notification*> getUserNotifications(const std::string& userID);
|
||||
void deleteNotification(const std::string& notificationID, const std::string& userID);
|
||||
};
|
||||
@@ -0,0 +1,138 @@
|
||||
#pragma once
|
||||
#include <stdexcept>
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* File: InputHelper.h
|
||||
* Description: Handles input validation and error handling
|
||||
* Author: Trenser
|
||||
* Created: 18-May-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
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 <typename T>
|
||||
inline void read(T& value)
|
||||
{
|
||||
if (!(std::cin >> value))
|
||||
{
|
||||
std::cin.clear();
|
||||
std::cin.ignore(std::numeric_limits<std::streamsize>::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");
|
||||
}
|
||||
}
|
||||
@@ -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<typename K, typename V>
|
||||
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<Entry> 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<typename Predicate>
|
||||
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<K> - vector containing all keys
|
||||
*/
|
||||
Vector<K> getKeys() const
|
||||
{
|
||||
Vector<K> 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<V> - vector containing all values
|
||||
*/
|
||||
Vector<V> getValues() const
|
||||
{
|
||||
Vector<V> 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;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* File: OutputHelper.h
|
||||
* Description: Provides functions to help with console output.
|
||||
* Author: Trenser
|
||||
* Created: 18-May-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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 <sstream>
|
||||
#include <iomanip>
|
||||
#include <stdexcept>
|
||||
#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;
|
||||
}
|
||||
@@ -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 <ctime>
|
||||
#include <string>
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* File: Validator.cpp
|
||||
* Description: Validates inputs like phone number, email, password
|
||||
* Author: Trenser
|
||||
* Created: 18-May-2026
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <cctype>
|
||||
#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<unsigned char>(character)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (std::isupper(static_cast<unsigned char>(character)))
|
||||
{
|
||||
hasUpper = true;
|
||||
}
|
||||
else if (std::islower(static_cast<unsigned char>(character)))
|
||||
{
|
||||
hasLower = true;
|
||||
}
|
||||
else if (std::isdigit(static_cast<unsigned char>(character)))
|
||||
{
|
||||
hasDigit = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
hasSpecial = true;
|
||||
}
|
||||
}
|
||||
|
||||
return hasUpper && hasLower && hasDigit && hasSpecial;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* File: Validator.h
|
||||
* Description: Validates inputs like phone number, email, password
|
||||
* Author: Trenser
|
||||
* Created: 18-May-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include<string>
|
||||
#include<algorithm>
|
||||
#include<cctype>
|
||||
|
||||
namespace util
|
||||
{
|
||||
bool isPhoneNumberValid(const std::string&);
|
||||
bool isEmailValid(const std::string&);
|
||||
bool isPasswordValid(const std::string&);
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
/*
|
||||
* File: Vector.h
|
||||
* Description: Provides a generic dynamic array container implementation.
|
||||
* Author: Trenser
|
||||
* Created: 18-May-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <stdexcept>
|
||||
|
||||
namespace util
|
||||
{
|
||||
template<typename T>
|
||||
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<T>& 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<T>&& 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<T>& - reference to the current Vector object
|
||||
*/
|
||||
Vector<T>& operator=(const Vector<T>& 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<T>& - reference to the current Vector object
|
||||
*/
|
||||
Vector<T>& operator=(Vector<T>&& 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<typename Predicate>
|
||||
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];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
}
|
||||
@@ -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();
|
||||
};
|
||||
@@ -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()
|
||||
{
|
||||
}
|
||||
@@ -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();
|
||||
};
|
||||
@@ -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()
|
||||
{
|
||||
}
|
||||
@@ -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();
|
||||
};
|
||||
@@ -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
|
||||
{
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user