public void dest(Int64 pp, string firstname, string lastname, string departured, string rd, string ff, string tf, string v, string op, string tr) { Airline air = new Airline(); air.PassportNumber = pp; air.FirstName = firstname; air.LastName = lastname; air.depdate = departured; air.returndate = rd; ff = "KARACHI , KHI"; air.arrivalairport = tf; air.via = v; air.ope = op; air.trclass = tr; connec.Open(); string query = "insert into ticket values (@ppnumber,@fname,@lname,@Depdate,@returndate, @ff , @rf ,@via , @fo , @travelclass)"; SqlCommand cmd = new SqlCommand(query, connec); cmd.Parameters.AddWithValue("@ppnumber", air.PassportNumber); cmd.Parameters.AddWithValue("@fname", air.FirstName); cmd.Parameters.AddWithValue("@lname", air.LastName); cmd.Parameters.AddWithValue("@Depdate", air.depdate); cmd.Parameters.AddWithValue("@returndate", air.returndate); cmd.Parameters.AddWithValue("@ff", ff); cmd.Parameters.AddWithValue("@rf", air.arrivalairport); cmd.Parameters.AddWithValue("@via", air.via); cmd.Parameters.AddWithValue("@fo", air.ope); cmd.Parameters.AddWithValue("@travelclass", air.trclass); int a = cmd.ExecuteNonQuery(); if (a > 0) { MessageBox.Show("Your Ticket has been booked , You can proceed towards hotel booking now .", "Ticket Booked", MessageBoxButtons.OK, MessageBoxIcon.Information); air.ShowBill(); HOTEL ht = new HOTEL(); ht.Show(); TICKET tk = new TICKET(); tk.Hide(); } else { MessageBox.Show(" Ticket Booking unsuccesful .", "Book Ticket", MessageBoxButtons.OK, MessageBoxIcon.Error); } connec.Close(); }
private void button2_Click(object sender, EventArgs e) { Airline air = new Airline(); air.Clear(); }