-
Notifications
You must be signed in to change notification settings - Fork 0
/
Admin_UpdatePricing.cs
141 lines (99 loc) · 4.18 KB
/
Admin_UpdatePricing.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
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;
namespace Movie_Ticketing_System
{
public partial class Admin_UpdatePricing : 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";
public Admin_UpdatePricing()
{
InitializeComponent();
SqlConnection connection = new SqlConnection(ConnectionString);
connection.Open();
string query = "SELECT ChildTicket,StandardMember,SilverMember,PlatinumMember,DiamondMember from TicketPricing";
SqlCommand command = new SqlCommand(query, connection);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
ChildLabel.Text = reader[0].ToString();
StandardLabel.Text = reader[1].ToString();
SilverLabel.Text = reader[2].ToString();
PlatinumLabel.Text = reader[3].ToString();
DiamondLabel.Text = reader[4].ToString();
}
connection.Close();
}
private void Next_button_Click(object sender, EventArgs e)
{
SqlConnection connection = new SqlConnection(ConnectionString);
connection.Open();
string Query = "UPDATE TicketPricing SET ChildTicket=@Child,StandardMember=@Standard,SilverMember=@siler,PlatinumMember=@Plat,DiamondMember=@Diamond";
SqlCommand command = new SqlCommand(Query, connection);
command.Parameters.AddWithValue("@Child", textBox1.Text);
command.Parameters.AddWithValue("@Standard", textBox2.Text);
command.Parameters.AddWithValue("@siler", textBox3.Text);
command.Parameters.AddWithValue("@Plat", textBox4.Text);
command.Parameters.AddWithValue("@Diamond", textBox5.Text);
command.ExecuteNonQuery();
connection.Close();
connection.Open();
string query = "SELECT ChildTicket,StandardMember,SilverMember,PlatinumMember,DiamondMember from TicketPricing";
command = new SqlCommand(query, connection);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
ChildLabel.Text = reader[0].ToString();
StandardLabel.Text = reader[1].ToString();
SilverLabel.Text = reader[2].ToString();
PlatinumLabel.Text = reader[3].ToString();
DiamondLabel.Text = reader[4].ToString();
}
connection.Close();
textBox1.Text = String.Empty;
textBox2.Text = String.Empty;
textBox3.Text = String.Empty;
textBox4.Text = String.Empty;
textBox5.Text = String.Empty;
MessageBox.Show("Prices Updated Successfully!", "Updated");
}
private void label5_Click(object sender, EventArgs e)
{
}
private void pictureBox6_Click(object sender, EventArgs e)
{
Form1 Home = new Form1();
Home.Show();
this.Hide();
}
private void pictureBox3_Click(object sender, EventArgs e)
{
Admin_Page admin = new Admin_Page();
admin.Show();
this.Hide();
}
private void pictureBox7_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)
{
Admin_Login login = new Admin_Login();
login.Show();
this.Hide();
}
else
{
}
}
}
}