private void Button_Click(object sender, RoutedEventArgs e) { SqlConnection con = new SqlConnection(@"Data Source=localhost\SQLEXPRESS; Initial Catalog=UserDB; Integrated Security=True"); try { if (con.State == ConnectionState.Closed) { con.Open(); } string query = "SELECT SEFER_REFNO, NEREDEN, NEREYE, CONVERT(varchar(10), TARIH) AS TARIH, SAAT, FIYAT" + " FROM SEFERLER" + " WHERE NEREDEN=@P1 AND NEREYE=@P2 AND TARIH=@P3 AND KONTENJAN<11" + " ORDER BY SAAT"; SqlCommand cmd = new SqlCommand(query, con); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@P1", comboNereden.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@P2", comboNereye.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@P3", datePicker.SelectedDate.Value.ToString("MM.dd.yyyy")); SqlDataAdapter adapter = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); adapter.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { SeferCard sc = new SeferCard(); foreach (DataColumn column in dt.Columns) { sc.Sefer_refno = row["SEFER_REFNO"].ToString(); sc.Saat = row["SAAT"].ToString(); sc.Istikamet = row["NEREDEN"].ToString() + " - " + row["NEREYE"].ToString(); sc.Fiyat = row["FIYAT"].ToString().Substring(0, 5) + " TL"; } UygulamaKontrol.SeferEkle(spSEFERLER, sc); } } else { MessageBox.Show("Aradığınız kriterde sefer yok.", "UYARI", MessageBoxButton.OK, MessageBoxImage.Information); } cmd.Dispose(); adapter.Dispose(); con.Close(); //dtGridSeferler.ItemsSource = dt.DefaultView; } catch { MessageBox.Show("Basarisiz"); } }
private void Button_Click_6(object sender, RoutedEventArgs e) { UygulamaKontrol.AddUserControlToGrid(usercontrol, new BiletIptal()); }
private void Button_Click_4(object sender, RoutedEventArgs e) { UygulamaKontrol.AddUserControlToGrid(UserControlGrid, new BiletAl()); }
private void Button_Click(object sender, RoutedEventArgs e) { UygulamaKontrol.AddUserControlToGrid(UserControlGrid, new HesapBilgileri()); }