private void button1_Click(object sender, EventArgs e) { RadioButton radioButton = new RadioButton(); foreach (RadioButton rb in groupBox1.Controls.OfType <RadioButton>()) { String seatId = ""; if (rb.Checked) { radioButton = rb; seatId = rb.Name.ToString(); seat = seatId.Substring(seatId.Length - 2); } } FlightSeatDetil flightSeatDetil = new FlightSeatDetil(); flightSeatDetil.FlightName = form.textBox7.Text; flightSeatDetil.FlightNumber = Convert.ToInt32(form.textBox6.Text); String y = form.dt.Value.Year.ToString(); String d = form.dt.Value.Day.ToString(); String m = form.dt.Value.Month.ToString(); String con = d + m + y; flightSeatDetil.FlightDate = con; flightSeatDetil.SeatNumber = radioButton.Name; db.FlightSeatDetils.Add(flightSeatDetil); db.SaveChanges(); form.textBox1.Text = seat; this.Close(); }
private void savebtn_Click(object sender, EventArgs e) { AirlinedbEntities db = new AirlinedbEntities(); Admin admin = new Admin { Username = textBox1.Text, Password = passtxt.Text }; db.Admins.Add(admin); db.SaveChanges(); MessageBox.Show("Admin Added!"); this.Close(); }
private void button1_Click(object sender, EventArgs e) { Flight_Details flight_Details = new Flight_Details(); flight_Details.Flight_Name = flname_txt.Text; flight_Details.Source = src_txt.Text; flight_Details.Destination = dst_txt.Text; flight_Details.Arrival_Time = arrival_time.Text; flight_Details.Departure_Time = departure_time.Text; flight_Details.Cost = Convert.ToDecimal(cost_txt.Text); flight_Details.Seats = Convert.ToInt16(seats_txt.Text); flight_Details.Flight_Class = class_txt.Text; db.Flight_Details.Add(flight_Details); db.SaveChanges(); MessageBox.Show("Flight Added"); this.Close(); }
private void button1_Click(object sender, EventArgs e) { AirlinedbEntities db = new AirlinedbEntities(); Customer customer = new Customer { Name = name_txt.Text, Phone_ = phn_txt.Text, Birthday = birthdate_picker.Value, Address = addr_txt.Text, Email = email_txt.Text, username = usrnametxt.Text, password = passtxt.Text }; db.Customers.Add(customer); db.SaveChanges(); MessageBox.Show("User Registered"); this.Close(); }
private void button1_Click(object sender, EventArgs e) { if (WithErrors()) { MessageBox.Show("Missing fields!"); } else { Bookings booking = new Bookings(); booking.Name = nametxt.Text; booking.Birth_date = dateTimePicker1.Value; booking.Date_of_Journey = dt.Value; booking.Email = textBox3.Text; booking.Phone_Number = textBox4.Text; booking.Address = textBox5.Text; booking.Flight_Id = Convert.ToInt32(textBox6.Text); booking.Flight_Name = textBox7.Text; booking.Seat_Number = textBox1.Text; db.Bookings1.Add(booking); db.SaveChanges(); MessageBox.Show("Ticket Booked!"); this.Close(); } }