├── .gitignore
├── README.md
├── db
├── 001_create_database.sql
├── 002_create_vehicles.sql
├── 003_create_persons.sql
├── 004_create_roles.sql
├── 005_create_user_accounts.sql
├── 006_create_requests.sql
├── 007_create_passengers.sql
├── 008_create_trips.sql
├── create_tables.sql
└── drop_tables.sql
├── doc
├── VMS-Process.png
├── VMS-logo.png
├── VMS-screen-shots
│ ├── VMS-01-Main-page.png
│ ├── VMS-02-Users.png
│ ├── VMS-03-User-info.png
│ ├── VMS-04-Vehicles.png
│ ├── VMS-05-Vehicle-info.png
│ ├── VMS-06-Requests.png
│ ├── VMS-07-Request-info.png
│ ├── VMS-08-Trips.png
│ └── VMS-09-Trip-info.png
├── VMS_UML_class_diagram.png
└── VMS_logo.png
├── vms.db
├── Mapping
│ ├── Person.hbm.xml
│ ├── Request.hbm.xml
│ ├── Role.hbm.xml
│ ├── Trip.hbm.xml
│ ├── UserAccount.hbm.xml
│ └── Vehicle.hbm.xml
├── Properties
│ └── AssemblyInfo.cs
├── Services
│ └── PersistenceService.cs
├── packages.config
└── vms.db.csproj
├── vms.model
├── Address.cpp
├── Address.h
├── Administrator.cpp
├── Administrator.h
├── CargoCar.cpp
├── CargoCar.h
├── Employee.cpp
├── Employee.h
├── GarageAttendant.cpp
├── GarageAttendant.h
├── Manager.cpp
├── Manager.h
├── OwnedVehicle.cpp
├── OwnedVehicle.h
├── PassengerCar.cpp
├── PassengerCar.h
├── PersistentEntity.h
├── Person.cpp
├── Person.h
├── Request.cpp
├── Request.h
├── Role.h
├── Stdafx.h
├── Trip.cpp
├── Trip.h
├── UserAccount.cpp
├── UserAccount.h
├── UtilityCar.cpp
├── UtilityCar.h
├── Vehicle.cpp
├── Vehicle.h
├── vms.model.vcxproj
└── vms.model.vcxproj.filters
├── vms.sln
└── vms.view
├── App.config
├── App.xaml
├── App.xaml.cs
├── Components
├── Border.xaml
├── Brushes.xaml
├── Button.xaml
├── ComboBox.xaml
├── CommonStyles.xaml
├── DataGrid.xaml
├── ErrorTemplate.xaml
├── GroupBox.xaml
├── ScrollBar.xaml
├── TabControl.xaml
├── TabItem.xaml
├── TextBlock.xaml
├── TextBox.xaml
├── TextBoxExtensions.cs
└── ToolTip.xaml
├── Controllers
├── DelegateCommand.cs
├── LandingController.cs
├── ListController.cs
├── RequestsController.cs
├── TripsController.cs
├── UsersController.cs
└── VehiclesController.cs
├── Fonts
├── calibri.ttf
├── calibrib.ttf
├── calibrii.ttf
└── calibriz.ttf
├── Helpers
├── AppServices.cs
└── ClientSecurityContext.cs
├── Properties
└── AssemblyInfo.cs
├── Resources
├── CarKey.png
├── CarKey128.png
├── VMS_logo.ico
├── VMS_logo.png
├── background.jpg
├── background_left.png
├── car128.png
├── reports128.png
├── trips128.png
└── users128.png
├── Shell.xaml
├── Shell.xaml.cs
├── Utils
├── DateBehavior.cs
├── DateMask.cs
├── EnumHelper.cs
├── MaskElement.cs
└── TextBoxMask.cs
├── ViewModels
├── IPageNavigator.cs
├── ItemViewModel.cs
├── NavigationManager.cs
├── RequestViewModel.cs
├── RoleViewModel.cs
├── ShellViewModel.cs
├── TripViewModel.cs
├── UserViewModel.cs
├── VehicleViewModel.cs
└── ViewModelBase.cs
├── Views
├── LoginView.xaml
├── LoginView.xaml.cs
├── NewPassengerView.xaml
├── NewPassengerView.xaml.cs
├── Pages
│ ├── LandingView.xaml
│ ├── LandingView.xaml.cs
│ ├── RequestsView.xaml
│ ├── RequestsView.xaml.cs
│ ├── TripsView.xaml
│ ├── TripsView.xaml.cs
│ ├── UsersView.xaml
│ ├── UsersView.xaml.cs
│ ├── VehiclesView.xaml
│ └── VehiclesView.xaml.cs
├── RequestView.xaml
├── RequestView.xaml.cs
├── SignInView.xaml
├── SignInView.xaml.cs
├── TripView.xaml
├── TripView.xaml.cs
├── UserInfoView.xaml
├── UserInfoView.xaml.cs
├── VehiclePropertiesView.xaml
└── VehiclePropertiesView.xaml.cs
└── vms.view.csproj
/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | obj/
3 | .vs/
4 | Debug/
5 | ipch
6 | packages/
7 | *.opendb
8 | *.VC.db
9 | *.user
10 | *.sdf
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Vehicle-Management-System
2 |
3 | A tracking program for company vehicles.
4 | It keeps track of records of company's vehicle usage by employees:
5 | who, when, for what purpose, for how long run the particular car.
6 |
7 | ## Project Assignment
8 |
9 | > Design a Vehicle Management System – tracking program for company vehicles.
10 |
11 |
12 | > Specifications
13 |
14 | > * A tracking program for company vehicles.
15 | > * Identifying how and when vehicles are checked out for usage by employees.
16 | > * Cargo transportation, business trip, loaner cars, … _
17 | > * Record ID number, date checked out, driver name, mileage, type of usage, and contents.
18 | > * Company use: each trip is recorded including date, time, miles driven, fuel cost, and the purpose of the trip.
19 | > * Personal use: the insurance information should be recorded.
20 | > * Carrying passengers: list of passengers;
21 | > * Carrying cargo, an inventory of the vehicle contents
22 |
23 |
24 |
25 | ## Format
26 |
27 | Desktop GUI application with MS SQL Server database.
28 |
29 |
30 |
31 |
32 |
Business process infographics
33 |
34 | 
35 |
36 |
37 |
38 |
39 | ## UML Class Diagram
40 |
41 | Classes | Enumerations
42 | ------------ | -------------
43 | [Address](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/Address.h) | [AgeCategory](https://github.com/aemulare/Vehicle-Management-System/blob/7331c716a748ace8bed6bbc1cb565eb8bfb80e71/vms.model/Person.h)
44 | [Administrator](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/Administrator.h) | [RequestStatus](https://github.com/aemulare/Vehicle-Management-System/blob/7331c716a748ace8bed6bbc1cb565eb8bfb80e71/vms.model/Request.h)
45 | [CargoCar](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/CargoCar.h) | [FuelType](https://github.com/aemulare/Vehicle-Management-System/blob/7331c716a748ace8bed6bbc1cb565eb8bfb80e71/vms.model/Vehicle.h)
46 | [Employee](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/Employee.h) | [Transmission](https://github.com/aemulare/Vehicle-Management-System/blob/7331c716a748ace8bed6bbc1cb565eb8bfb80e71/vms.model/Vehicle.h)
47 | [GarageAttendant](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/GarageAttendant.h) | [PassengerCarType](https://github.com/aemulare/Vehicle-Management-System/blob/7331c716a748ace8bed6bbc1cb565eb8bfb80e71/vms.model/PassengerCar.h)
48 | [Manager](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/Manager.h) | [CargoCarType](https://github.com/aemulare/Vehicle-Management-System/blob/7331c716a748ace8bed6bbc1cb565eb8bfb80e71/vms.model/CargoCar.h)
49 | [OwnedVehicle](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/OwnedVehicle.h) | [UtilityCarType](https://github.com/aemulare/Vehicle-Management-System/blob/7331c716a748ace8bed6bbc1cb565eb8bfb80e71/vms.model/UtilityCar.h)
50 | [PassengerCar](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/PassengerCar.h) |
51 | [Person](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/Person.h) |
52 | [Request](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/Request.h) |
53 | [Role](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/Role.h) |
54 | [Trip](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/Trip.h) |
55 | [UserAccount](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/UserAccount.h) |
56 | [UtilityCar](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/UtilityCar.h) |
57 | [Vehicle](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/Vehicle.h) |
58 | [PersistentEntity](https://github.com/aemulare/Vehicle-Management-System/blob/master/vms.model/PersistentEntity.h) |
59 |
60 |
61 |
62 |
63 | [Full UML Class Diagram](https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/master/doc/VMS_UML_class_diagram.png)
64 |
65 |
66 |
67 |
68 | ## Screen shots
69 |
70 | 
71 |
72 | 
73 |
74 | 
75 |
76 | 
77 |
78 | 
79 |
80 | [More screen shots](https://github.com/aemulare/Vehicle-Management-System/tree/master/doc/VMS-screen-shots)
81 |
82 |
83 | ## Author
84 |
85 | * [Maria Romanova](https://github.com/aemulare)
86 |
87 | ## Links
88 |
89 | * project repository - https://github.com/aemulare/Vehicle-Management-System
90 |
--------------------------------------------------------------------------------
/db/001_create_database.sql:
--------------------------------------------------------------------------------
1 | use [master]
2 | go
3 |
4 | /****** Object: Database [vms] Script Date: 11/5/2016 1:04:42 PM ******/
5 | create database [vms] containment = none on primary
6 | ( NAME = N'vms', FILENAME = N'C:\Dbs\vms.mdf' , SIZE = 4096KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
7 | LOG ON
8 | ( NAME = N'vms_log', FILENAME = N'C:\Dbs\vms.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
9 | GO
10 |
11 | ALTER DATABASE [vms] SET COMPATIBILITY_LEVEL = 120
12 | GO
13 |
14 | IF(1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
15 | begin
16 | EXEC [vms].[dbo].[sp_fulltext_database] @action = 'enable'
17 | end
18 | GO
19 |
20 | ALTER DATABASE [vms] SET ANSI_NULL_DEFAULT OFF
21 | GO
22 | ALTER DATABASE [vms] SET ANSI_NULLS OFF
23 | GO
24 | ALTER DATABASE [vms] SET ANSI_PADDING OFF
25 | GO
26 | ALTER DATABASE [vms] SET ANSI_WARNINGS OFF
27 | GO
28 | ALTER DATABASE [vms] SET ARITHABORT OFF
29 | GO
30 | ALTER DATABASE [vms] SET AUTO_CLOSE OFF
31 | GO
32 | ALTER DATABASE [vms] SET AUTO_SHRINK OFF
33 | GO
34 | ALTER DATABASE [vms] SET AUTO_UPDATE_STATISTICS ON
35 | GO
36 | ALTER DATABASE [vms] SET CURSOR_CLOSE_ON_COMMIT OFF
37 | GO
38 | ALTER DATABASE [vms] SET CURSOR_DEFAULT GLOBAL
39 | GO
40 | ALTER DATABASE [vms] SET CONCAT_NULL_YIELDS_NULL OFF
41 | GO
42 | ALTER DATABASE [vms] SET NUMERIC_ROUNDABORT OFF
43 | GO
44 | ALTER DATABASE [vms] SET QUOTED_IDENTIFIER OFF
45 | GO
46 | ALTER DATABASE [vms] SET RECURSIVE_TRIGGERS OFF
47 | GO
48 | ALTER DATABASE [vms] SET DISABLE_BROKER
49 | GO
50 | ALTER DATABASE [vms] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
51 | GO
52 | ALTER DATABASE [vms] SET DATE_CORRELATION_OPTIMIZATION OFF
53 | GO
54 | ALTER DATABASE [vms] SET TRUSTWORTHY OFF
55 | GO
56 | ALTER DATABASE [vms] SET ALLOW_SNAPSHOT_ISOLATION OFF
57 | GO
58 | ALTER DATABASE [vms] SET PARAMETERIZATION SIMPLE
59 | GO
60 | ALTER DATABASE [vms] SET READ_COMMITTED_SNAPSHOT OFF
61 | GO
62 | ALTER DATABASE [vms] SET HONOR_BROKER_PRIORITY OFF
63 | GO
64 | ALTER DATABASE [vms] SET RECOVERY FULL
65 | GO
66 | ALTER DATABASE [vms] SET MULTI_USER
67 | GO
68 | ALTER DATABASE [vms] SET PAGE_VERIFY CHECKSUM
69 | GO
70 | ALTER DATABASE [vms] SET DB_CHAINING OFF
71 | GO
72 | ALTER DATABASE [vms] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
73 | GO
74 | ALTER DATABASE [vms] SET TARGET_RECOVERY_TIME = 0 SECONDS
75 | GO
76 | ALTER DATABASE [vms] SET DELAYED_DURABILITY = DISABLED
77 | GO
78 | ALTER DATABASE [vms] SET READ_WRITE
79 | GO
80 |
--------------------------------------------------------------------------------
/db/002_create_vehicles.sql:
--------------------------------------------------------------------------------
1 | use vms;
2 | go
3 |
4 | create table dbo.vehicles
5 | (
6 | id int not null primary key identity,
7 | car_type tinyint not null,
8 | car_subtype tinyint not null,
9 | vin nchar(17) not null unique,
10 | maker nvarchar(32) not null,
11 | model nvarchar(64) not null,
12 | color nvarchar(64) not null,
13 | fuel_type tinyint not null,
14 | transmission tinyint not null,
15 | year_manufactured int not null,
16 | swept_volume numeric(3,1) not null,
17 | fuel_tank_capacity numeric(4,1) not null,
18 | plate nvarchar(8) not null unique,
19 | mileage numeric(8,1) not null,
20 | is_available tinyint not null default 1,
21 | max_passengers tinyint null,
22 | gross_mass int null,
23 |
24 |
25 | check (car_type between 0 and 2), -- PassengerCar, CargoCar, UtilityCar
26 | check (car_subtype between 0 and 8),
27 | check (fuel_type between 0 and 6),
28 | check (is_available between 0 and 1),
29 | check (transmission between 0 and 4),
30 | check (year_manufactured between 1900 and 2017)
31 | );
32 | go
33 |
34 | -- passengers cars
35 | insert into dbo.vehicles (car_type, car_subtype, vin, maker, model, color, fuel_type, transmission,
36 | year_manufactured, swept_volume, fuel_tank_capacity, plate, mileage, max_passengers)
37 | values
38 | (0, 0, '1J4FA29145P370908', 'Chevrolet', 'Corvette Stingray', 'Black', 2, 2, 2017, 6.2, 18.5, 'ZBX-3277', 50, 1),
39 | (0, 1, '1G6DJ5EV8A0122772', 'Lincoln', 'Town Car', 'Silver', 2, 0, 2011, 4.6, 19, 'TPU-4421', 82576, 6),
40 | (0, 2, '2D8GV58215H622257', 'Honda', 'Pilot EXL', 'Cherry', 0, 0, 2014, 3.5, 20, 'ERT-1842', 10000, 7),
41 | (0, 3, '1G4GD5E33CF265088', 'Buick', 'Skyhawk Sport Turbo', 'White', 2, 2, 1987, 2, 12, 'QBS-0944', 150000, 4),
42 | (0, 4, '1G1AK12F557663240', 'Mitsubishi', 'Outlander ES', 'Dark Grey', 2, 4, 2015, 2.4, 16.6, 'MSH-6919', 60000, 7),
43 | (0, 5, '5N1AR1NBXBC608972', 'Honda', 'Odyssey LX', 'Dark Blue', 2, 0, 2014, 3.5, 21, 'DXT-7997', 105000, 7),
44 | (0, 6, '2C4RDGCG1CR104195', 'Ford', 'Transit-350 XLT', 'Grey Metallic', 0, 0, 2015, 3.2, 26, 'HFU-0833', 45000, 12),
45 | (0, 7, 'WDZPE8CC2C5616343', 'Mercedes-Benz', 'Sprinter', 'Silver', 0, 0, 2012, 3, 25, 'VMV-4188', 26643, 14),
46 | (0, 8, 'JALC4B14417008124', 'Setra', 'TopClass S 417', 'Gold', 0, 0, 2011, 18.2, 180, 'OWL-6744', 43276, 56);
47 |
48 | -- cargo cars
49 | insert into dbo.vehicles (car_type, car_subtype, vin, maker, model, color, fuel_type, transmission,
50 | year_manufactured, swept_volume, fuel_tank_capacity, plate, mileage, gross_mass)
51 | values
52 | (1, 0, '1HGEJ8253YL143630', 'Mitsubishi', 'Triton GLX 2WD', 'White', 6, 1, 2012, 2.4, 75, 'RWB-7062', 94371, 2720),
53 | (1, 1, '2D8GV57298H229869', 'Toyota', 'Tundra 1794 Edition', 'Red', 2, 0, 2016, 5.7, 38, 'RPX-1836', 35000, 7000);
54 | go
55 |
56 | -- utility car
57 | insert into dbo.vehicles (car_type, car_subtype, vin, maker, model, color, fuel_type, transmission,
58 | year_manufactured, swept_volume, fuel_tank_capacity, plate, mileage)
59 | values
60 | (2, 2, 'WBAWV53547PW24706', 'ELGIN', 'Crosswind Sweeper', 'White', 1, 0, 2007, 5.9, 30, 'OOU-5798', 68366);
61 | go
62 |
--------------------------------------------------------------------------------
/db/003_create_persons.sql:
--------------------------------------------------------------------------------
1 | use vms;
2 | go
3 |
4 | create table dbo.persons
5 | (
6 | id int not null primary key identity,
7 | first_name nvarchar(32) not null,
8 | last_name nvarchar(32) not null,
9 | dob date null,
10 | driver_license nvarchar(9) null,
11 | insurance nvarchar(64) null,
12 | phone_number nvarchar(32) null,
13 | email nvarchar(64) null,
14 | street_address_1 nvarchar(64) null,
15 | street_address_2 nvarchar(64) null,
16 | city nvarchar(64) null,
17 | us_state nchar(2) null,
18 | zip nchar(5) null,
19 |
20 | check (dob > '18700101'),
21 | );
22 | go
23 |
24 | insert into dbo.persons (first_name, last_name, dob, driver_license, insurance, phone_number, email,
25 | street_address_1, street_address_2, city, us_state, zip)
26 | values
27 | ('Marilyn', 'Monroe', '1926-06-01', 'V4882817', 'GEICO 123', '619-307-1279', 'marylin@hollywood.com', '6676 Santa Monica Blvd', 'apt. 8B', 'Los Angeles', 'CA', '90038'),
28 | ('Gregory', 'Peck', '1916-04-05', 'G6968088', 'Allstate 783', '951-349-8652', 'gregory.peck@hollywood.com', '6676 Santa Monica Blvd', 'apt. 8C', 'Los Angeles', 'CA', '90038'),
29 | ('Audrey', 'Hepburn', '1929-05-04','D6965681', 'Progressive 23874', '707-486-0606', 'tiffany@hollywood.com', '6676 Santa Monica Blvd', 'apt. 8A', 'Los Angeles', 'CA', '90038'),
30 | ('Kathy', 'Bates', '1948-06-28', '554641480', 'Amica 899', '865-254-0167', 'favorite.actress@StephenKing.com', '27 E 69th St', 'apt. 3B', 'New York', 'NY', '10021'),
31 | ('Marcia', 'Harden', '1959-08-14', '46562061', 'State Farm 235', '956-970-6288', 'actress@hollywood.com', '505 W 22nd St', 'apt. 1A', 'Austin', 'TX', '78705'),
32 | ('Stephen', 'King', '1947-09-21', '5028865', '21st Century 242', '207-714-4609', 'me@StephenKing.com', '47 West Broadway Street', null, 'Bangor', 'ME', '04401'),
33 | ('Gwen', 'Hvostataya', '2011-04-27', null, null, null, null, '21 Goodall street', null, 'Staten Island', 'NY', '10308'),
34 | ('Morfey', 'Dreamy', '1993-09-05', null, null, '+7 (924) 336-0146', 'mors@firstcat.org', '138 Pacific Ocean street', '312', 'Khabarovsk', 'KH', '68003');
35 | go
--------------------------------------------------------------------------------
/db/004_create_roles.sql:
--------------------------------------------------------------------------------
1 | use vms;
2 | go
3 |
4 | create table dbo.roles
5 | (
6 | id int not null primary key identity,
7 | role_type tinyint not null,
8 | role_name nvarchar(32) not null,
9 |
10 | check (role_type between 0 and 3)
11 | );
12 | go
13 |
14 | insert into dbo.roles (role_type, role_name)
15 | values
16 | (0, 'employee'),
17 | (1, 'admin'),
18 | (2, 'manager'),
19 | (3, 'garage attendant');
20 | go
21 |
--------------------------------------------------------------------------------
/db/005_create_user_accounts.sql:
--------------------------------------------------------------------------------
1 | use vms;
2 | go
3 |
4 | create table dbo.user_accounts
5 | (
6 | id int not null primary key identity,
7 | user_account_id nvarchar(32) not null,
8 | user_password nvarchar(32) not null,
9 | role_id int not null,
10 | person_id int not null,
11 | is_locked tinyint not null default 0,
12 |
13 | foreign key (person_id) references dbo.persons (id),
14 | foreign key (role_id) references dbo.roles (id),
15 | );
16 | go
17 |
18 | insert into dbo.user_accounts (user_account_id, user_password, role_id, person_id)
19 | values
20 | ('Blonde', 'admin', 2, 1),
21 | ('Atticus', 'Mockingbird16', 3, 2),
22 | ('Aud', 'Moonriver29', 1, 3),
23 | ('Bobo', 'Misery48', 1, 4),
24 | ('Marcia', 'Mist59', 1, 5),
25 | ('King-of-Horror', 'writer47', 4, 6),
26 | ('Mors', 'kot', 1, 8)
27 | go
28 |
--------------------------------------------------------------------------------
/db/006_create_requests.sql:
--------------------------------------------------------------------------------
1 | use vms;
2 | go
3 |
4 | create table dbo.requests
5 | (
6 | id int not null primary key identity,
7 | code nvarchar(32) not null,
8 | vehicle_id int not null,
9 | request_status tinyint not null default 0,
10 | purpose nvarchar(32) not null,
11 | destination nvarchar(64) not null,
12 | planned_trip_start datetime not null,
13 | planned_trip_end datetime not null,
14 | for_personal_use tinyint not null,
15 | driver_id int not null,
16 | inventory_content nvarchar(64) null,
17 | submitted_at datetime not null,
18 | requestor_id int not null,
19 | approved_at datetime null,
20 | approver_id int null,
21 |
22 | foreign key (requestor_id) references dbo.user_accounts (id),
23 | foreign key (vehicle_id) references dbo.vehicles (id),
24 | foreign key (driver_id) references dbo.user_accounts (id),
25 | foreign key (approver_id) references dbo.user_accounts (id),
26 |
27 | check (for_personal_use between 0 and 1),
28 | check (request_status between 0 and 4),
29 | check (planned_trip_start < planned_trip_end),
30 | check (submitted_at < approved_at)
31 | );
32 | go
33 |
34 |
35 | insert into dbo.requests (code, request_status, planned_trip_start, planned_trip_end, destination, purpose, for_personal_use,
36 | requestor_id, submitted_at, approver_id, approved_at, vehicle_id, driver_id, inventory_content)
37 | values
38 | ('REQ2016.10.11.0001', 1, '2016-10-15T08:00:00', '2016-10-18T17:00:00', 'Washington DC', 'meeting with client', 0,
39 | 6, '2016-10-10T14:25:10', 5, '2016-10-10T16:00:00', 3, 6, null),
40 | ('REQ2016.11.01.0005', 3, '2016-11-02T09:30:00', '2016-11-08T09:30:00', 'New York NY', 'business trip', 0,
41 | 4, '2016-11-01T10:00:00', 6, '2016-11-01T11:00:00', 4, 4, null);
42 | go
43 |
--------------------------------------------------------------------------------
/db/007_create_passengers.sql:
--------------------------------------------------------------------------------
1 | use vms;
2 | go
3 |
4 | create table dbo.passengers
5 | (
6 | id int not null primary key identity,
7 | person_id int not null,
8 | request_id int not null,
9 |
10 | foreign key (request_id) references dbo.requests (id),
11 | foreign key (person_id) references dbo.persons (id)
12 | );
13 | go
14 |
--------------------------------------------------------------------------------
/db/008_create_trips.sql:
--------------------------------------------------------------------------------
1 | use vms;
2 | go
3 |
4 | create table dbo.trips
5 | (
6 | id int not null primary key identity,
7 | request_id int not null,
8 | started_at datetime not null,
9 | finished_at datetime null,
10 | mileage numeric(8,1) null,
11 | fuel_cost numeric(8,1) null,
12 |
13 | foreign key (request_id) references dbo.requests(id),
14 | );
15 | go
16 |
17 | insert into dbo.trips (request_id, started_at, finished_at, mileage, fuel_cost)
18 | values
19 | (1, '2016-10-15T08:00:00', '2016-10-18T16:00:00', 100, 200);
20 | go
21 |
22 |
--------------------------------------------------------------------------------
/db/create_tables.sql:
--------------------------------------------------------------------------------
1 | :setvar path "C:\Users\Maryika\Documents\GITHUB_CUNY\Project_VMS\db\"
2 | :r $(path)\002_create_vehicles.sql
3 | :r $(path)\003_create_persons.sql
4 | :r $(path)\004_create_roles.sql
5 | :r $(path)\005_create_user_accounts.sql
6 | :r $(path)\006_create_requests.sql
7 | :r $(path)\007_create_passengers.sql
8 | :r $(path)\008_create_trips.sql
--------------------------------------------------------------------------------
/db/drop_tables.sql:
--------------------------------------------------------------------------------
1 | use vms
2 | go
3 |
4 | if object_id('dbo.passengers', 'U') is not null
5 | drop table dbo.passengers;
6 |
7 | if object_id('dbo.trips', 'U') is not null
8 | drop table dbo.trips;
9 |
10 | if object_id('dbo.requests', 'U') is not null
11 | drop table dbo.requests;
12 |
13 | if object_id('dbo.user_accounts', 'U') is not null
14 | drop table dbo.user_accounts;
15 |
16 | if object_id('dbo.roles', 'U') is not null
17 | drop table dbo.roles;
18 |
19 | if object_id('dbo.persons', 'U') is not null
20 | drop table dbo.persons;
21 |
22 | if object_id('dbo.vehicles', 'U') is not null
23 | drop table dbo.vehicles;
24 | go
25 |
26 |
--------------------------------------------------------------------------------
/doc/VMS-Process.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS-Process.png
--------------------------------------------------------------------------------
/doc/VMS-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS-logo.png
--------------------------------------------------------------------------------
/doc/VMS-screen-shots/VMS-01-Main-page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS-screen-shots/VMS-01-Main-page.png
--------------------------------------------------------------------------------
/doc/VMS-screen-shots/VMS-02-Users.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS-screen-shots/VMS-02-Users.png
--------------------------------------------------------------------------------
/doc/VMS-screen-shots/VMS-03-User-info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS-screen-shots/VMS-03-User-info.png
--------------------------------------------------------------------------------
/doc/VMS-screen-shots/VMS-04-Vehicles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS-screen-shots/VMS-04-Vehicles.png
--------------------------------------------------------------------------------
/doc/VMS-screen-shots/VMS-05-Vehicle-info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS-screen-shots/VMS-05-Vehicle-info.png
--------------------------------------------------------------------------------
/doc/VMS-screen-shots/VMS-06-Requests.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS-screen-shots/VMS-06-Requests.png
--------------------------------------------------------------------------------
/doc/VMS-screen-shots/VMS-07-Request-info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS-screen-shots/VMS-07-Request-info.png
--------------------------------------------------------------------------------
/doc/VMS-screen-shots/VMS-08-Trips.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS-screen-shots/VMS-08-Trips.png
--------------------------------------------------------------------------------
/doc/VMS-screen-shots/VMS-09-Trip-info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS-screen-shots/VMS-09-Trip-info.png
--------------------------------------------------------------------------------
/doc/VMS_UML_class_diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS_UML_class_diagram.png
--------------------------------------------------------------------------------
/doc/VMS_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemulare/Vehicle-Management-System/a35bc41be258e9f6c1abe75575997ca601598fce/doc/VMS_logo.png
--------------------------------------------------------------------------------
/vms.db/Mapping/Person.hbm.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/vms.db/Mapping/Request.hbm.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
25 |
27 |
29 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/vms.db/Mapping/Role.hbm.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/vms.db/Mapping/Trip.hbm.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/vms.db/Mapping/UserAccount.hbm.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
18 |
19 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/vms.db/Mapping/Vehicle.hbm.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/vms.db/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("vms.db")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("vms.db")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("10cedee9-06d7-41a2-8280-a9b465173322")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/vms.db/Services/PersistenceService.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using NHibernate.Cfg;
4 | using vms;
5 |
6 | namespace Vms.Db.Services
7 | {
8 | public class PersistenceService
9 | {
10 | ///
11 | /// Gets a collection of all entities from DB.
12 | ///
13 | /// A collection of all entities of the specified type in the database.
14 | public IList GetEntities() where T : PersistentEntity
15 | {
16 | var factory = new Configuration().Configure().BuildSessionFactory();
17 | using(var session = factory.OpenSession())
18 | {
19 | var criteria = session.CreateCriteria();
20 | return criteria.List();
21 | }
22 | }
23 |
24 |
25 |
26 | public T GetEntity(int id) where T : PersistentEntity
27 | {
28 | var entities = GetEntities();
29 | return entities.FirstOrDefault(item => item.getId() == id);
30 | }
31 |
32 |
33 |
34 | ///
35 | /// Saves the entity instance in the database.
36 | ///
37 | /// Persistent entity instance.
38 | public void Save(T entity) where T : PersistentEntity
39 | {
40 | var factory = new Configuration().Configure().BuildSessionFactory();
41 | using(var session = factory.OpenSession())
42 | using(var trans = session.BeginTransaction())
43 | {
44 | session.SaveOrUpdate(entity);
45 | trans.Commit();
46 | }
47 | }
48 |
49 |
50 |
51 | ///
52 | /// Deletes the persistent entity.
53 | ///
54 | /// Persistent entity instance.
55 | public void Delete(T entity) where T : PersistentEntity
56 | {
57 | var factory = new Configuration().Configure().BuildSessionFactory();
58 | using(var session = factory.OpenSession())
59 | using(var trans = session.BeginTransaction())
60 | {
61 | session.Delete(entity);
62 | trans.Commit();
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/vms.db/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/vms.db/vms.db.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {10CEDEE9-06D7-41A2-8280-A9B465173322}
8 | Library
9 | Properties
10 | Vms.Db
11 | vms.db
12 | v4.6
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 | x86
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 | ..\packages\Iesi.Collections.4.0.0.4000\lib\net40\Iesi.Collections.dll
36 | True
37 |
38 |
39 | ..\packages\NHibernate.4.0.4.4000\lib\net40\NHibernate.dll
40 | True
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | {ebf5ff94-cc19-4d70-8f94-518bc4e077aa}
55 | vms.model
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
81 |
--------------------------------------------------------------------------------
/vms.model/Address.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Address domain model.
3 | // Contains a personal address info.
4 | //=========================================================================================
5 | #include "Address.h"
6 |
7 | namespace vms
8 | {
9 | // Default constructor
10 | // No need to initialize all members explicitly here because there are no primitive types
11 | // defined in the Address class.
12 | // Default constructors called for non-primitive class members automatically.
13 | Address::Address()
14 | {
15 | }
16 |
17 |
18 | // Getter methods:
19 |
20 | // Returns an address line 1
21 | string Address::getStreetAddress1() { return _streetAddress1; }
22 |
23 | // Returns an address line 2
24 | string Address::getStreetAddress2() { return _streetAddress2; }
25 |
26 | // Returns a city
27 | string Address::getCity() { return _city; }
28 |
29 | // Returns a state code
30 | string Address::getState() { return _state; }
31 |
32 | // Returns a ZIP code value
33 | string Address::getZip() { return _zip; }
34 |
35 | // Setter methods:
36 |
37 | // Sets an address line 1
38 | void Address::setStreetAddress1(const string streetAddress1) { _streetAddress1 = streetAddress1; }
39 |
40 | // Sets an address line 2
41 | void Address::setStreetAddress2(const string streetAddress2) { _streetAddress2 = streetAddress2; }
42 |
43 | // Sets a city
44 | void Address::setCity(const string city) { _city = city; }
45 |
46 | // Sets a state code
47 | void Address::setState(const string state) { _state = state; }
48 |
49 | // Sets a ZIP code value
50 | void Address::setZip(const string zip) { _zip = zip; }
51 |
52 |
53 |
54 | // Returns a full address string combining all address parts
55 | string Address::getFullAddress()
56 | {
57 | return _streetAddress1 + " " + _streetAddress2 + " " +
58 | _city + " " + _state + ", " + _zip;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/vms.model/Address.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Address domain model.
3 | // Contains a personal address info.
4 | //=========================================================================================
5 | #pragma once
6 | #include "Stdafx.h"
7 |
8 | namespace vms
9 | {
10 | public ref class Address
11 | {
12 | public:
13 | Address();
14 |
15 | string getStreetAddress1();
16 | string getStreetAddress2();
17 | string getCity();
18 | string getState();
19 | string getZip();
20 | string getFullAddress();
21 |
22 | void setStreetAddress1(const string streetAddress1);
23 | void setStreetAddress2(const string streetAddress2);
24 | void setCity(const string city);
25 | void setState(const string state);
26 | void setZip(const string zip);
27 |
28 | private:
29 | string _streetAddress1;
30 | string _streetAddress2;
31 | string _city;
32 | string _state;
33 | string _zip;
34 | };
35 | }
36 |
--------------------------------------------------------------------------------
/vms.model/Administrator.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Administrator domain model.
3 | // Represents admin role in the system.
4 | //=========================================================================================
5 | #include "Administrator.h"
6 |
7 | namespace vms
8 | {
9 | // Determines whether a user with the given role can approve requests
10 | bool Administrator::canApproveRequests() { return true; }
11 |
12 | // Determines whether a user with the given role can register/edit vehicles info
13 | bool Administrator::canManageVehicles() { return true; }
14 |
15 | // Determines whether a user with the given role can register/edit user profiles
16 | bool Administrator::canManageUsers() { return true; }
17 |
18 | // Determines whether a user with the given role can check in/check out vehicles
19 | bool Administrator::canCheckInVehicles() { return true; }
20 |
21 | // Determines whether a user with the given role can lock/unlock vehicles
22 | bool Administrator::canLockVehicles() { return true; }
23 |
24 | // Determines whether a user with the given role can delete user accounts and personal info
25 | bool Administrator::canDeleteUsers() { return true; }
26 |
27 | // Determines whether a user with the given role can delete vehicles from the system
28 | bool Administrator::canDeleteVehicles() { return true; }
29 |
30 | // Determines whether a user with the given role can delete requests from the system
31 | bool Administrator::canDeleteRequests() { return true; }
32 | }
33 |
--------------------------------------------------------------------------------
/vms.model/Administrator.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Administrator domain model.
3 | // Represents admin role in the system.
4 | //=========================================================================================
5 | #pragma once
6 | #include "Stdafx.h"
7 | #include "Employee.h"
8 |
9 | namespace vms
10 | {
11 | public ref class Administrator : public Employee
12 | {
13 | public:
14 | virtual bool canApproveRequests() override;
15 | virtual bool canManageVehicles() override;
16 | virtual bool canManageUsers() override;
17 | virtual bool canCheckInVehicles() override;
18 | virtual bool canLockVehicles() override;
19 | virtual bool canDeleteUsers() override;
20 | virtual bool canDeleteVehicles() override;
21 | virtual bool canDeleteRequests() override;
22 | };
23 | }
24 |
--------------------------------------------------------------------------------
/vms.model/CargoCar.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // CargoCar domain model.
3 | // Represents a cargo car.
4 | // Inherited from OwnedVehicle class.
5 | //=========================================================================================
6 | #include "CargoCar.h"
7 |
8 | namespace vms
9 | {
10 | // Default constructor
11 | CargoCar::CargoCar() : _grossVehicleMass(0), _cargoType(CargoCarType::DELIVERY_VAN)
12 | {
13 | }
14 |
15 |
16 | // Copy constructor
17 | CargoCar::CargoCar(OwnedVehicle^ vehicle) : OwnedVehicle(vehicle),
18 | _grossVehicleMass(0), _cargoType(CargoCarType::DELIVERY_VAN)
19 | {
20 | }
21 |
22 |
23 |
24 | // Returns a gross vehicle mass
25 | int CargoCar::getGrossVehicleMass() { return _grossVehicleMass; }
26 |
27 | // Returns a cargo car type
28 | CargoCar::CargoCarType CargoCar::getCargoType() { return _cargoType; }
29 |
30 | // Sets a gross vehicle mass
31 | void CargoCar::setGrossVehicleMass(int gvm)
32 | {
33 | _grossVehicleMass = gvm;
34 | }
35 |
36 |
37 | // Sets a cargo car type
38 | void CargoCar::setCargoCarType(CargoCarType cargoType)
39 | {
40 | _cargoType = cargoType;
41 | }
42 |
43 |
44 | // Determines whether a vehicle is allowed for personal use
45 | bool CargoCar::allowForPersonalUse() { return false; }
46 | }
47 |
--------------------------------------------------------------------------------
/vms.model/CargoCar.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // CargoCar domain model.
3 | // Represents a cargo car.
4 | // Inherited from OwnedVehicle class.
5 | //=========================================================================================
6 | #pragma once
7 | #include "Stdafx.h"
8 | #include "OwnedVehicle.h"
9 |
10 | namespace vms
11 | {
12 | public ref class CargoCar : public OwnedVehicle
13 | {
14 | public:
15 | enum class CargoCarType { MINITRUCK, PICKUP, DELIVERY_VAN, BOX_TRUCK, DUMP_TRUCK,
16 | TANK_TRUCK, SEMI_TRAILER, FULL_TRAILER, REFRIDGERATOR };
17 |
18 | CargoCar();
19 | CargoCar(OwnedVehicle^ vehicle);
20 |
21 | int getGrossVehicleMass();
22 | CargoCarType getCargoType();
23 |
24 | void setGrossVehicleMass(int gvm);
25 | void setCargoCarType(CargoCarType cargoType);
26 |
27 | virtual bool allowForPersonalUse() override;
28 |
29 | private:
30 | int _grossVehicleMass; // same as gross vehicle weight rating (GVWR)
31 | CargoCarType _cargoType;
32 | };
33 | }
34 |
--------------------------------------------------------------------------------
/vms.model/Employee.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Employee domain model.
3 | // Represents a regular employee role (a base role implementation).
4 | //=========================================================================================
5 | #include "Employee.h"
6 |
7 | namespace vms
8 | {
9 | // Determines whether a user with the given role can approve requests
10 | bool Employee::canApproveRequests() { return false; }
11 |
12 | // Determines whether a user with the given role can register/edit vehicles info
13 | bool Employee::canManageVehicles() { return false; }
14 |
15 | // Determines whether a user with the given role can register/edit user profiles
16 | bool Employee::canManageUsers() { return false; }
17 |
18 | // Determines whether a user with the given role can check in/check out vehicles
19 | bool Employee::canCheckInVehicles() { return false; }
20 |
21 | // Determines whether a user with the given role can lock/unlock vehicles
22 | bool Employee::canLockVehicles() { return false; }
23 |
24 | // Determines whether a user with the given role can delete user accounts and personal info
25 | bool Employee::canDeleteUsers() { return false; }
26 |
27 | // Determines whether a user with the given role can delete vehicles from the system
28 | bool Employee::canDeleteVehicles() { return false; }
29 |
30 | // Determines whether a user with the given role can delete requests from the system
31 | bool Employee::canDeleteRequests() { return false; }
32 |
33 | // Returns role name
34 | string Employee::getRoleName() { return _roleName; }
35 | }
36 |
--------------------------------------------------------------------------------
/vms.model/Employee.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Employee domain model.
3 | // Represents a regular employee role (a base role implementation).
4 | //=========================================================================================
5 | #pragma once
6 | #include "Stdafx.h"
7 | #include "Role.h"
8 |
9 | namespace vms
10 | {
11 | public ref class Employee : public Role
12 | {
13 | public:
14 | virtual bool canApproveRequests() override;
15 | virtual bool canManageVehicles() override;
16 | virtual bool canManageUsers() override;
17 | virtual bool canCheckInVehicles() override;
18 | virtual bool canLockVehicles() override;
19 | virtual bool canDeleteUsers() override;
20 | virtual bool canDeleteVehicles() override;
21 | virtual bool canDeleteRequests() override;
22 |
23 | virtual string getRoleName() override;
24 |
25 | private:
26 | string _roleName;
27 | };
28 | }
29 |
--------------------------------------------------------------------------------
/vms.model/GarageAttendant.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // GarageAttendant domain model.
3 | // Represents a garage attendant person.
4 | //=========================================================================================
5 | #include "GarageAttendant.h"
6 |
7 | namespace vms
8 | {
9 | // Determines whether a user with the given role can check in/check out vehicles
10 | bool GarageAttendant::canCheckInVehicles() { return true; }
11 |
12 | // Determines whether a user with the given role can lock/unlock vehicles
13 | bool GarageAttendant::canLockVehicles() { return true; }
14 | }
15 |
--------------------------------------------------------------------------------
/vms.model/GarageAttendant.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // GarageAttendant domain model.
3 | // Represents a garage attendant person.
4 | //=========================================================================================
5 | #pragma once
6 | #include "Stdafx.h"
7 | #include "Employee.h"
8 |
9 | namespace vms
10 | {
11 | public ref class GarageAttendant : public Employee
12 | {
13 | public:
14 | virtual bool canCheckInVehicles() override;
15 | virtual bool canLockVehicles() override;
16 | };
17 | }
18 |
--------------------------------------------------------------------------------
/vms.model/Manager.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Manager domain model.
3 | // Represents a manager role in the system.
4 | //=========================================================================================
5 | #include "Manager.h"
6 |
7 | namespace vms
8 | {
9 | // Determines whether a user with the given role can approve requests
10 | bool Manager::canApproveRequests() { return true; }
11 |
12 | // Determines whether a user with the given role can lock/unlock vehicles
13 | bool Manager::canLockVehicles() { return true; }
14 | }
15 |
--------------------------------------------------------------------------------
/vms.model/Manager.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Manager domain model.
3 | // Represents a manager role in the system.
4 | //=========================================================================================
5 | #pragma once
6 | #include "Stdafx.h"
7 | #include "Employee.h"
8 |
9 | namespace vms
10 | {
11 | public ref class Manager : public Employee
12 | {
13 | public:
14 | virtual bool canApproveRequests() override;
15 | virtual bool canLockVehicles() override;
16 | };
17 | }
18 |
--------------------------------------------------------------------------------
/vms.model/OwnedVehicle.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // OwnedVehicle domain model.
3 | // An abstract class representing owned vehicle.
4 | // Contains vehicle assigned properties belong to owner.
5 | //=========================================================================================
6 | #include "OwnedVehicle.h"
7 |
8 | namespace vms
9 | {
10 | // Default constructor
11 | // All string members of the class automatically initialized by their default constructors
12 | OwnedVehicle::OwnedVehicle() : _mileage(0), _isAvailable(true)
13 | {
14 | }
15 |
16 |
17 | // Copy constructor
18 | OwnedVehicle::OwnedVehicle(OwnedVehicle^ vehicle) : Vehicle(vehicle),
19 | _plate(vehicle->_plate), _mileage(vehicle->_mileage), _isAvailable(vehicle->_isAvailable)
20 | {
21 | }
22 |
23 |
24 |
25 | // Getter methods:
26 |
27 | // Returns a plate number
28 | string OwnedVehicle::getPlate() { return _plate; }
29 |
30 | // Returns a current mileage value
31 | double OwnedVehicle::getMileage() { return _mileage; }
32 |
33 | // Determines whether a vehicle is available for requests
34 | bool OwnedVehicle::isAvailable() { return _isAvailable; }
35 |
36 |
37 | // Setter methods:
38 |
39 | // Sets a vehicle plate number
40 | void OwnedVehicle::setPlate(const string plate) { _plate = plate; }
41 |
42 | // Sets a vehicle mileage
43 | void OwnedVehicle::setMileage(double mileage) { _mileage = mileage; }
44 |
45 | // Locks a vehicle
46 | void OwnedVehicle::lock() { _isAvailable = false; }
47 |
48 | // Unlocks a vehicle
49 | void OwnedVehicle::unlock() { _isAvailable = true; }
50 | }
51 |
--------------------------------------------------------------------------------
/vms.model/OwnedVehicle.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // OwnedVehicle domain model.
3 | // An abstract class representing owned vehicle.
4 | // Contains vehicle assigned properties belong to owner.
5 | //=========================================================================================
6 | #pragma once
7 | #include "Stdafx.h"
8 | #include "Vehicle.h"
9 | #include "UserAccount.h"
10 |
11 | namespace vms
12 | {
13 | public ref class OwnedVehicle abstract : public Vehicle
14 | {
15 | protected:
16 | OwnedVehicle();
17 | OwnedVehicle(OwnedVehicle^ vehicle);
18 |
19 | public:
20 | string getPlate();
21 | double getMileage();
22 | bool isAvailable();
23 |
24 | void setPlate(const string plate);
25 | void setMileage(double mileage);
26 |
27 | virtual bool allowForPersonalUse() = 0;
28 |
29 | void lock();
30 | void unlock();
31 |
32 | private:
33 | string _plate; // plate number
34 | double _mileage;
35 | bool _isAvailable;
36 | };
37 | }
38 |
--------------------------------------------------------------------------------
/vms.model/PassengerCar.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // PassengerCar domain model.
3 | // Represents a passenger car.
4 | // Inherited from OwnedVehicle class.
5 | //=========================================================================================
6 | #include "PassengerCar.h"
7 |
8 | namespace vms
9 | {
10 | // Default constructor
11 | PassengerCar::PassengerCar() : _passCarType(PassengerCarType::SEDAN), _maxPassengers(0)
12 | {
13 | }
14 |
15 |
16 | // Copy constructor
17 | PassengerCar::PassengerCar(OwnedVehicle^ vehicle) : OwnedVehicle(vehicle),
18 | _passCarType(PassengerCarType::SEDAN), _maxPassengers(0)
19 | {
20 | }
21 |
22 |
23 |
24 | // Returns a max number of passengers
25 | int PassengerCar::getMaxPassengers() { return _maxPassengers; }
26 |
27 |
28 | // Returns a passenger car type
29 | PassengerCar::PassengerCarType PassengerCar::getPassengerCarType()
30 | {
31 | return _passCarType;
32 | }
33 |
34 |
35 | // Sets a max number of passengers
36 | void PassengerCar::setMaxPassengers(int passengersNumber)
37 | {
38 | _maxPassengers = passengersNumber;
39 | }
40 |
41 |
42 | // Sets a passenger car type
43 | void PassengerCar::setPassengerCarType(PassengerCarType passCarType)
44 | {
45 | _passCarType = passCarType;
46 | }
47 |
48 |
49 | // Determines whether a vehicle is allowed for personal use
50 | bool PassengerCar::allowForPersonalUse() { return true; }
51 | }
52 |
--------------------------------------------------------------------------------
/vms.model/PassengerCar.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // PassengerCar domain model.
3 | // Represents a passenger car.
4 | // Inherited from OwnedVehicle class.
5 | //=========================================================================================
6 | #pragma once
7 | #include "Stdafx.h"
8 | #include "OwnedVehicle.h"
9 |
10 | namespace vms
11 | {
12 | public ref class PassengerCar : public OwnedVehicle
13 | {
14 | public:
15 | enum class PassengerCarType { SEDAN, COUPE, SUV, HATCHBACK, CROSSOVER, MINIVAN,
16 | PASSENGER_VAN, MINIBUS, COACH };
17 |
18 | PassengerCar();
19 | PassengerCar(OwnedVehicle^ vehicle);
20 |
21 | int getMaxPassengers();
22 | void setMaxPassengers(int passengersNumber);
23 |
24 | PassengerCarType getPassengerCarType();
25 | void setPassengerCarType(PassengerCarType carType);
26 |
27 | virtual bool allowForPersonalUse() override;
28 |
29 | private:
30 | int _maxPassengers;
31 | PassengerCarType _passCarType;
32 | };
33 | }
34 |
--------------------------------------------------------------------------------
/vms.model/PersistentEntity.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Database persisted entity.
3 | // A base abstract class for all persistent entities.
4 | // All model classes stored to a database should be inherited from PersistentEntity.
5 | //=========================================================================================
6 | #pragma once
7 | #include "Stdafx.h"
8 |
9 | namespace vms
10 | {
11 | public ref class PersistentEntity abstract
12 | {
13 | protected:
14 | PersistentEntity() : _id(0) {} // protected constructor
15 |
16 | public:
17 | int getId() { return _id; } // returns the object ID
18 |
19 | private:
20 | int _id; // unique object ID (generated by DB infrastructure)
21 | };
22 | }
23 |
--------------------------------------------------------------------------------
/vms.model/Person.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Person domain model.
3 | // Contains a personal data of users or passengers.
4 | //=========================================================================================
5 | #include "Person.h"
6 |
7 | namespace vms
8 | {
9 | // Default constructor
10 | // No need to initialize all other members explicitly here because there are no primitive types
11 | // defined in the Person class.
12 | // Default constructors called for non-primitive class members automatically.
13 | Person::Person() : _ageCategory(AgeCategory::ADULT)
14 | {
15 | // The memory for Address type allocated in the managed heap (no need to call delete further)
16 | _address = gcnew Address();
17 | }
18 |
19 |
20 | // Destructor
21 | // No need to call delete for _address here because it is managed code with GC
22 | Person::~Person()
23 | {
24 | _address = nullptr;
25 | }
26 |
27 |
28 | // Getter methods:
29 |
30 | // Returns a first name
31 | string Person::getFirstName() { return _firstName; }
32 |
33 | // Returns a last name
34 | string Person::getLastName() { return _lastName; }
35 |
36 | // Returns a full person name as first name + last name concatenation
37 | string Person::getFullName() { return _lastName + ", " + _firstName; }
38 |
39 | // Returns a date of birth
40 | Nullable Person::getDOB() { return _dob; }
41 |
42 | // Returns a person age category
43 | Person::AgeCategory Person::getAgeCategory() { return _ageCategory; }
44 |
45 | // Returns a person address instance
46 | Address^ Person::getAddress() { return _address; }
47 |
48 | // Returns a phone number
49 | string Person::getPhoneNumber() { return _phoneNumber; }
50 |
51 | // Returns an email address
52 | string Person::getEmail() { return _email; }
53 |
54 | // Returns a driver license
55 | string Person::getDriverLicense() { return _driverLicense; }
56 |
57 | // Returns a request insurance
58 | string Person::getInsurance() { return _insurance; }
59 |
60 |
61 | // Setter methods:
62 |
63 | // Sets a first name
64 | void Person::setFirstName(const string firstName) { _firstName = firstName; }
65 |
66 | // Sets a last name
67 | void Person::setLastName(const string lastName) { _lastName = lastName; }
68 |
69 | // Sets a date of birth
70 | void Person::setDOB(const Nullable dob) { _dob = dob; }
71 |
72 | // Sets a person age category
73 | void Person::setAgeCategory(const Person::AgeCategory ageCategory)
74 | {
75 | _ageCategory = ageCategory;
76 | }
77 |
78 | // Sets a phone number
79 | void Person::setPhoneNumber(const string phoneNumber) { _phoneNumber = phoneNumber; }
80 |
81 | // Sets an email address
82 | void Person::setEmail(const string email) { _email = email; }
83 |
84 | // Sets a driver license
85 | void Person::setDriverLicense(const string driverLicense) { _driverLicense = driverLicense; }
86 |
87 | // Sets a request insurance
88 | void Person::setInsurance(const string insurance) { _insurance = insurance; }
89 | }
90 |
--------------------------------------------------------------------------------
/vms.model/Person.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Person domain model.
3 | // Contains a personal data of users or passengers.
4 | //=========================================================================================
5 | #pragma once
6 | #include "Stdafx.h"
7 | #include "PersistentEntity.h"
8 | #include "Address.h"
9 |
10 | namespace vms
11 | {
12 | public ref class Person : public PersistentEntity
13 | {
14 | public:
15 | enum class AgeCategory { ADULT, MINOR };
16 |
17 | Person();
18 | virtual ~Person();
19 |
20 | string getFirstName();
21 | string getLastName();
22 | string getFullName();
23 | Nullable getDOB();
24 | AgeCategory getAgeCategory();
25 |
26 | Address^ getAddress();
27 | string getPhoneNumber();
28 | string getEmail();
29 | string getDriverLicense();
30 | string getInsurance();
31 |
32 | void setFirstName(const string firstName);
33 | void setLastName(const string lastName);
34 | void setDOB(const Nullable dob);
35 | void setAgeCategory(AgeCategory ageCategory);
36 | void setPhoneNumber(const string phoneNumber);
37 | void setEmail(const string email);
38 | void setDriverLicense(const string driverLicense);
39 | void setInsurance(const string insurance);
40 |
41 | private:
42 | string _firstName;
43 | string _lastName;
44 | Nullable _dob;
45 | AgeCategory _ageCategory;
46 |
47 | Address^ _address;
48 | string _phoneNumber;
49 | string _email;
50 | string _driverLicense;
51 | string _insurance;
52 | };
53 | }
54 |
--------------------------------------------------------------------------------
/vms.model/Request.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Request domain model.
3 | // Represents a request for company vehicle
4 | //=========================================================================================
5 | #include "Request.h"
6 |
7 | namespace vms
8 | {
9 | // Default constructor (used only by NHibernate infrastructure)
10 | Request::Request() : Request("", nullptr, nullptr)
11 | {
12 | }
13 |
14 |
15 | // Constructor
16 | Request::Request(const string requestId, const UserAccount^ requestor, OwnedVehicle^ vehicle)
17 | : _requestId(requestId), _requestor(requestor), _vehicle(vehicle), _forPersonalUse(false),
18 | _status(RequestStatus::INITIAL)
19 | {
20 | _passengers = gcnew List();
21 | _submittedAt = DateTime::Now;
22 | }
23 |
24 |
25 | // Destructor
26 | Request::~Request()
27 | {
28 | _passengers->Clear();
29 | }
30 |
31 |
32 | // Getter methods:
33 |
34 | // Returns a request ID
35 | string Request::getRequestId() { return _requestId; }
36 |
37 | // Returns a requested vehicle
38 | OwnedVehicle^ Request::getVehicle() { return _vehicle; }
39 |
40 | // Returns a request status
41 | Request::RequestStatus Request::getStatus() { return _status; }
42 |
43 | // Returns a request purpose
44 | string Request::getPurpose() { return _purpose; }
45 |
46 | // Returns a request designation
47 | string Request::getDestination() { return _destination; }
48 |
49 | // Returns a request content inventory
50 | string Request::getContentInventory() { return _contentInventory; }
51 |
52 | // Returns a planned trip start date and time
53 | DateTime Request::getPlannedTripStart() { return _plannedTripStart; }
54 |
55 | // Returns a planned trip end date and time
56 | DateTime Request::getPlannedTripEnd() { return _plannedTripEnd; }
57 |
58 | // Determines whether a request is intended for personal use
59 | bool Request::isForPersonalUse() { return _forPersonalUse; }
60 |
61 | // Returns a requested driver
62 | const UserAccount^ Request::getDriver() { return _driver; }
63 |
64 | // Returns a list of passenders
65 | const IList^ Request::getPassengers() { return _passengers; }
66 |
67 | // Returns a date when a request was submitted
68 | DateTime Request::getSubmittedAt() { return _submittedAt; }
69 |
70 | // Returns a requestor who submitted the request
71 | const UserAccount^ Request::getRequestor() { return _requestor; }
72 |
73 | // Determines whether a request is approved
74 | bool Request::isApproved() { return _status == RequestStatus::APPROVED; }
75 |
76 | // Returns a date when a request was approved
77 | Nullable Request::getApprovedAt() { return _approvedAt; }
78 |
79 | // Returns a user who approved the request
80 | const UserAccount^ Request::getApprover() { return _approver; }
81 |
82 |
83 | // Setter methods:
84 |
85 |
86 | // Sets a request ID.
87 | void Request::setRequestId(string requestId) { _requestId = requestId; }
88 |
89 | // Sets a vehicle for the request
90 | void Request::setVehicle(OwnedVehicle^ vehicle) { _vehicle = vehicle; }
91 |
92 | // Sets a requestor for the request
93 | void Request::setRequestor(const UserAccount^ requestor) { _requestor = requestor; }
94 |
95 | // Sets a request purpose
96 | void Request::setPurpose(const string purpose) { _purpose = purpose; }
97 |
98 | // Sets a request destination
99 | void Request::setDestination(const string destination) { _destination = destination; }
100 |
101 | // Sets a request content inventory
102 | void Request::setContentInventory(const string contentInventory) { _contentInventory = contentInventory; }
103 |
104 | // Sets a planned start date and time
105 | void Request::setPlannedTripStart(DateTime plannedTripStart) { _plannedTripStart = plannedTripStart; }
106 |
107 | // Sets a planned end date and time
108 | void Request::setPlannedTripEnd(DateTime plannedTripEnd) { _plannedTripEnd = plannedTripEnd; }
109 |
110 | // Sets the personal use flag
111 | void Request::setForPersonalUse(bool forPersonalUse) { _forPersonalUse = forPersonalUse; }
112 |
113 | // Sets a requested driver
114 | void Request::setDriver(const UserAccount^ driver) { _driver = driver; }
115 |
116 | // Adds a passenger
117 | void Request::addPassenger(const Person^ passenger) { _passengers->Add(passenger); }
118 |
119 | // Removes a passenger
120 | void Request::removePassenger(const Person^ passenger) { _passengers->Remove(passenger); }
121 |
122 | // Cleara a list of passengers
123 | void Request::clearPassengers() { _passengers->Clear(); }
124 |
125 |
126 | // Approves a request
127 | void Request::approve(const UserAccount^ approver)
128 | {
129 | _approver = approver;
130 | _approvedAt = DateTime::Now;
131 | _vehicle->lock();
132 | _status = RequestStatus::APPROVED;
133 | }
134 |
135 |
136 | // Declines a request
137 | void Request::decline()
138 | {
139 | _vehicle->unlock();
140 | _status = RequestStatus::DECLINED;
141 | }
142 |
143 |
144 | // Completes a request
145 | void Request::complete(double actualMileage)
146 | {
147 | _vehicle->unlock();
148 | _vehicle->setMileage(_vehicle->getMileage() + actualMileage);
149 | _status = RequestStatus::COMPLETED;
150 | }
151 |
152 |
153 | // Cancels a request
154 | void Request::cancel()
155 | {
156 | _vehicle->unlock();
157 | _status = RequestStatus::CANCELED;
158 | }
159 | }
160 |
--------------------------------------------------------------------------------
/vms.model/Request.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Request domain model.
3 | // Represents a request for company vehicle
4 | //=========================================================================================
5 | #pragma once
6 | #include "Stdafx.h"
7 | #include "PersistentEntity.h"
8 | #include "UserAccount.h"
9 | #include "OwnedVehicle.h"
10 |
11 | namespace vms
12 | {
13 | public ref class Request : public PersistentEntity
14 | {
15 | public:
16 | // Available request statuses
17 | enum class RequestStatus { INITIAL, APPROVED, DECLINED, COMPLETED, CANCELED };
18 |
19 | Request();
20 | Request(const string requestId, const UserAccount^ requestor, OwnedVehicle^ vehicle);
21 | ~Request();
22 |
23 | string getRequestId();
24 | OwnedVehicle^ getVehicle();
25 | RequestStatus getStatus();
26 |
27 | string getPurpose();
28 | string getDestination();
29 | string getContentInventory();
30 |
31 | DateTime getPlannedTripStart();
32 | DateTime getPlannedTripEnd();
33 | bool isForPersonalUse();
34 | bool isApproved();
35 |
36 | const UserAccount^ getDriver();
37 | const IList^ getPassengers();
38 |
39 | DateTime getSubmittedAt();
40 | const UserAccount^ getRequestor();
41 | Nullable getApprovedAt();
42 | const UserAccount^ getApprover();
43 |
44 | void setRequestId(string requestId);
45 | void setVehicle(OwnedVehicle^ vehicle);
46 | void setRequestor(const UserAccount^ requestor);
47 |
48 | void setPurpose(const string purpose);
49 | void setDestination(const string destination);
50 | void setContentInventory(const string contentInventory);
51 |
52 | void setPlannedTripStart(DateTime plannedTripStart);
53 | void setPlannedTripEnd(DateTime plannedTripEnd);
54 | void setForPersonalUse(bool forPersonalUse);
55 |
56 | void setDriver(const UserAccount^ driver);
57 | void addPassenger(const Person^ passenger);
58 | void removePassenger(const Person^ passenger);
59 | void clearPassengers();
60 |
61 | void approve(const UserAccount^ approver);
62 | void decline();
63 | void complete(double actualMileage);
64 | void cancel();
65 |
66 | private:
67 | string _requestId;
68 | OwnedVehicle^ _vehicle;
69 | RequestStatus _status;
70 |
71 | string _purpose;
72 | string _destination;
73 | string _contentInventory;
74 |
75 | DateTime _plannedTripStart;
76 | DateTime _plannedTripEnd;
77 | bool _forPersonalUse;
78 |
79 | const UserAccount^ _driver;
80 | IList^ _passengers;
81 |
82 | DateTime _submittedAt;
83 | const UserAccount^ _requestor;
84 |
85 | Nullable _approvedAt;
86 | const UserAccount^ _approver;
87 | };
88 | }
89 |
--------------------------------------------------------------------------------
/vms.model/Role.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Role domain model.
3 | // A base abstract class for available user roles hierarchy.
4 | // Determines available permissions for users.
5 | // All user role classes should be inherited from Role.
6 | //=========================================================================================
7 | #pragma once
8 | #include "Stdafx.h"
9 | #include "PersistentEntity.h"
10 |
11 | namespace vms
12 | {
13 | public ref class Role abstract : public PersistentEntity
14 | {
15 | public:
16 | virtual bool canApproveRequests() = 0;
17 | virtual bool canManageVehicles() = 0;
18 | virtual bool canManageUsers() = 0;
19 | virtual bool canCheckInVehicles() = 0;
20 | virtual bool canLockVehicles() = 0;
21 | virtual bool canDeleteUsers() = 0;
22 | virtual bool canDeleteVehicles() = 0;
23 | virtual bool canDeleteRequests() = 0;
24 |
25 | virtual string getRoleName() = 0;
26 | };
27 | }
28 |
--------------------------------------------------------------------------------
/vms.model/Stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently,
3 | // but are changed infrequently
4 | #pragma once
5 |
6 | typedef System::String^ string;
7 |
8 | using namespace System;
9 | using namespace System::Collections::Generic;
10 |
--------------------------------------------------------------------------------
/vms.model/Trip.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Trip domain model.
3 | // Represents an actual trip info.
4 | //=========================================================================================
5 | #include "Trip.h"
6 |
7 | namespace vms
8 | {
9 | // Default constructor (required by Nhibernate library)
10 | Trip::Trip() : Trip(nullptr)
11 | {
12 | }
13 |
14 |
15 | // Constructor
16 | Trip::Trip(Request^ request) : _request(request), _mileage(0), _fuelCost(0)
17 | {
18 | }
19 |
20 |
21 | // Returns a request instance
22 | Request^ Trip::getRequest() { return _request; }
23 |
24 | // Returns a time when the request is actually started
25 | DateTime Trip::getStartedAt() { return _startedAt; }
26 |
27 | // Returns a time when the request is actually finished
28 | Nullable Trip::getFinishedAt() { return _finishedAt; }
29 |
30 | // Returns the actual trip mileage
31 | double Trip::getMileage() { return _mileage; }
32 |
33 | // Returns the actual tip fuel cost
34 | double Trip::getFuelCost() { return _fuelCost; }
35 |
36 | // Sets a request for the trip
37 | void Trip::setRequest(Request^ request) { _request = request; }
38 |
39 | // Sets a trip actual start date
40 | void Trip::setStartedAt(DateTime startedAt) { _startedAt = startedAt; }
41 |
42 | // Sets a trip actual finish date
43 | void Trip::setFinishedAt(Nullable finishedAt) { _finishedAt = finishedAt; }
44 |
45 | // Sets an actual mileage
46 | void Trip::setMileage(double mileage) { _mileage = mileage; }
47 |
48 | // Sets an actual fuel cost
49 | void Trip::setFuelCost(double fuelCost) { _fuelCost = fuelCost; }
50 |
51 |
52 | // Performs a trip check out (starts a trip)
53 | void Trip::checkOut()
54 | {
55 | _startedAt = DateTime::Now;
56 | }
57 |
58 |
59 | // Performs a trip check in (ends a trip)
60 | void Trip::checkIn(double actualMileage, double fuelCost)
61 | {
62 | _finishedAt = DateTime::Now;
63 | _mileage = actualMileage;
64 | _fuelCost = fuelCost;
65 | _request->complete(actualMileage);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/vms.model/Trip.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Trip domain model.
3 | // Represents an actual trip info.
4 | //=========================================================================================
5 | #pragma once
6 | #include "Stdafx.h"
7 | #include "Request.h"
8 |
9 | namespace vms
10 | {
11 | public ref class Trip : public PersistentEntity
12 | {
13 | public:
14 | Trip();
15 | Trip(Request^ request);
16 |
17 | Request^ getRequest();
18 | DateTime getStartedAt();
19 | Nullable getFinishedAt();
20 |
21 | double getMileage();
22 | double getFuelCost();
23 |
24 | void setRequest(Request^ request);
25 | void setStartedAt(DateTime startedAt);
26 | void setFinishedAt(Nullable finishedAt);
27 |
28 | void setMileage(double mileage);
29 | void setFuelCost(double fuelCost);
30 |
31 | void checkOut();
32 | void checkIn(double actualMileage, double fuelCost);
33 |
34 | private:
35 | Request^ _request;
36 |
37 | DateTime _startedAt;
38 | Nullable _finishedAt;
39 |
40 | double _mileage;
41 | double _fuelCost;
42 | };
43 | }
44 |
--------------------------------------------------------------------------------
/vms.model/UserAccount.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // User account domain model.
3 | // Contains a user account and role related into.
4 | //=========================================================================================
5 | #include "UserAccount.h"
6 | #include "Employee.h"
7 |
8 | namespace vms
9 | {
10 | // Default constructor
11 | UserAccount::UserAccount() : UserAccount("", "", gcnew Employee(), gcnew Person())
12 | {
13 | }
14 |
15 |
16 | // Constructor
17 | // The memory for Employee and Person types allocated in the managed heap
18 | UserAccount::UserAccount(const string userId, const string password)
19 | : UserAccount(userId, password, gcnew Employee(), gcnew Person())
20 | {
21 | }
22 |
23 |
24 | // Constructor
25 | // The memory for Person type allocated in the managed heap
26 | UserAccount::UserAccount(const string userId, const string password, Role^ role)
27 | : UserAccount(userId, password, role, gcnew Person())
28 | {
29 | }
30 |
31 |
32 | // Constructor
33 | // The memory for Employee type allocated in the managed heap
34 | UserAccount::UserAccount(const string userId, const string password, Person^ person)
35 | : UserAccount(userId, password, gcnew Employee(), person)
36 | {
37 | }
38 |
39 |
40 | // Constructor
41 | UserAccount::UserAccount(const string userId, const string password, Role^ role, Person^ person)
42 | : _userId(userId), _password(password), _role(role), _person(person), _locked(false)
43 | {
44 | }
45 |
46 |
47 | // Destructor
48 | // No need to call delete for _role and _person here because it is managed code
49 | UserAccount::~UserAccount()
50 | {
51 | _role = nullptr;
52 | _person = nullptr;
53 | }
54 |
55 |
56 | // Getter methods:
57 |
58 | // Returns a user ID (login)
59 | string UserAccount::getUserId() { return _userId; }
60 |
61 | // Returns a user password
62 | string UserAccount::getPassword() { return _password; }
63 |
64 | // Returns a user role
65 | Role^ UserAccount::getRole() { return _role; }
66 |
67 | // Returns a personal user info
68 | Person^ UserAccount::getPerson() { return _person; }
69 |
70 | // Setter methods:
71 |
72 | // Sets user ID (login)
73 | void UserAccount::setUserId(const string userId) { _userId = userId; }
74 |
75 | // Sets the password
76 | void UserAccount::setPassword(const string password) { _password = password; }
77 |
78 | // Sets a user role
79 | void UserAccount::setRole(Role^ role)
80 | {
81 | _role = role;
82 | }
83 |
84 |
85 | // Performs a user authentication
86 | bool UserAccount::authenticate(const string password)
87 | {
88 | return _password == password;
89 | }
90 |
91 |
92 | // Determines whether the user is locked
93 | bool UserAccount::isLocked() { return _locked; }
94 |
95 | // Locks a user account
96 | void UserAccount::lock() { _locked = true; }
97 |
98 | // Unlock a user account
99 | void UserAccount::unlock() { _locked = false; }
100 | }
101 |
--------------------------------------------------------------------------------
/vms.model/UserAccount.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // User account domain model.
3 | // Contains a user account and role related into.
4 | //=========================================================================================
5 | #pragma once
6 | #include "Stdafx.h"
7 | #include "PersistentEntity.h"
8 | #include "Person.h"
9 | #include "Role.h"
10 |
11 | namespace vms
12 | {
13 | public ref class UserAccount : public PersistentEntity
14 | {
15 | public:
16 | UserAccount(); // Need default constructor because it requested by DB layer.
17 | UserAccount(const string userId, const string password);
18 | UserAccount(const string userId, const string password, Role^ role);
19 | UserAccount(const string userId, const string password, Person^ person);
20 | UserAccount(const string userId, const string password, Role^ role, Person^ person);
21 | ~UserAccount();
22 |
23 | string getUserId();
24 | string getPassword();
25 | Role^ getRole();
26 | Person^ getPerson();
27 |
28 | void setUserId(const string userId);
29 | void setPassword(const string password);
30 | void setRole(Role^ role);
31 |
32 | bool authenticate(const string password);
33 | bool isLocked();
34 | void lock();
35 | void unlock();
36 |
37 | private:
38 | string _userId;
39 | string _password;
40 | bool _locked;
41 |
42 | Person^ _person;
43 | Role^ _role;
44 | };
45 | }
46 |
--------------------------------------------------------------------------------
/vms.model/UtilityCar.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // UtilityCar domain model.
3 | // Represents an utility car.
4 | // Inherited from OwnedVehicle class.
5 | //=========================================================================================
6 | #include "UtilityCar.h"
7 |
8 | namespace vms
9 | {
10 | // Default constructor
11 | UtilityCar::UtilityCar() : _utilityCarType(UtilityCarType::GARBAGE_TRUCK)
12 | {
13 | }
14 |
15 |
16 | // Copy constructor
17 | UtilityCar::UtilityCar(OwnedVehicle^ vehicle) : OwnedVehicle(vehicle),
18 | _utilityCarType(UtilityCarType::GARBAGE_TRUCK)
19 | {
20 | }
21 |
22 |
23 |
24 | // Returns an utility car type
25 | UtilityCar::UtilityCarType UtilityCar::getUtilityCarType()
26 | {
27 | return _utilityCarType;
28 | }
29 |
30 |
31 | // Sets an utility car type
32 | void UtilityCar::setUtilityCarType(UtilityCarType utilityType)
33 | {
34 | _utilityCarType = utilityType;
35 | }
36 |
37 |
38 | // Determines whether a vehicle is allowed for personal use
39 | bool UtilityCar::allowForPersonalUse() { return false; }
40 | }
41 |
--------------------------------------------------------------------------------
/vms.model/UtilityCar.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // UtilityCar domain model.
3 | // Represents an utility car.
4 | // Inherited from OwnedVehicle class.
5 | //=========================================================================================
6 | #pragma once
7 | #include "Stdafx.h"
8 | #include "OwnedVehicle.h"
9 |
10 | namespace vms
11 | {
12 | public ref class UtilityCar : public OwnedVehicle
13 | {
14 | public:
15 | enum class UtilityCarType { TOW_TRUCK, PLOW_TRUCK, SWEEPER_TRUCK, GARBAGE_TRUCK};
16 |
17 | UtilityCar();
18 | UtilityCar(OwnedVehicle^ vehicle);
19 |
20 | UtilityCarType getUtilityCarType();
21 | void setUtilityCarType(UtilityCarType utilityType);
22 |
23 | virtual bool allowForPersonalUse() override;
24 |
25 | private:
26 | UtilityCarType _utilityCarType;
27 | };
28 | }
29 |
--------------------------------------------------------------------------------
/vms.model/Vehicle.cpp:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Vehicle domain model.
3 | // A base abstract class for all kind of vehicles.
4 | // Contains vehicle manufacturer properties.
5 | //=========================================================================================
6 | #include "Vehicle.h"
7 |
8 | namespace vms
9 | {
10 | // Default constructor
11 | // All string members of the class automatically initialized by their default constructors
12 | Vehicle::Vehicle() : _fuelType(FuelType::GASOLINE), _transmission(Transmission::AUTOMATIC),
13 | _yearManufactured(0), _sweptVolume(0), _fuelTankCapacity(0)
14 | {
15 | }
16 |
17 |
18 | // Copy constructor
19 | Vehicle::Vehicle(Vehicle^ vehicle) : _vin(vehicle->_vin), _maker(vehicle->_maker),
20 | _model(vehicle->_model), _fuelType(vehicle->_fuelType), _transmission(vehicle->_transmission),
21 | _yearManufactured(vehicle->_yearManufactured), _sweptVolume(vehicle->_sweptVolume),
22 | _fuelTankCapacity(vehicle->_fuelTankCapacity), _color(vehicle->_color)
23 | {
24 | }
25 |
26 |
27 |
28 | // Getter methods:
29 |
30 | // Returns VIN number
31 | string Vehicle::getVIN() { return _vin; }
32 |
33 | // Returns a vehicle maker
34 | string Vehicle::getMaker() { return _maker; }
35 |
36 | // Returns a vehicle model
37 | string Vehicle::getModel() { return _model; }
38 |
39 | // Returns a vehicle fuel type
40 | Vehicle::FuelType Vehicle::getFuelType() { return _fuelType; }
41 |
42 | // Returns a vehicle transmission type
43 | Vehicle::Transmission Vehicle::getTransmission() { return _transmission; }
44 |
45 | // Returns a year when a vehicle was manufactured
46 | int Vehicle::getYearManufactured() { return _yearManufactured; }
47 |
48 | // Returns a vehicle engine volume
49 | double Vehicle::getSweptVolume() { return _sweptVolume; }
50 |
51 | // Returns a vehicle fuel tank capacity
52 | double Vehicle::getFuelTankCapacity() { return _fuelTankCapacity; }
53 |
54 | // Returns a vehicle color
55 | string Vehicle::getColor() { return _color; }
56 |
57 |
58 |
59 | // Setter methods:
60 |
61 | // Sets a vehicle VIN number
62 | void Vehicle::setVIN(const string vin) { _vin = vin; }
63 |
64 | // Sets a vehicle maker
65 | void Vehicle::setMaker(const string maker) { _maker = maker; }
66 |
67 | // Sets a vehicle model
68 | void Vehicle::setModel(const string model) { _model = model; }
69 |
70 | // Sets a vehicle fuel type
71 | void Vehicle::setFuelType(FuelType fuel) { _fuelType = fuel; }
72 |
73 | // Sets a vehicle transmission type
74 | void Vehicle::setTransmission(Transmission transmission) { _transmission = transmission; }
75 |
76 | // Sets a year when a vehicle was manufactured
77 | void Vehicle::setYearManufactured(int year) { _yearManufactured = year; }
78 |
79 | // Sets a vehicle engine volume
80 | void Vehicle::setSweptVolume(double sweptVolume) { _sweptVolume = sweptVolume; }
81 |
82 | // Sets a vehicle fuel tank capacity
83 | void Vehicle::setFuelTankCapacity(double tankCapacity) { _fuelTankCapacity = tankCapacity; }
84 |
85 | // Sets a vehicle color
86 | void Vehicle::setColor(const string color) { _color = color; }
87 |
88 |
89 | // Vehicle string representation
90 | string Vehicle::toString()
91 | {
92 | return _maker + " " + _model;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/vms.model/Vehicle.h:
--------------------------------------------------------------------------------
1 | //=========================================================================================
2 | // Vehicle domain model.
3 | // A base abstract class for all kind of vehicles.
4 | // Contains vehicle manufacturer properties.
5 | //=========================================================================================
6 | #pragma once
7 | #include "Stdafx.h"
8 | #include "PersistentEntity.h"
9 |
10 | namespace vms
11 | {
12 | public ref class Vehicle abstract : public PersistentEntity
13 | {
14 | public:
15 | // Available vehicle fuel types
16 | enum class FuelType { GASOLINE, DIESEL, BIODIESEL, ELECTRICITY, ETHANOL, HYBRID, LIQUEFIED_PETROLEUM };
17 | // Available vehicle transmission types
18 | enum class Transmission { AUTOMATIC, SEMI_AUTOMATIC, MANUAL, ELECTRIC_VARIABLE, CONTINUOUSLY_VARIABLE };
19 |
20 | protected:
21 | Vehicle();
22 | Vehicle(Vehicle^ vehicle);
23 |
24 | public:
25 | string getVIN();
26 | string getMaker();
27 | string getModel();
28 | FuelType getFuelType();
29 | Transmission getTransmission();
30 | int getYearManufactured();
31 | double getSweptVolume();
32 | double getFuelTankCapacity();
33 | string getColor();
34 |
35 | void setVIN(const string vin);
36 | void setMaker(const string maker);
37 | void setModel(const string model);
38 | void setFuelType(FuelType fuel);
39 | void setTransmission(Transmission transmission);
40 | void setYearManufactured(int year);
41 | void setSweptVolume(double sweptVolume);
42 | void setFuelTankCapacity(double tankCapacity);
43 | void setColor(const string color);
44 |
45 | string toString();
46 |
47 | private:
48 | string _vin; // vehicle identification number
49 | string _maker;
50 | string _model;
51 | FuelType _fuelType;
52 | Transmission _transmission;
53 | int _yearManufactured;
54 | double _sweptVolume; // car engine size
55 | double _fuelTankCapacity; // fuel tank size
56 | string _color;
57 | };
58 | }
59 |
--------------------------------------------------------------------------------
/vms.model/vms.model.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {dfc1cddd-659c-4a99-83e4-d4be2bef2098}
18 |
19 |
20 | {c001b32b-2138-4d3e-bb50-45c013d9be22}
21 |
22 |
23 |
24 |
25 | Source Files\Model
26 |
27 |
28 | Source Files\Model
29 |
30 |
31 | Source Files\Model
32 |
33 |
34 | Source Files\Model
35 |
36 |
37 | Source Files\Model
38 |
39 |
40 | Source Files\Model
41 |
42 |
43 | Source Files\Model
44 |
45 |
46 | Source Files\Model
47 |
48 |
49 | Source Files\Model
50 |
51 |
52 | Source Files\Model
53 |
54 |
55 | Source Files\Model
56 |
57 |
58 | Source Files\Model
59 |
60 |
61 | Source Files\Model
62 |
63 |
64 | Source Files\Model
65 |
66 |
67 |
68 |
69 | Header Files
70 |
71 |
72 | Header Files\Model
73 |
74 |
75 | Header Files\Model
76 |
77 |
78 | Header Files\Model
79 |
80 |
81 | Header Files\Model
82 |
83 |
84 | Header Files\Model
85 |
86 |
87 | Header Files\Model
88 |
89 |
90 | Header Files\Model
91 |
92 |
93 | Header Files\Model
94 |
95 |
96 | Header Files\Model
97 |
98 |
99 | Header Files\Model
100 |
101 |
102 | Header Files\Model
103 |
104 |
105 | Header Files\Model
106 |
107 |
108 | Header Files\Model
109 |
110 |
111 | Header Files\Model
112 |
113 |
114 | Header Files\Model
115 |
116 |
117 | Header Files\Model
118 |
119 |
120 |
--------------------------------------------------------------------------------
/vms.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vms.model", "vms.model\vms.model.vcxproj", "{EBF5FF94-CC19-4D70-8F94-518BC4E077AA}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vms.view", "vms.view\vms.view.csproj", "{9341104C-0CAC-4E56-9D91-708FF7F55D12}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vms.db", "vms.db\vms.db.csproj", "{10CEDEE9-06D7-41A2-8280-A9B465173322}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Debug|x64 = Debug|x64
16 | Debug|x86 = Debug|x86
17 | Release|Any CPU = Release|Any CPU
18 | Release|x64 = Release|x64
19 | Release|x86 = Release|x86
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {EBF5FF94-CC19-4D70-8F94-518BC4E077AA}.Debug|Any CPU.ActiveCfg = Debug|Win32
23 | {EBF5FF94-CC19-4D70-8F94-518BC4E077AA}.Debug|Any CPU.Build.0 = Debug|Win32
24 | {EBF5FF94-CC19-4D70-8F94-518BC4E077AA}.Debug|x64.ActiveCfg = Debug|Win32
25 | {EBF5FF94-CC19-4D70-8F94-518BC4E077AA}.Debug|x64.Build.0 = Debug|Win32
26 | {EBF5FF94-CC19-4D70-8F94-518BC4E077AA}.Debug|x86.ActiveCfg = Debug|x64
27 | {EBF5FF94-CC19-4D70-8F94-518BC4E077AA}.Debug|x86.Build.0 = Debug|x64
28 | {EBF5FF94-CC19-4D70-8F94-518BC4E077AA}.Release|Any CPU.ActiveCfg = Release|Win32
29 | {EBF5FF94-CC19-4D70-8F94-518BC4E077AA}.Release|x64.ActiveCfg = Release|x64
30 | {EBF5FF94-CC19-4D70-8F94-518BC4E077AA}.Release|x64.Build.0 = Release|x64
31 | {EBF5FF94-CC19-4D70-8F94-518BC4E077AA}.Release|x86.ActiveCfg = Release|Win32
32 | {EBF5FF94-CC19-4D70-8F94-518BC4E077AA}.Release|x86.Build.0 = Release|Win32
33 | {9341104C-0CAC-4E56-9D91-708FF7F55D12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34 | {9341104C-0CAC-4E56-9D91-708FF7F55D12}.Debug|Any CPU.Build.0 = Debug|Any CPU
35 | {9341104C-0CAC-4E56-9D91-708FF7F55D12}.Debug|x64.ActiveCfg = Debug|Any CPU
36 | {9341104C-0CAC-4E56-9D91-708FF7F55D12}.Debug|x64.Build.0 = Debug|Any CPU
37 | {9341104C-0CAC-4E56-9D91-708FF7F55D12}.Debug|x86.ActiveCfg = Debug|Any CPU
38 | {9341104C-0CAC-4E56-9D91-708FF7F55D12}.Debug|x86.Build.0 = Debug|Any CPU
39 | {9341104C-0CAC-4E56-9D91-708FF7F55D12}.Release|Any CPU.ActiveCfg = Release|Any CPU
40 | {9341104C-0CAC-4E56-9D91-708FF7F55D12}.Release|Any CPU.Build.0 = Release|Any CPU
41 | {9341104C-0CAC-4E56-9D91-708FF7F55D12}.Release|x64.ActiveCfg = Release|Any CPU
42 | {9341104C-0CAC-4E56-9D91-708FF7F55D12}.Release|x64.Build.0 = Release|Any CPU
43 | {9341104C-0CAC-4E56-9D91-708FF7F55D12}.Release|x86.ActiveCfg = Release|Any CPU
44 | {9341104C-0CAC-4E56-9D91-708FF7F55D12}.Release|x86.Build.0 = Release|Any CPU
45 | {10CEDEE9-06D7-41A2-8280-A9B465173322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46 | {10CEDEE9-06D7-41A2-8280-A9B465173322}.Debug|Any CPU.Build.0 = Debug|Any CPU
47 | {10CEDEE9-06D7-41A2-8280-A9B465173322}.Debug|x64.ActiveCfg = Debug|Any CPU
48 | {10CEDEE9-06D7-41A2-8280-A9B465173322}.Debug|x64.Build.0 = Debug|Any CPU
49 | {10CEDEE9-06D7-41A2-8280-A9B465173322}.Debug|x86.ActiveCfg = Debug|Any CPU
50 | {10CEDEE9-06D7-41A2-8280-A9B465173322}.Debug|x86.Build.0 = Debug|Any CPU
51 | {10CEDEE9-06D7-41A2-8280-A9B465173322}.Release|Any CPU.ActiveCfg = Release|Any CPU
52 | {10CEDEE9-06D7-41A2-8280-A9B465173322}.Release|Any CPU.Build.0 = Release|Any CPU
53 | {10CEDEE9-06D7-41A2-8280-A9B465173322}.Release|x64.ActiveCfg = Release|Any CPU
54 | {10CEDEE9-06D7-41A2-8280-A9B465173322}.Release|x64.Build.0 = Release|Any CPU
55 | {10CEDEE9-06D7-41A2-8280-A9B465173322}.Release|x86.ActiveCfg = Release|Any CPU
56 | {10CEDEE9-06D7-41A2-8280-A9B465173322}.Release|x86.Build.0 = Release|Any CPU
57 | EndGlobalSection
58 | GlobalSection(SolutionProperties) = preSolution
59 | HideSolutionNode = FALSE
60 | EndGlobalSection
61 | EndGlobal
62 |
--------------------------------------------------------------------------------
/vms.view/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | NHibernate.Dialect.MsSql2005Dialect
10 | NHibernate.Connection.DriverConnectionProvider
11 | Server=localhost; Initial Catalog=vms; Integrated Security=SSPI
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/vms.view/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/vms.view/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace Vms.Views
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/vms.view/Components/Border.xaml:
--------------------------------------------------------------------------------
1 |
8 |
11 |
12 |
13 |
29 |
30 |
31 |
32 |
33 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/vms.view/Components/Brushes.xaml:
--------------------------------------------------------------------------------
1 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/vms.view/Components/CommonStyles.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
22 |
23 |
24 |
25 |
42 |
43 |
44 |
45 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/vms.view/Components/ErrorTemplate.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/vms.view/Components/GroupBox.xaml:
--------------------------------------------------------------------------------
1 |
8 |
11 |
12 |
13 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/vms.view/Components/TabItem.xaml:
--------------------------------------------------------------------------------
1 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
123 |
124 |
125 |
126 |
127 |
137 |
138 |
139 |
--------------------------------------------------------------------------------
/vms.view/Components/TextBlock.xaml:
--------------------------------------------------------------------------------
1 |
8 |
11 |
12 |
13 |
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
31 |
32 |
36 |
37 |
38 |
39 |
40 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/vms.view/Components/TextBoxExtensions.cs:
--------------------------------------------------------------------------------
1 | //=================================================================================================
2 | // Class TextBoxExtensions.
3 | // TextBox extension methods and attached properties .
4 | // Provides the set of extension methods of System.Windows.Controls.TextBox class.
5 | //=================================================================================================
6 | using System;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 |
10 | namespace Vms.Views
11 | {
12 | ///
13 | /// TextBox extension methods.
14 | ///
15 | ///
16 | /// Provides the set of extension methids of class.
17 | ///
18 | public static class TextBoxExtensions
19 | {
20 | #region Public Static Extension Methods.
21 |
22 | ///
23 | /// Updates the binded source property (Text) of the specified TextBox control.
24 | ///
25 | /// TextBox control instance.
26 | public static void UpdateSource(this TextBox control)
27 | {
28 | if(control == null)
29 | throw new ArgumentNullException(nameof(control));
30 | control.UpdateSource(TextBox.TextProperty);
31 | }
32 |
33 | #endregion
34 |
35 |
36 | #region Properties.
37 |
38 | ///
39 | /// Gets the Watermark property value.
40 | ///
41 | /// Target textbox.
42 | public static string GetWatermark(TextBox obj)
43 | {
44 | return (string)obj.GetValue(WatermarkProperty);
45 | }
46 |
47 |
48 |
49 | ///
50 | /// Sets the Watermark property value.
51 | ///
52 | /// Target object.
53 | /// New value.
54 | public static void SetWatermark(TextBox obj, string value)
55 | {
56 | obj.SetValue(WatermarkProperty, value);
57 | }
58 |
59 |
60 |
61 | ///
62 | /// Identifies the Watermark attached property.
63 | ///
64 | public static readonly DependencyProperty WatermarkProperty =
65 | DependencyProperty.RegisterAttached("Watermark", typeof(string), typeof(TextBoxExtensions));
66 |
67 |
68 |
69 | ///
70 | /// Gets the WatermarkEnabled property value.
71 | ///
72 | /// Target textbox.
73 | public static bool GetWatermarkEnabled(TextBox obj)
74 | {
75 | return (bool)obj.GetValue(WatermarkEnabledProperty);
76 | }
77 |
78 |
79 |
80 | ///
81 | /// Sets the WatermarkEnabled property value.
82 | ///
83 | /// Target textbox.
84 | /// New value.
85 | public static void SetWatermarkEnabled(TextBox obj, bool value)
86 | {
87 | obj.SetValue(WatermarkEnabledProperty, value);
88 | }
89 |
90 |
91 |
92 | ///
93 | /// Identifies the WatermarkEnabled attached property.
94 | ///
95 | public static readonly DependencyProperty WatermarkEnabledProperty =
96 | DependencyProperty.RegisterAttached("WatermarkEnabled", typeof(bool), typeof(TextBoxExtensions), new PropertyMetadata(false));
97 |
98 |
99 |
100 | ///
101 | /// Gets the OverlayText property value.
102 | ///
103 | /// Target textbox.
104 | public static bool GetOverlayText(TextBox obj)
105 | {
106 | return (bool)obj.GetValue(OverlayTextProperty);
107 | }
108 |
109 |
110 |
111 | ///
112 | /// Sets the OverlayText property value.
113 | ///
114 | /// Target textbox
115 | /// New value.
116 | public static void SetOverlayText(TextBox obj, bool value)
117 | {
118 | obj.SetValue(OverlayTextProperty, value);
119 | }
120 |
121 |
122 |
123 | ///
124 | /// Identifies the OverlayText attached property.
125 | ///
126 | public static readonly DependencyProperty OverlayTextProperty =
127 | DependencyProperty.RegisterAttached("OverlayText", typeof(bool), typeof(TextBoxExtensions), new PropertyMetadata(false));
128 |
129 | #endregion
130 |
131 | ///
132 | /// Updates the source property of the specified WPF element.
133 | ///
134 | /// WPF framework element instance.
135 | /// The specified dependency property to update source.
136 | public static void UpdateSource(this TextBox element, DependencyProperty property)
137 | {
138 | if(element == null)
139 | throw new ArgumentNullException(nameof(element));
140 | if(property == null)
141 | throw new ArgumentNullException(nameof(property));
142 |
143 | var bindingExpression = element.GetBindingExpression(property);
144 | bindingExpression?.UpdateSource();
145 | }
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/vms.view/Components/ToolTip.xaml:
--------------------------------------------------------------------------------
1 |
8 |
11 |
12 |
13 |
23 |
24 |
--------------------------------------------------------------------------------
/vms.view/Controllers/DelegateCommand.cs:
--------------------------------------------------------------------------------
1 | //=================================================================================================
2 | // Class DelegateCommand.
3 | // WPF Command.
4 | // Allows to inject command logic via delegates passed into its constructor.
5 | //===-=============================================================================================
6 | using System;
7 | using System.Windows.Input;
8 |
9 | namespace Vms.ViewModels
10 | {
11 | ///
12 | /// WPF Command.
13 | /// Allows to inject command logic via delegates passed into its constructor.
14 | ///
15 | public sealed class DelegateCommand : ICommand
16 | {
17 | #region Private members
18 |
19 | // Defines the method to be called when the command is invoked.
20 | private readonly Action