Пример #1
0
 private void GenerujBilety(object sender, RoutedEventArgs e)
 {
     try
     {
         Lot   lot   = (Lot)Loty.SelectedItem;
         Bilet bilet = new Bilet();
         bilet.lot          = lot;
         bilet.liczbaMiejsc = lot.samolot.IloscMiejsc;
         BOOKEDFLY.dodajBilet(bilet);
         MessageBox.Show("Pomyślnie wygenerowano pulę biletów.", "Sukces", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     catch (Exception)
     {
         MessageBox.Show("Błąd w wygenerowaniu biletów.", "Błąd", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Пример #2
0
 public static void wczytBilety()
 {
     try
     {
         using (Stream stream = File.Open("bin/Bilety.bin", FileMode.Open))
         {
             BinaryFormatter bin       = new BinaryFormatter();
             List <Bilet>    tempBilet = (List <Bilet>)bin.Deserialize(stream);
             foreach (Bilet bilet in tempBilet)
             {
                 BOOKEDFLY.dodajBilet(bilet);
             }
         }
     }
     catch (IOException)
     {
     }
 }