示例#1
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Train train = new Train(textBox7.Text.Trim(), textBox8.Text.Trim(), int.Parse(textBox6.Text.Trim()));
         try
         {
             SQLCommand.Add(train);
             MessageBox.Show("Pociąg dodany!!");
         }
         catch (Exception)
         {
             MessageBox.Show("Dany pociąg już istnieje w bazie danych!!!");
             SQLCommand.sqlite_conn.Close();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Wprowadzone dane są błędne!!!");
         SQLCommand.sqlite_conn.Close();
     }
 }
示例#2
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DateTime time  = Convert.ToDateTime(textBox2.Text.Trim());
         DateTime time2 = Convert.ToDateTime(textBox3.Text.Trim());
         Stop     stop  = new Stop(textBox.Text.Trim(), textBox3.Text.Trim(), textBox2.Text.Trim(), Convert.ToDateTime(calendar.SelectedDate), int.Parse(textBox4.Text.Trim()), int.Parse(textBox5.Text.Trim()), int.Parse(textBox1.Text.Trim()));
         try
         {
             SQLCommand.Add(stop);
             MessageBox.Show("Dodano przystanek!!");
         }
         catch (Wyjatek)
         {
             Wyjatek.Info();
             SQLCommand.sqlite_conn.Close();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Podano zle dane!!!");
         SQLCommand.sqlite_conn.Close();
     }
 }