-
Notifications
You must be signed in to change notification settings - Fork 0
/
OrderClass.cs
164 lines (142 loc) · 3.94 KB
/
OrderClass.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
using System;
namespace Flight_Ticket_Booking
{
public class OrderClass
{
private string senderId;
private int cardNo;
private int receiverId;
private int amount;
private int unitPrice;
private double total_charge;
DateTime time_sent;
DateTime time_received;
//Constructor. Sets initial values of the order
public OrderClass(string sId, int cNo, int rId, int amt, int uPrice)
{
this.senderId = sId;
this.CardNo = cNo;
this.receiverId = rId;
this.amount = amt;
this.unitPrice = uPrice;
this.time_received = DateTime.Now;
this.time_sent = DateTime.Now;
this.total_charge = 0.0;
}
public OrderClass()
{
}
// Order is printed when the confirmation is sent back from the Order Processing Class
public void printOrder()
{
TimeSpan time = (this.time_received - this.Time_sent);
string interval = time.Seconds + "." + time.Milliseconds;
Console.WriteLine(
"\n\n------------------------ORDER CONFIRMATION:--------------------------- \n"+
" {0, -25} {1} \n"+
" {2, -25} {3} \n"+
" {4, -25} {5} \n"+
" {6, -25} {7} \n"+
" {8, -25} {9} \n"+
" {10, -25} {11} \n"+
" {12, -25} {13:C} \n" +
"----------------------------------------------------------------------\n\n",
"Travel Agent ID: ",this.senderId,
"Credit Card Number: ",this.CardNo,
"Airline ID: ",this.receiverId,
"Total tickets bought: ",this.amount,
"Ticket Price: ",this.unitPrice,
"Time to Order: (seconds) ",interval,
"Total Sale Price: ", total_charge);
}
// Getters and Setters
public string SenderId
{
get
{
return senderId;
}
set
{
senderId = value;
}
}
public int ReceiverId
{
get
{
return receiverId;
}
set
{
receiverId = value;
}
}
public int Amount
{
get
{
return amount;
}
set
{
amount = value;
}
}
public int UnitPrice
{
get
{
return unitPrice;
}
set
{
unitPrice = value;
}
}
public int CardNo
{
get
{
return cardNo;
}
set
{
cardNo = value;
}
}
public DateTime Time_sent
{
get
{
return time_sent;
}
set
{
time_sent = value;
}
}
public DateTime Time_received
{
get
{
return time_received;
}
set
{
time_received = value;
}
}
public double Total_charge
{
get
{
return total_charge;
}
set
{
total_charge = value;
}
}
}
}