private void InitializeInformation(Wystawca wystawca) { NazwaBig.Text = wystawca.NazwaFirmy; Nazwa.Text = wystawca.NazwaFirmy; Rozmiar.Text = wystawca.RozmiarStoiska.ToString(); Rodzaj.Text = wystawca.RodzajStoiska; Dane.Text = wystawca.DaneKontaktowe; SellerEventsGrid.Children.Clear(); List <Event> eventy = WystawcaOperations.GetEventyWithWystawca(wystawca); AddEventToList(eventy); }
private void OnSeller(object sender, MouseButtonEventArgs e) { Grid grid = (Grid)sender; Color color = (Color)ColorConverter.ConvertFromString("#FFF58E78"); grid.Background = new SolidColorBrush(color); Label valueLabel = grid.Children.OfType <Label>().FirstOrDefault(); Cursor previousCursor = Mouse.OverrideCursor; Mouse.OverrideCursor = Cursors.Wait; try { Wystawca wystawca = WystawcaOperations.GetWystawcaById(int.Parse(valueLabel.Content.ToString())); SellerStatistics page = new SellerStatistics(wystawca); NavigationService.Navigate(page); } catch { } Mouse.OverrideCursor = previousCursor; }
private void CheckSeller(object sender, MouseButtonEventArgs e) { Grid grid = (Grid)sender; if (checkedGrid == grid) { Color c = (Color)ColorConverter.ConvertFromString("#FFF58E78"); checkedGrid.Background = new SolidColorBrush(c); checkedSeller = null; checkedGrid = null; NextButton.IsEnabled = false; } else if (checkedGrid != null) { Color c = (Color)ColorConverter.ConvertFromString("#FFF58E78"); checkedGrid.Background = new SolidColorBrush(c); checkedSeller = null; checkedGrid = null; Color color = (Color)ColorConverter.ConvertFromString("#FFFFC7BB"); grid.Background = new SolidColorBrush(color); checkedGrid = grid; Label valueLabel = grid.Children.OfType <Label>().FirstOrDefault(); checkedSeller = WystawcaOperations.GetWystawcaById(int.Parse(valueLabel.Content.ToString())); NextButton.IsEnabled = true; } else if (checkedGrid == null) { Color color = (Color)ColorConverter.ConvertFromString("#FFFFC7BB"); grid.Background = new SolidColorBrush(color); checkedGrid = grid; Label valueLabel = grid.Children.OfType <Label>().FirstOrDefault(); checkedSeller = WystawcaOperations.GetWystawcaById(int.Parse(valueLabel.Content.ToString())); NextButton.IsEnabled = true; } }
public void AddNewSellerToDb() { bool isOk = true; NameError.Visibility = Visibility.Hidden; SizeError.Visibility = Visibility.Hidden; TypeError.Visibility = Visibility.Hidden; ContactError.Visibility = Visibility.Hidden; if (NameTextBox.Text == "" || NameTextBox.Text.Length < 3 || NameTextBox.Text.Length > 20) { NameError.Text = "Nazwa powinna zawierać min. 3 znaki i maksymalnie 20 znaków."; NameError.Visibility = Visibility.Visible; isOk = false; } float parse = 0; try { parse = float.Parse(SizeTextBox.Text); if (parse <= 0) { isOk = false; } } catch { SizeError.Text = "Rozmiar stoiska musi być nieujemną liczbą."; SizeError.Visibility = Visibility.Visible; isOk = false; } if (TypeTextBox.Text == "") { TypeError.Text = "To pole jest wymagane."; TypeError.Visibility = Visibility.Visible; isOk = false; } if (ContactTextBox.Text == "") { ContactError.Text = "To pole jest wymagane."; ContactError.Visibility = Visibility.Visible; isOk = false; } if (!isOk) { throw new Exception(); } try { WystawcaOperations.AddNewWystawca(new Wystawca { NazwaFirmy = NameTextBox.Text, RozmiarStoiska = parse, RodzajStoiska = TypeTextBox.Text, DaneKontaktowe = ContactTextBox.Text }); } catch (Exception ex) { ErrorText.Text = ex.Message; ErrorText.Visibility = Visibility.Visible; throw new Exception(); } }