private void searchB_Click(object sender, EventArgs e) { if (FromCMbox.Text == ToCMbox.Text) { MessageBox.Show("Pick up point & destination point can not be same"); } else if (dateTimePicker1.Value <= DateTime.Today) { MessageBox.Show("You can only reserve ticket from tomorrow"); } else if ((FromCMbox.Text == "Bogra" || FromCMbox.Text == "Rajshahi" || FromCMbox.Text == "Dhaka" || FromCMbox.Text == "Feni" || FromCMbox.Text == "Rangpur" || FromCMbox.Text == "Chittagong" || FromCMbox.Text == "Dinajpur" || FromCMbox.Text == "Khulna" || FromCMbox.Text == "Barisal") && (ToCMbox.Text == "Bogra" || ToCMbox.Text == "Rajshahi" || ToCMbox.Text == "Dhaka" || ToCMbox.Text == "Feni" || ToCMbox.Text == "Rangpur" || ToCMbox.Text == "Chittagong" || ToCMbox.Text == "Dinajpur" || ToCMbox.Text == "Khulna" || ToCMbox.Text == "Barisal") && (dateTimePicker1.Value > DateTime.Today)) { sqlcon.Open(); SqlCommand cmd = sqlcon.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into BSTicket(Ref,UserName,PickUpPoint,Destination,Date) VALUES ('" + RefBx.Text + "','" + UNbox.Text + "','" + FromCMbox.Text + "','" + ToCMbox.Text + "','" + dateTimePicker1.Text + "')"; cmd.ExecuteNonQuery(); reff = RefBx.Text; Pickup = FromCMbox.Text; desti = ToCMbox.Text; sqlcon.Close(); SelectBus sltbus = new SelectBus(); sltbus.Show(); this.Hide(); } else { MessageBox.Show("Select them all"); } }
private void searchB_Click(object sender, EventArgs e) { SelectBus sltbus = new SelectBus(); sltbus.Show(); this.Hide(); }
private void BackB_Click(object sender, EventArgs e) { if (MessageBox.Show("If you go back, you have to re-submit the forms \nDo you want to continue", "Confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { SelectBus sltbus = new SelectBus(); sltbus.Show(); this.Hide(); } }