-
Notifications
You must be signed in to change notification settings - Fork 0
/
Payment.cs
75 lines (66 loc) · 2.1 KB
/
Payment.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
using System;
using System.Collections.Generic;
using System.Text;
namespace SEAssignment
{
public class Payment
{
// properties
private DateTime purchaseDate;
private int price;
private string paymentMode;
private string purchaseType;
private SeasonPass seasonPass; // 1 to many association SeasonPass
// getter setter method for properties
public DateTime PurchaseDate
{
get { return purchaseDate; }
set { purchaseDate = value; }
}
public int Price
{
get { return price; }
set { price = value; }
}
public string PaymentMode
{
get { return paymentMode; }
set { paymentMode = value; }
}
public string PurchaseType
{
get { return purchaseType; }
set { purchaseType = value; }
}
public SeasonPass SeasonPass {
get { return seasonPass; }
set {
if (seasonPass != value) {
seasonPass = value;
value.AddPayment(this);
}
}
}
public Payment() { }
public Payment(DateTime pd, int p, string pm, string pt, SeasonPass sp) {
purchaseDate = pd;
price = p;
paymentMode = pm; //credit, visa
purchaseType = pt; // type of trasaction - SeasonPass - Car, SeasonPass - Motorbike, SeasonPass - Lorry
sp.AddPayment(this);
}
public Payment(DateTime pd, int p, string pm, string pt) //used for recording the transaction of payment for non season pass payments
{
purchaseDate = pd;
price = p;
paymentMode = pm; //credit, visa
purchaseType = pt; // type of trasaction - Sheltered Lot/ Unsheltered Lot
}
public void makePayment()
{
//implementation for payment method
Console.WriteLine("Your selected payment mode is {0}", paymentMode);
Console.WriteLine();
}
}
}