Exemplo n.º 1
0
 private void Bt_changePrice_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (ModifyService.updateTicketPrice(lb_priceList.SelectedValue.ToString(), double.Parse(tb_prmodifyNewPrice.Text), cal_prmodifyWhenStart.SelectedDates.First(), cal_prmodifyWhenStart.SelectedDates.Last()))
         {
             MessageBox.Show("Zaaktualizowano cenę");
             tb_prmodifyNewPrice.Text = "";
             tb_prmodifyOldPrice.Text = ModifyService.getPrice(lb_priceList.SelectedValue.ToString()).ToString();
             gd_planned.ItemsSource   = ModifyService.getTicketTimePeriods(lb_priceList.SelectedValue.ToString());
         }
         else
         {
             MessageBox.Show("Błędna cena, data już zaplanowana lub z przeszłości");
         }
     }
     catch (InvalidOperationException)
     {
         MessageBox.Show("Nie wybrano zakresu obowiązywania biletu");
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("Nie wybrano zakresu obowiązywania lub biletu");
     }
     catch (FormatException)
     {
         MessageBox.Show("Nie wybrano nowej ceny");
     }
 }
Exemplo n.º 2
0
 private void Lb_priceList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     bt_changePrice.Visibility           = Visibility.Visible;
     bt_changePriceAttraction.Visibility = Visibility.Hidden;
     if (lb_priceList.SelectedValue != null)
     {
         tb_prmodifyOldPrice.Text = ModifyService.getPrice(lb_priceList.SelectedValue.ToString()).ToString();
     }
     gd_planned.ItemsSource = ModifyService.getTicketTimePeriods(lb_priceList.SelectedValue.ToString());
 }