예제 #1
0
 private void Proceed_Click(System.Object sender, System.EventArgs e)
 {
     try {
         CN = Convert.ToInt32(BookingNo.Text);
         if (string.IsNullOrEmpty(BookingNo.Text.Trim()))
         {
             MessageBox.Show("Plz.. Enter Booking No..");
         }
         else if (RadioButton1.Checked == false & RadioButton2.Checked == false)
         {
             MessageBox.Show("Plz.. Select Seat Section..");
         }
         else
         {
             DialogResult res = MessageBox.Show("Do U Want To Allocate Seat To Waiting Booking?", "Allocate Seat?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
             if (res == DialogResult.Yes)
             {
                 RN  = RNo.Text;
                 BN  = BusSerialNo.Text;
                 con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Bus_System;Integrated Security=True");
                 con.Open();
                 cmd = new SqlCommand("Update APaymentPassenger Set RouteBus='" + cmbstartpoint.Text + " To " + cmbdestination.Text + " " + BusNumber.Text + "',CurrentDate='" + Strings.Format(DateAndTime.Today, "dd/MM/yyyy") + "',ArrivalTime='" + Strings.Format(Arrivaltime.Value, "hh:mm:ss tt") + "'Where BookingNo=" + BookingNo.Text + "", con);
                 cmd.ExecuteNonQuery();
                 //this.Hide();
                 if (BusReservation.Text == "1x1" & RadioButton1.Checked == true)
                 {
                     SeatSelectionLower SSL = new SeatSelectionLower("AB_UN", CN, RN, BN);
                     this.Close();
                     SSL.Show();
                     SSL.BringToFront();
                 }
                 if (BusReservation.Text == "1x1" & RadioButton2.Checked == true)
                 {
                     SeatSelectionUpper SSU = new SeatSelectionUpper("AB_UN", CN, RN, BN);
                     this.Close();
                     SSU.Show();
                     SSU.BringToFront();
                 }
                 if (BusReservation.Text == "2x1" & RadioButton1.Checked == true)
                 {
                     SeatSelectionLower21 SSL1 = new SeatSelectionLower21("AB_UN", CN, RN, BN);
                     this.Close();
                     SSL1.Show();
                     SSL1.BringToFront();
                 }
                 if (BusReservation.Text == "2x1" & RadioButton2.Checked == true)
                 {
                     SeatSelectionUpper21 SSU1 = new SeatSelectionUpper21("AB_UN", CN, RN, BN);
                     this.Close();
                     SSU1.Show();
                     SSU1.BringToFront();
                 }
                 if (BusReservation.Text == "2x2" & RadioButton1.Checked == true)
                 {
                     SeatSelectionLower22 SSL2 = new SeatSelectionLower22("AB_UN", CN, RN, BN);
                     this.Close();
                     SSL2.Show();
                     SSL2.BringToFront();
                 }
                 if (BusReservation.Text == "2x2" & RadioButton2.Checked == true)
                 {
                     SeatSelectionUpper21 SSU2 = new SeatSelectionUpper21("AB_UN", CN, RN, BN);
                     this.Close();
                     SSU2.Show();
                     SSU2.BringToFront();
                 }
                 //this.Close();
             }
         }
     } catch (Exception ex) {
         MessageBox.Show("Nothing Selected.. Plz Select Correct Booking No.. Or " + ex.Message);
     }
 }
예제 #2
0
 private void Insert_Click(System.Object sender, System.EventArgs e)
 {
     if (string.IsNullOrEmpty(PassengerNo.Text.Trim()))
     {
         MessageBox.Show("Plz.. Enter Passenger No..");
     }
     else
     {
         con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Bus_System;Integrated Security=True");
         con.Open();
         if (checkm == "NA")
         {
             cmd = new SqlCommand("Update PaymentPassenger Set BookingDate='" + Strings.Format(BookingDate.Value, "dd/MM/yyyy") + "',PassengerNo='" + PassengerNo.Text + "',PassengerName='" + PassengerName.Text + "',PassengerCity='" + PassengerCity.Text + "',PassengerContact='" + PassengerContact.Text + "',PassengerAddress='" + PassengerAddress.Text + "'Where BookingNo=" + BookingNo.Text + "", con);
         }
         else
         {
             cmd = new SqlCommand("Update APaymentPassenger Set BookingDate='" + Strings.Format(BookingDate.Value, "dd/MM/yyyy") + "',PassengerNo='" + PassengerNo.Text + "',PassengerName='" + PassengerName.Text + "',PassengerCity='" + PassengerCity.Text + "',PassengerContact='" + PassengerContact.Text + "',PassengerAddress='" + PassengerAddress.Text + "'Where BookingNo=" + BookingNo.Text + "", con);
         }
         cmd.ExecuteNonQuery();
         con.Close();
         PassengerSU();
         MessageBox.Show("Success... Next");
         if (checkm == "NA")
         {
             Seat_Booking_Details s1 = new Seat_Booking_Details("NA", BookingNo.Text);
             this.Close();
             s1.Show();
             s1.BringToFront();
         }
         else
         {
             if (BR == "1x1" & stype == "L")
             {
                 SeatSelectionLower SSL = new SeatSelectionLower("AB_UN", BookingNo.Text, RNO, BNO);
                 this.Close();
                 SSL.Show();
             }
             if (BR == "1x1" & stype == "U")
             {
                 SeatSelectionUpper SSU = new SeatSelectionUpper("AB_UN", BookingNo.Text, RNO, BNO);
                 this.Close();
                 SSU.Show();
             }
             if (BR == "2x1" & stype == "L")
             {
                 SeatSelectionLower21 SSL1 = new SeatSelectionLower21("AB_UN", BookingNo.Text, RNO, BNO);
                 this.Close();
                 SSL1.Show();
             }
             if (BR == "2x1" & stype == "U")
             {
                 SeatSelectionUpper21 SSU1 = new SeatSelectionUpper21("AB_UN", BookingNo.Text, RNO, BNO);
                 this.Close();
                 SSU1.Show();
             }
             if (BR == "2x2" & stype == "L")
             {
                 SeatSelectionLower22 SSL2 = new SeatSelectionLower22("AB_UN", BookingNo.Text, RNO, BNO);
                 this.Close();
                 SSL2.Show();
             }
             if (BR == "2x2" & stype == "U")
             {
                 SeatSelectionUpper21 SSU2 = new SeatSelectionUpper21("AB_UN", BookingNo.Text, RNO, BNO);
                 this.Close();
                 SSU2.Show();
             }
         }
     }
 }
예제 #3
0
        public void Insert_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("Insert Into PaymentPassenger(BookingNo,RouteBus,BookingDate,WaitingNo,CurrentDate,ArrivalTime) Values(" + BookingNo.Text + ",'" + cmbstartpoint.Text + " To " + cmbdestination.Text + " " + BusNumber.Text + "','" + Strings.Format(DateAndTime.Today, "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();
                Master.getinfos(Rno.Text, BusSerialNo.Text, SeatCapacity.Text, BusReservation.Text);
                if (BusReservation.Text == "1x1" & RadioButton1.Checked == true)
                {
                    SeatSelectionLower SSL0 = new SeatSelectionLower("NA", BookingNo.Text, Rno.Text, BusSerialNo.Text);
                    this.Close();
                    SSL0.Show();
                }
                if (BusReservation.Text == "1x1" & RadioButton2.Checked == true)
                {
                    SeatSelectionUpper SSL1 = new SeatSelectionUpper("NA", BookingNo.Text, Rno.Text, BusSerialNo.Text);
                    this.Close();
                    SSL1.Show();
                }
                if (BusReservation.Text == "2x1" & RadioButton1.Checked == true)
                {
                    SeatSelectionLower21 SSL3 = new SeatSelectionLower21("NA", BookingNo.Text, Rno.Text, BusSerialNo.Text);
                    this.Close();
                    SSL3.Show();
                }
                if (BusReservation.Text == "2x1" & RadioButton2.Checked == true)
                {
                    SeatSelectionUpper21 SSL4 = new SeatSelectionUpper21("NA", BookingNo.Text, Rno.Text, BusSerialNo.Text);
                    this.Close();
                    SSL4.Show();
                }
                if (BusReservation.Text == "2x2" & RadioButton1.Checked == true)
                {
                    SeatSelectionLower22 SSL5 = new SeatSelectionLower22("NA", BookingNo.Text, Rno.Text, BusSerialNo.Text);
                    this.Close();
                    SSL5.Show();
                }
                if (BusReservation.Text == "2x2" & RadioButton2.Checked == true)
                {
                    SeatSelectionUpper22 SSL6 = new SeatSelectionUpper22("NA", BookingNo.Text, Rno.Text, BusSerialNo.Text);
                    this.Close();
                    SSL6.Show();
                }
            }
        }