You are on page 1of 11

Reservation

Imports MySql.Data.MySqlClient
Public Class Reservation

Private Sub button3_Click(sender As Object, e As EventArgs)


Handles button3.Click
Home.Show()
Me.Hide()
textBox1.Clear()
textBox2.Clear()
textBox3.Clear()

textBox5.Clear()
textBox6.Clear()

textBox9.Clear()
textBox10.Clear()
textBox11.Clear()
textBox12.Clear()
textBox13.Clear()
End Sub

Private Sub button1_Click(sender As Object, e As EventArgs)


Handles button1.Click
Try
Dim cn As New MySqlConnection
Dim cmd As New MySqlCommand
cn.ConnectionString = "Server=localhost; user id=root;
password=Syed; database = airline;pooling=false"
cmd.Connection = cn
cn.Open()
cmd.CommandText = "Insert into Reservation(Name, Email,
Reservedate, Passportno, passportstatus, Issuedate, Expirydate, class,
Flightno, Flighttype, origin, Destination) Values('" & textBox2.Text &
"','" & textBox3.Text & "','" & DateTimePicker1.Text & "','" &
textBox5.Text & "','" & textBox6.Text & "','" & DateTimePicker2.Text &
"','" & DateTimePicker3.Text & "','" & textBox9.Text & "','" &
textBox10.Text & "','" & textBox11.Text & "','" & textBox12.Text &
"','" & textBox13.Text & "')"
If (textBox2.Text = "" Or textBox3.Text = "" Or
DateTimePicker1.Text = "" Or textBox5.Text = "" Or textBox6.Text = ""
Or DateTimePicker2.Text = "" Or DateTimePicker3.Text = "" Or
textBox9.Text = "" Or textBox10.Text = "" Or textBox11.Text = "" Or
textBox12.Text = "" Or textBox13.Text = "") Then
MessageBox.Show("Please enter all the details")
Else
cmd.ExecuteNonQuery()
MsgBox("Information Successfully stored!... PNR_No
will be send to your Email or Mobile", MsgBoxStyle.Information,
"saving data Succeed")
textBox2.Clear()
textBox3.Clear()

textBox5.Clear()
textBox6.Clear()

textBox9.Clear()
textBox10.Clear()
textBox11.Clear()
textBox12.Clear()
textBox13.Clear()
End If
cn.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs)


Handles Button2.Click
Dim cn As New MySqlConnection
Dim cmd As New MySqlCommand
cn.ConnectionString = "Server=localhost; user id=root;
password=Syed; database = airline"
cmd.Connection = cn
cn.Open()
If textBox3.Text = "" Then
MsgBox("please select an email to update")
Else
cmd.CommandText = "update Reservation set Name='" &
textBox2.Text & "',Email= '" & textBox3.Text & "',Reservedate='" &
DateTimePicker1.Text & "',Passportno='" & textBox5.Text &
"',Passportstatus='" & textBox6.Text & "',Issuedate='" &
DateTimePicker2.Text & "',Expirydate='" & DateTimePicker3.Text &
"',Class='" & textBox9.Text & "',Flightno='" & textBox10.Text &
"',Flighttype='" & textBox11.Text & "',origin='" & textBox12.Text &
"',destination='" & textBox13.Text & "'"
If (textBox2.Text = "" Or textBox3.Text = "" Or
DateTimePicker1.Text = "" Or textBox5.Text = "" Or textBox6.Text = ""
Or DateTimePicker2.Text = "" Or DateTimePicker3.Text = "" Or
textBox9.Text = "" Or textBox10.Text = "" Or textBox11.Text = "" Or
textBox12.Text = "" Or textBox13.Text = "") Then
MessageBox.Show("Invalid")
Else
cmd.ExecuteNonQuery()
MsgBox("Record Successfully Updated!",
MsgBoxStyle.Information, "saving data succeed")
textBox1.Clear()
textBox2.Clear()
textBox3.Clear()

textBox5.Clear()
textBox6.Clear()

textBox9.Clear()
textBox10.Clear()
textBox11.Clear()
textBox12.Clear()
textBox13.Clear()
cn.Close()
End If
End If
cn.Close()
End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs)


Handles Button4.Click
Dim cn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim dr As MySqlDataReader
cn.ConnectionString = "Server=localhost; user id=root;
password=Syed; database = airline"
cmd.Connection = cn
cn.Open()
cmd.CommandText = ("select * from Reservation where PNR_No='"
+ textBox1.Text + "'")
dr = cmd.ExecuteReader

If dr.Read Then
textBox1.Text = dr.GetValue(0)
textBox2.Text = dr.GetValue(1)
textBox3.Text = dr.GetValue(2)
DateTimePicker1.Text = dr.GetValue(3)
textBox5.Text = dr.GetValue(4)
textBox6.Text = dr.GetValue(5)
DateTimePicker2.Text = dr.GetValue(6)
DateTimePicker3.Text = dr.GetValue(7)
textBox9.Text = dr.GetValue(8)
textBox10.Text = dr.GetValue(9)
textBox11.Text = dr.GetValue(10)
textBox12.Text = dr.GetValue(11)
textBox13.Text = dr.GetValue(12)
Else
MsgBox("record not found")
End If
cn.Close()

End Sub

Private Sub Reservation_Load(sender As Object, e As EventArgs)


Handles MyBase.Load

End Sub
End Class

Profile

Imports MySql.Data.MySqlClient
Public Class Profile
Dim cn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim dr As MySqlDataReader

Private Sub button3_Click(sender As Object, e As EventArgs)


Handles button3.Click
Home.Show()
Me.Hide()
textBox1.Clear()
textBox2.Clear()

textBox4.Clear()
textBox5.Clear()
textBox6.Clear()
textBox7.Clear()
textBox8.Clear()
End Sub
Private Sub button1_Click(sender As Object, e As EventArgs)
Handles button1.Click
Try
cn.ConnectionString = "Server=localhost; user id=root;
password=Syed; database = airline;pooling=false"
cmd.Connection = cn
cn.Open()
If textBox6.Text = "" Then
MsgBox("please fill all the details")
Else
cmd = New MySqlCommand("Insert into Profile Values('"
& textBox1.Text & "','" & textBox2.Text & "','" & DateTimePicker1.Text
& "','" & textBox4.Text & "','" & textBox5.Text & "','" &
textBox6.Text & "','" & textBox7.Text & "','" & textBox8.Text & "')",
cn)
cmd.ExecuteNonQuery()
MsgBox("Information Successfully stored!",
MsgBoxStyle.Information, "saving data Succeed")
textBox1.Clear()
textBox2.Clear()
textBox4.Clear()
textBox5.Clear()
textBox6.Clear()
textBox7.Clear()
textBox8.Clear()

End If
cn.Close()
Catch ex As Exception
MsgBox(ex.ToString)

End Try

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs)


Handles Button2.Click
Dim cn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim dr As MySqlDataReader
cn.ConnectionString = "Server=localhost; user id=root;
password=Syed; database = airline"
cmd.Connection = cn
cn.Open()
cmd.CommandText = ("select * from Profile where Email='" +
textBox7.Text + "'")
dr = cmd.ExecuteReader
If dr.Read Then
textBox1.Text = dr.GetValue(0)
textBox2.Text = dr.GetValue(1)
DateTimePicker1.Text = dr.GetValue(2)
textBox4.Text = dr.GetValue(3)
textBox5.Text = dr.GetValue(4)
textBox6.Text = dr.GetValue(5)
textBox7.Text = dr.GetValue(6)
textBox8.Text = dr.GetValue(7)

Else
MsgBox("record not found")
End If
cn.Close()

End Sub

Private Sub Button5_Click(sender As Object, e As EventArgs)


Handles Button5.Click

Dim cn As New MySqlConnection


Dim cmd As New MySqlCommand
cn.ConnectionString = "Server=localhost; user id=root;
password=Syed; database = airline"
cmd.Connection = cn
cn.Open()
If textBox7.Text = "" Then
MsgBox("please select an email to update")
Else

cmd = New MySqlCommand("update Profile set Name='" &


textBox1.Text & "',father_Name='" & textBox2.Text & "',birthdate='" &
DateTimePicker1.Text & "',Gender='" & textBox4.Text & "',Address='" &
textBox5.Text & "',Mobile='" & textBox6.Text & "',Email='" &
textBox7.Text & "',occupation='" & textBox8.Text & "' where Email='" +
textBox7.Text + "' ", cn)
If (textBox1.Text = "" Or textBox2.Text = "" Or
DateTimePicker1.Text = "" Or textBox4.Text = "" Or textBox5.Text = ""
Or textBox6.Text = "" Or textBox7.Text = "" Or textBox8.Text = "")
Then
MessageBox.Show("please fill all the boxes")
Else
cmd.ExecuteNonQuery()
MsgBox("Record Successfully Updated!",
MsgBoxStyle.Information, "saving data succeed")
textBox1.Clear()
textBox2.Clear()
textBox4.Clear()
textBox5.Clear()
textBox6.Clear()
textBox7.Clear()
textBox8.Clear()
cn.Close()
End If

End If
cn.Close()
End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs)


Handles Button4.Click
Dim cn As New MySqlConnection
Dim cmd As New MySqlCommand
cn.ConnectionString = "Server=localhost; user id=root;
password=Syed; database = airline"
cmd.Connection = cn
cn.Open()
cmd.CommandText = (" delete from Profile where Email= '" &
textBox7.Text & "'")
If (textBox1.Text = "" Or textBox2.Text = "" Or
DateTimePicker1.Text = "" Or textBox4.Text = "" Or textBox5.Text = ""
Or textBox6.Text = "" Or textBox7.Text = "" Or textBox8.Text = "")
Then
MessageBox.Show("Invalid")
Else
cmd.ExecuteNonQuery()
MessageBox.Show(" Record deleted Successfully")
textBox1.Clear()
textBox2.Clear()
textBox4.Clear()
textBox5.Clear()
textBox6.Clear()
textBox7.Clear()
textBox8.Clear()
End If
cn.Close()

End Sub
Private Sub Profile_Load(sender As Object, e As EventArgs) Handles
MyBase.Load

End Sub

Private Sub textBox6_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles textBox6.KeyPress
If (Asc(e.KeyChar) >= 65 And Asc(e.KeyChar) <= 90) Or
(Asc(e.KeyChar) >= 97 And Asc(e.KeyChar) <= 122) Then
MessageBox.Show("please enter a number!!!")
e.KeyChar = ""
End If
End Sub
End Class

Signup

Imports MySql.Data.MySqlClient
Public Class Sign_Up

Private Sub button2_Click(sender As Object, e As EventArgs)


Handles button2.Click
Try
Dim cn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim dr As MySqlDataReader
cn.ConnectionString = "Server=localhost; user id=root;
password=Syed; database = airline"
cn.Open()
cmd.Connection = cn
cmd.CommandType = CommandType.Text
cmd.CommandText = "select * from Signup where email='" &
textBox2.Text & "'"
dr = cmd.ExecuteReader
If dr.HasRows Then
MsgBox("Duplicate entry found...Already Registered",
MsgBoxStyle.Critical)
cn.Close()
Else
cn.Close()
cn.Open()
cmd.Connection = cn
cmd.CommandType = CommandType.Text
cmd.CommandText = "Insert into Signup(Name, Email,
Password) Values('" & textBox1.Text & "','" & textBox2.Text & "','" &
textBox3.Text & "')"
If (textBox1.Text = "" Or textBox2.Text = "" Or
textBox3.Text = "") Then
MessageBox.Show("Please enter the details")
Else
cmd.ExecuteNonQuery()
MsgBox("Information Successfully stored!",
MsgBoxStyle.Information, "saving data Succeed")
Home.Show()
Me.Hide()
textBox1.Clear()
textBox2.Clear()
textBox3.Clear()
End If
cn.Close()
End If
cn.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try

End Sub

Private Sub linkLabel1_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles linkLabel1.LinkClicked
Sign_In.Show()
Me.Hide()
textBox1.Clear()
textBox2.Clear()
textBox3.Clear()
End Sub

Private Sub button1_Click(sender As Object, e As EventArgs)


Handles button1.Click
Sign_In.Show()
Me.Hide()
textBox1.Clear()
textBox2.Clear()
textBox3.Clear()
End Sub
End Class

Signin

Imports MySql.Data.MySqlClient
Public Class Sign_In

Private Sub Sign_In_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

End Sub

Private Sub button1_Click(sender As Object, e As EventArgs)


Handles button1.Click
Dim cn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim dr As MySqlDataReader
cn.ConnectionString = "Server = localhost; user id = root;
password = Syed; database = airline"
cmd.Connection = cn
cn.Open()
cmd.CommandText = "SELECT Email,Password FROM signup WHERE
Email = '" & textBox1.Text & "' And Password = '" & textBox2.Text &
"'"
dr = cmd.ExecuteReader
If dr.HasRows Then
MessageBox.Show(" Login Successfully")
Home.Show()
textBox1.Clear()
textBox2.Clear()
Me.Visible = False
Else
MessageBox.Show("Invalid Username and Password Please
Check!")
End If
End Sub

Private Sub linkLabel2_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles linkLabel2.LinkClicked
Sign_Up.Show()
Me.Hide()
textBox1.Clear()
textBox2.Clear()
End Sub
End Class

You might also like