private void UsunBilety(object sender, RoutedEventArgs e)
 {
     try
     {
         Bilet bilet = (Bilet)Bilety.SelectedItem;
         BOOKEDFLY.usunBilet(bilet);
         MessageBox.Show("Usunięto bilety.", "Sukces", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     catch (Exception)
     {
         MessageBox.Show("Błąd w skasowaniu biletów.", "Błąd", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Example #2
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);
     }
 }
Example #3
0
 private void Sprzedaj(object sender, RoutedEventArgs e)
 {
     try
     {
         Bilet   bilet   = (Bilet)Bilety.SelectedItem;
         int     index   = Bilety.SelectedIndex;
         TextBox textBox = (TextBox)ile;
         int     liczba  = Int32.Parse(textBox.Text);
         if (liczba <= bilet.liczbaMiejsc)
         {
             bilet.odejmijMiejsce(liczba);
             if (bilet.liczbaMiejsc == 0)
             {
                 BOOKEDFLY.usunBilet(bilet);
                 CollectionViewSource.GetDefaultView(Bilety.ItemsSource).Refresh();
             }
             if (bilet.liczbaMiejsc < 0)
             {
                 MessageBox.Show("Błąd w sprzedaży biletu.", "Błąd", MessageBoxButton.OK, MessageBoxImage.Warning);
             }
             else
             {
                 BOOKEDFLY.pulaBiletow[index] = bilet;
                 MessageBox.Show("Sprzedano " + liczba + " biletów.", "Sukces", MessageBoxButton.OK, MessageBoxImage.Information);
                 CollectionViewSource.GetDefaultView(Bilety.ItemsSource).Refresh();
             }
         }
         else
         {
             MessageBox.Show("Błąd w sprzedaży biletu.", "Błąd", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Błąd w sprzedaży biletu", "Błąd", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Example #4
0
 public static void usunBilet(Bilet b)
 {
     pulaBiletow.Remove(b);
 }
Example #5
0
 public static void dodajBilet(Bilet b) //metoda dodająca bilet
 {
     pulaBiletow.Add(b);
 }