-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVehicleRecord.cs
96 lines (83 loc) · 2.52 KB
/
VehicleRecord.cs
1
2
3
4
5
6
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
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
using System;
using Ex03.GarageLogic.Exceptions;
namespace Ex03.GarageLogic
{
public class VehicleRecord
{
private string m_VehicleOwnerName;
private string m_VehicleOwnerPhoneNumber;
private eVehicleStatus m_VehicleInGarageStatus;
private Vehicle m_VehicleOnRecord;
public VehicleRecord(string i_VehicleOwnerName, string i_VehicleOwnerPhoneNumber)
{
m_VehicleInGarageStatus = eVehicleStatus.UnderRepairs;
if(i_VehicleOwnerName.Equals(string.Empty) || i_VehicleOwnerPhoneNumber.Equals(string.Empty))
{
throw new ArgumentException();
}
m_VehicleOwnerName = i_VehicleOwnerName;
m_VehicleOwnerPhoneNumber = i_VehicleOwnerPhoneNumber;
}
public string OwnersName
{
get
{
return m_VehicleOwnerName;
}
set
{
m_VehicleOwnerName = value;
}
}
public string OwnerPhoneNumber
{
get
{
return m_VehicleOwnerPhoneNumber;
}
set
{
m_VehicleOwnerPhoneNumber = value;
}
}
public Vehicle ReferenceToVehicle
{
get
{
return m_VehicleOnRecord;
}
set
{
m_VehicleOnRecord = value;
}
}
public eVehicleStatus CurrentVehicleStatus
{
get
{
return m_VehicleInGarageStatus;
}
set
{
if((value <= (eVehicleStatus)3) && (value >= (eVehicleStatus)1))
{
m_VehicleInGarageStatus = value;
}
else
{
throw new ValueOutOfRangeException(3, 1);
}
}
}
public enum eVehicleStatus
{
UnderRepairs = 1,
Fixed = 2,
PaidFor = 3
}
public override string ToString()
{
return string.Format("{0}Vehicle Owner Name : {1} Phone Number : {2} Vehicle Status in the garage : {3}{4}", Environment.NewLine, m_VehicleOwnerName.ToString(), m_VehicleOwnerPhoneNumber.ToString(), m_VehicleInGarageStatus, Environment.NewLine);
}
}
}