private void geri_Click(object sender, EventArgs e) { Giris grs = new Giris(); grs.Show(); this.Hide(); }
private void timer1_Tick(object sender, EventArgs e) { sayac = sayac + 1; if (sayac == 3) { Giris grs = new Giris(); grs.Show(); this.Hide(); timer1.Stop(); } }
private void button1_Click(object sender, EventArgs e) { if (BiletSatisGiris.x == true) { if (skno != "") { if (YolcuKart.txtTcNo != "") { if (sontrh != "") { bag.Open(); string sorgu = "INSERT INTO Rezervasyon (SKNo,Tc_No,R_son_tarihi) VALUES (@skno,@tcno,@rsontrh)"; SqlCommand cmd = new SqlCommand(sorgu, bag); cmd.Parameters.Add("@skno", skno); cmd.Parameters.Add("@tcno", YolcuKart.txtTcNo); cmd.Parameters.Add("@rsontrh", sontrh); cmd.ExecuteNonQuery(); MessageBox.Show("Rezervasyon yapılmıştır."); bag.Close(); } else { MessageBox.Show("sontrh boş!!!"); } } else { MessageBox.Show("tcno boş!!!"); } } else { MessageBox.Show("skno boş!!!"); } } else { bag.Open(); string sorgu = "INSERT INTO Sepet (Tc_No,SKNo,GNoBaslangic,GNoBitis,Ucret) VALUES (@tcno,@skno,@gnoblngc,@gnobts,@ucret)"; string sorgu2 = "SELECT SKNo FROM SeferKoltuk WHERE KoltukNo=@kltkno AND SeferNo=@sfrno"; string sorgu3 = "SELECT gh.GNo FROM Guzergah gh, Otogar otr,Sefer sfr WHERE otr.OtogarId=gh.OtogarId AND otr.OtogarAdi=@otradi AND gh.SeferNo=sfr.SeferNo AND gh.SeferNo=@sfrno"; string sorgu4 = "SELECT gh.GNo FROM Guzergah gh, Otogar otr,Sefer sfr WHERE otr.OtogarId=gh.OtogarId AND otr.OtogarAdi=@otradi AND gh.SeferNo=sfr.SeferNo AND gh.SeferNo=@sfrno"; string sorgu5 = "SELECT os.OKoltukSayisi FROM Sefer sfr, Otobus os WHERE sfr.OtobusId=os.OtobusId AND SeferNo=@sfrno"; string sorgu6 = "SELECT ucr.Ucret FROM Ucret ucr WHERE ucr.OBslngcId IN (SELECT otr.OtogarId FROM Otogar otr WHERE otr.OtogarAdi=@oadi1) AND ucr.OBtsId IN (SELECT otr.OtogarId FROM Otogar otr WHERE otr.OtogarAdi=@oadi2)"; SqlCommand cmd = new SqlCommand(sorgu, bag); SqlCommand cmd2 = new SqlCommand(sorgu2, bag); SqlCommand cmd3 = new SqlCommand(sorgu3, bag); SqlCommand cmd4 = new SqlCommand(sorgu4, bag); SqlCommand cmd5 = new SqlCommand(sorgu5, bag); SqlCommand cmd6 = new SqlCommand(sorgu6, bag); cmd5.Parameters.Add("@sfrno", SeferAra.sfrno); int kltksys = Convert.ToInt32(cmd5.ExecuteScalar()); if (kltksys == 54) { cmd2.Parameters.Add("@kltkno", KoltukAra54.kltkno); } else if (kltksys == 46) { cmd2.Parameters.Add("@kltkno", KoltukAra46.kltkno); } else if (kltksys == 78) { cmd2.Parameters.Add("@kltkno", KoltukAra78.kltkno); } cmd2.Parameters.Add("@sfrno", SeferAra.sfrno); string skno = Convert.ToString(cmd2.ExecuteScalar()); if (skno != "") { cmd3.Parameters.Add("@otradi", SeferAra.nrdn); cmd3.Parameters.Add("@sfrno", SeferAra.sfrno); string gnobslngc = Convert.ToString(cmd3.ExecuteScalar()); cmd4.Parameters.Add("@otradi", SeferAra.nrye); cmd4.Parameters.Add("@sfrno", SeferAra.sfrno); string gnobitis = Convert.ToString(cmd4.ExecuteScalar()); cmd6.Parameters.Add("@oadi1", SeferAra.nrdn); cmd6.Parameters.Add("@oadi2", SeferAra.nrye); string ucret = Convert.ToString(cmd6.ExecuteScalar()); cmd.Parameters.Add("@tcno", YolcuKart.txtTcNo); cmd.Parameters.Add("@skno", skno); cmd.Parameters.Add("@gnoblngc", gnobslngc); cmd.Parameters.Add("@gnobts", gnobitis); cmd.Parameters.Add("@ucret", ucret); cmd.ExecuteNonQuery(); MessageBox.Show("Satın alma işlemi başarıyla sonuçlanmıştır. İyi günler dileriz..."); Giris grs = new Giris(); grs.Show(); this.Hide(); bag.Close(); } else { MessageBox.Show("Sefere Koltuk eklenmemiştir!!!"); } bag.Close(); } }