-
Notifications
You must be signed in to change notification settings - Fork 1
/
Ticket_Front_End.cs
60 lines (56 loc) · 2.12 KB
/
Ticket_Front_End.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
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 MySql.Data.MySqlClient;
namespace OOP_Front_End
{
public partial class Ticket_Front_End : Form
{
Ticket t1 = new Ticket();
public Ticket_Front_End()
{
InitializeComponent();
}
private void buttonticketadd_Click(object sender, EventArgs e)
{
this.Hide();
t1.ticket_no = textBoxticketno.Text;
t1.ticket_type = tickettype.Text;
t1.payment = textBoxpaymebt.Text;
// t1.no_of_passengers = int.Parse(textBoxnoofpassengers.Text);
MySqlConnection con = new MySqlConnection("datasource=localhost; username=root; password=; database = oop");
string insertquery = "Insert into oop.customer_details( Ticket_No,No_of_Passenger,Payment,Ticket_type) VALUES('" + t1.ticket_no + "','" + t1.no_of_passengers + "','" + t1.payment + "','" + t1.ticket_type + "') ;";
}
private void label1_Click(object sender, EventArgs e)
{
}
private void delete_Click(object sender, EventArgs e)
{
try
{
string MyConnection2 = "datasource=localhost; username=root; password=; database = oop";
string Query = "delete from customer_details where Ticket_No='" + this.textBoxticketno.Text + "';";
MySqlConnection MyConn2 = new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();
MyReader2 = MyCommand2.ExecuteReader();
MessageBox.Show("Data Deleted");
while (MyReader2.Read())
{
}
MyConn2.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}