-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm3.cs
118 lines (94 loc) · 2.89 KB
/
Form3.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace JAT_AIR_Airline_Form
{
public partial class Form3 : Form
{
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=""C:\Users\tnt52\source\repos\JAT-AIR Airline Form\FlightReservationDB.mdf"";Integrated Security=True");
//Creation of Form2 Object
Form2 f2;
//Form 3 Constructor
public Form3(Form2 frm2)
{
InitializeComponent();
this.f2 = frm2;
}
private void label1_Click(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
private void label7_Click(object sender, EventArgs e)
{
}
//Initializes Several Form3 Controls with Form 2 Control Values as soon as the Form Loads
private void Form3_Load(object sender, EventArgs e)
{
PassengerFirstName.Text = f2.FirstNameTextBox.Text;
PassengerLastName.Text = f2.LastNameTextBox.Text;
PassengerDestination.Text = f2.DestinationComboBox.Text;
PassengerFlightDate.Text = f2.FlightDatePicker.Text;
PassengerSeatinPreference.Text = f2.SeatingPreferenceComboBox.Text;
PassengerSeatingNumber.Text = f2.SeatingNumberTextBox.Text;
//Calculations
TotalTickCostBefTax.Text = f2.TotalTicketCostbefTax.ToString("C2");
TotalTicketCostAfterTax.Text = f2.TotalTicketCostAfterTax.ToString("C2");
//Show Greetings at Top
label1.Text = "Hi " + f2.FirstNameTextBox.Text + ", Here are your Flight Reservation Details: ";
}
private void PassengerFirstName_Click(object sender, EventArgs e)
{
}
//Allows Passenger Record to be seen using an Sql Adapter
private void ShowRecord_Click(object sender, EventArgs e)
{
try
{
SqlCommand cmd = new SqlCommand("SELECT TOP 1 * FROM ReservedPassengerInfoTable ORDER BY passenger_id DESC", con);
con.Open();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
con.Close();
dataGridView1.DataSource = dt;
}
catch (Exception err)
{
MessageBox.Show(err.Message, "Error Message");
}
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void label10_Click(object sender, EventArgs e)
{
}
private void TotalTickCostBefTax_Click(object sender, EventArgs e)
{
}
//Exit Button
private void button1_Click(object sender, EventArgs e)
{
DialogResult confirm = MessageBox.Show("Are you sure you want to exit?", "Exit Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (confirm == DialogResult.Yes)
{
Application.Exit();
}
}
private void label9_Click(object sender, EventArgs e)
{
}
}
}