-
Notifications
You must be signed in to change notification settings - Fork 1
/
Bookings.cs
38 lines (29 loc) · 1.09 KB
/
Bookings.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Cyanair_Airline_Booking_System
{
public class Bookings : PassengerDetails
{
public string BookingReference = "";
public DateTime DateOfBooking;
//Inheriting PassengerDetails Class
//public PassengerDetails PassengerDetails;
public string CreateNewBookingReference()
{
//This generates the day the booking was booked !!!
var dateAndTime = DateTime.Now;
int year = dateAndTime.Year;
int month = dateAndTime.Month;
int day = dateAndTime.Day;
//CY01012020-00000 FORMAT OF BOOKING REF !
System.Random rand = new System.Random((int)System.DateTime.Now.Ticks);
int random = rand.Next(1, 1000000);
this.BookingReference = random.ToString();
BookingReference = "CY" + day + month + year + "-" + BookingReference;
return BookingReference;
}
}
}