-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProceed_Form.cs
167 lines (120 loc) · 4.59 KB
/
Proceed_Form.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
165
166
167
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.IO;
namespace Movie_Ticketing_System
{
public partial class Proceed_Form : Form
{
String ConnectionString = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Ali Khattak\Documents\Visual Studio 2013\Projects\Movie Ticketing System\Movie Ticketing System\CinemaTicketing_DBS.mdf;Integrated Security=True";
int UserID;
int MoveID;
int TicketNUmber;
int NumberTickets;
public Proceed_Form(int CMTSID,int MID,int tickerNum)
{
InitializeComponent();
UserID = CMTSID;
MoveID = MID;
TicketNUmber = tickerNum;
SqlConnection connection = new SqlConnection(ConnectionString);
connection.Open();
string query = "SELECT LTRIM(RTRIM(Name)),MovieImage from Movies WHERE MID=@MovieID";
SqlCommand command = new SqlCommand(query, connection);
command.Parameters.AddWithValue("@MovieID", MID);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
ShowName_Label.Text = reader[0].ToString();
ProceedfromPIC.Image = byteArrayToImage((byte[])reader[1]);
}
reader.Close();
query = "SELECT LTRIM(RTRIM(Name)) from UserPage WHERE CMTS_ID=@CMTS";
command = new SqlCommand(query, connection);
command.Parameters.AddWithValue("@CMTS", UserID);
reader = command.ExecuteReader();
while (reader.Read())
{
Username_Label.Text = reader[0].ToString();
}
reader.Close();
query = "SELECT FamilyType,Num_Tickets,TimeSelected,BookingDate,TotalBill from TicketBooking WHERE TicketNumber=@tickerNum";
command = new SqlCommand(query, connection);
command.Parameters.AddWithValue("@tickerNum", TicketNUmber);
reader = command.ExecuteReader();
while (reader.Read())
{
FamilyTypeLabel.Text = reader[0].ToString();
NumberTickets = int.Parse(reader[1].ToString());
ShowTImeLabel.Text = reader[2].ToString();
ShowDateLabel.Text = reader[3].ToString();
TotalPaymentLabel.Text = reader[4].ToString();
}
NumberTicketsLabel.Text = NumberTickets.ToString();
connection.Close();
}
public Image byteArrayToImage(byte[] byteArrayIn)
{
MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;
}
private void Back_btn_Confirm_Click(object sender, EventArgs e)
{
}
private void Home_btn_Confirm_Click(object sender, EventArgs e)
{
Form1 first = new Form1();
first.Show();
this.Hide();
}
private void Proceed_PaymentButton_Click(object sender, EventArgs e)
{
Payment_Selection payment = new Payment_Selection(UserID, MoveID,TicketNUmber,NumberTickets);
payment.Show();
this.Hide();
}
private void pictureBox5_Click(object sender, EventArgs e)
{
Form1 Home = new Form1();
Home.Show();
this.Hide();
}
private void pictureBox2_Click(object sender, EventArgs e)
{
MessageBox.Show("Something Went Wrong!", "Error");
}
private void pictureBox4_Click(object sender, EventArgs e)
{
string message = "Are You Sure You Want to Logout?";
string title = "Log Out";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result = MessageBox.Show(message, title, buttons);
if (result == DialogResult.Yes)
{
Customer_Login customer = new Customer_Login();
customer.Show();
this.Show();
}
else
{
}
}
private void label3_Click(object sender, EventArgs e)
{
}
private void panel2_Paint(object sender, PaintEventArgs e)
{
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
}
}
}