Beispiel #1
0
 private void Back_Click(object sender, EventArgs e)
 {
     st = "";
     if (MessageBox.Show("If you go back, you have to select the seat again \nDo you want to continue", "Confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (SelectBus.BusType == "AC")
         {
             ACBus acB = new ACBus();
             acB.Show();
             this.Hide();
         }
         if (SelectBus.BusType == "Non AC")
         {
             NonAcBus nonacB = new NonAcBus();
             nonacB.Show();
             this.Hide();
         }
     }
 }
        private void NextB_Click(object sender, EventArgs e)
        {
            if (BusNmCMbox.Text == "" || BusTypeCMbox.Text == "" || TravelTimeCMbox.Text == "")
            {
                MessageBox.Show("Select Them All");
            }


            else if (BusTypeCMbox.Text == "AC")
            {
                sqlcon.Open();
                SqlCommand cmd = sqlcon.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "update BSTicket set BusName = '" + BusNmCMbox.Text + "',BusType = '" + BusTypeCMbox.Text + "', TravelingTime = '" + TravelTimeCMbox.Text + "' where Ref = '" + Homepage.reff + "'";
                cmd.ExecuteNonQuery();
                sqlcon.Close();

                BusType = "AC";

                ACBus acBus = new ACBus();
                acBus.Show();
                this.Hide();
            }
            else if (BusTypeCMbox.Text == "Non AC")
            {
                sqlcon.Open();
                SqlCommand cmd = sqlcon.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "update BSTicket set BusName = '" + BusNmCMbox.Text + "',BusType = '" + BusTypeCMbox.Text + "',TravelingTime = '" + TravelTimeCMbox.Text + "' where Ref = '" + Homepage.reff + "'";
                cmd.ExecuteNonQuery();
                sqlcon.Close();

                BusType = "Non AC";

                NonAcBus nonacBus = new NonAcBus();
                nonacBus.Show();
                this.Hide();
            }
        }