private void button2_Click(object sender, EventArgs e) { if (Convert.ToInt32(seatNotxt.Text) <= 50) { if (AvailableSeat() == true) { Booking booking = new Booking(); booking.CustomerId = Convert.ToInt32(custIdtxt.Text); booking.DateOfJourney = dateOfJourney.Value; booking.FlightId = Convert.ToInt32(flightIdtxt.Text); booking.SeatNo = Convert.ToInt32(seatNotxt.Text); db.Bookings.Add(booking); db.SaveChanges(); MessageBox.Show("Add Ticket"); } else { MessageBox.Show("Seat No is already booked"); } } else { MessageBox.Show("Seat Number is less than 50 or equal to 50"); } }
private void button3_Click(object sender, EventArgs e) { db = new AirLineDbEntities1(); Cust_Details customer = db.Cust_Details.Where(a => a.Id == id).FirstOrDefault(); customer.Name = nametxt.Text; customer.LastName = lastnametxt.Text; customer.Address = addresstxt.Text; customer.PhoneNumber = phonenumtxt.Text; customer.Email = emailtxt.Text; customer.BirthDate = datebirthtxt.Value; db.SaveChanges(); MessageBox.Show("Record Updated"); }
private void button1_Click(object sender, EventArgs e) { Flight_Info fi = new Flight_Info(); fi.Flight_name = flightNametxt.Text; fi.Source = sourcetxt.Text; fi.Destination = destinationtxt.Text; fi.Departure = departuretxt.Text; fi.Arrival_time = arrivalTimetxt.Text; fi.Flight_class = flightClasstxt.Text; fi.Flight_Charges = Convert.ToDecimal(flightChargestxt.Text); fi.Seat = Convert.ToInt16(seatstxt.Text); db.Flight_Info.Add(fi); db.SaveChanges(); MessageBox.Show("One flight details is added"); }
private void button1_Click(object sender, EventArgs e) { AirLineDbEntities1 db = new AirLineDbEntities1(); Cust_Details customers = new Cust_Details { Name = nametxt.Text, LastName = lastnametxt.Text, Address = addresstxt.Text, PhoneNumber = phonenumtxt.Text, Email = emailtxt.Text, BirthDate = datebirthtxt.Value }; db.Cust_Details.Add(customers); db.SaveChanges(); MessageBox.Show("Add one customer"); }