示例#1
0
 private void WaitingList_Click(System.Object sender, System.EventArgs e)
 {
     if (string.IsNullOrEmpty(Rno.Text.Trim()) | Rno.Text.Trim() == "Select")
     {
         MessageBox.Show("Plz.. Enter Correct Route No");
     }
     else if (string.IsNullOrEmpty(BusSerialNo.Text.Trim()) | BusSerialNo.Text.Trim() == "Select")
     {
         MessageBox.Show("Plz Enter Bus Serial No and Press Find");
     }
     else if (RadioButton1.Checked == false & RadioButton2.Checked == false)
     {
         MessageBox.Show("Plz.. Select Seat Type");
     }
     else
     {
         con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Bus_System;Integrated Security=True");
         con.Open();
         cmd = new SqlCommand("Select max(WaitingNo) From APaymentPassenger", con);
         dr  = cmd.ExecuteReader();
         dr.Read();
         if ((!object.ReferenceEquals(dr[0], DBNull.Value)))
         {
             t = Convert.ToInt32(dr[0]) + 1;
         }
         else
         {
             t = 1;
         }
         WNo.Text = t.ToString();
         dr.Close();
         cmd = new SqlCommand("Insert Into APaymentPassenger(BookingNo,RouteBus,BookingDate,WaitingNo,CurrentDate,ArrivalTime) Values(" + BookingNo.Text + ",'" + cmbstartpoint.Text + " To " + cmbdestination.Text + " " + BusNumber.Text + "','" + Strings.Format(DateAndTime.Today, "dd/MM/yyyy") + "','" + WNo.Text + "','" + Strings.Format(DateAndTime.Today, "dd/MM/yyyy") + "','" + Strings.Format(Arrivaltime.Value, "hh:mm:ss tt") + "')", con);
         cmd.ExecuteNonQuery();
         MessageBox.Show("Success... Next");
         con.Close();
         this.Close();
         Booking_And_Passenger ABPassenger = new Booking_And_Passenger("AB_UN", "L/U", "WL");
         ABPassenger.Show();
     }
 }
示例#2
0
 private void AB_Click(System.Object sender, System.EventArgs e)
 {
     if (string.IsNullOrEmpty(Rno.Text.Trim()) | Rno.Text.Trim() == "Select")
     {
         MessageBox.Show("Plz.. Enter Correct Route No");
     }
     else if (string.IsNullOrEmpty(BusSerialNo.Text.Trim()) | BusSerialNo.Text.Trim() == "Select")
     {
         MessageBox.Show("Plz Enter Bus Serial No and Press Find");
     }
     else if (RadioButton1.Checked == false & RadioButton2.Checked == false)
     {
         MessageBox.Show("Plz.. Select Seat Type");
     }
     else
     {
         con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Bus_System;Integrated Security=True");
         con.Open();
         New2.Text = "AB_UN";
         dr.Close();
         cmd = new SqlCommand("Insert Into APaymentPassenger(BookingNo,RouteBus,BookingDate,WaitingNo,CurrentDate,ArrivalTime) Values(" + BookingNo.Text + ",'" + cmbstartpoint.Text + " To " + cmbdestination.Text + " " + BusNumber.Text + "','" + Strings.Format(BookingDate.Value, "dd/MM/yyyy") + "','" + "0" + "','" + Strings.Format(DateAndTime.Today, "dd/MM/yyyy") + "','" + Strings.Format(Arrivaltime.Value, "hh:mm:ss tt") + "')", con);
         cmd.ExecuteNonQuery();
         MessageBox.Show("Success... Next...");
         con.Close();
         if (RadioButton1.Checked == true)
         {
             new22 = "L";
         }
         if (RadioButton2.Checked == true)
         {
             new22 = "U";
         }
         Master.getinfoA(Rno.Text, BusSerialNo.Text, SeatCapacity.Text, BusReservation.Text);
         Booking_And_Passenger ABPassenger = new Booking_And_Passenger("AB_UN", new22, "0");
         this.Close();
         ABPassenger.Show();
     }
 }