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); }
public static Wystawca GetWystawcaById(int id) { Wystawca wyst = database.Wystawcy.Where(x => x.IdWystawca == id).FirstOrDefault(); if (wyst == null) { throw new Exception("Nie znaleziono eventu w bazie danych."); } else { return(wyst); } }
public static void AddNewWystawca(Wystawca wystawca) { try { database.Wystawcy.Add(wystawca); database.SaveChanges(); UzytkownikOperations.AddWystawcaToOrganizator(wystawca); } catch (Exception ex) { throw new Exception("Dodawanie wystawcy do bazy nie powiodło się. Błąd bazy danych"); } }
public AddSeller(Event checkedEvent, Wystawca checkedSeller) { InitializeComponent(); eventForAdding = checkedEvent; wystForAdding = checkedSeller; try { EventOperations.AddWystawcaToEvent(eventForAdding, wystForAdding); ResultText.Text = "Dodawanie wystawcy do eventu zakończono pomyślnie."; DataText.Text = "Wystawca " + wystForAdding.NazwaFirmy + " został przypisany do eventu " + eventForAdding.NazwaEventu + "."; DataText.Visibility = Visibility.Visible; } catch (Exception ex) { ResultText.Foreground = new SolidColorBrush(Colors.Red); ResultText.Text = ex.Message; } }
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; }
public static void AddWystawcaToEvent(Event evnt, Wystawca wyst) { Event_Wystawca check = database.Event_Wystawcy.Where(x => x.IdEvent == evnt.IdEvent && x.IdWystawca == wyst.IdWystawca).FirstOrDefault(); if (check != null) { throw new Exception("Wystawca jest już przypisany do tego eventu."); } try { database.Event_Wystawcy.Add(new Event_Wystawca { IdEvent = evnt.IdEvent, IdWystawca = wyst.IdWystawca }); database.SaveChanges(); } catch { throw new Exception("Dodawanie wystawcy do eventu nie powiodło się. Błąd bazy danych"); } }
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; } }
internal static List <Event> GetEventyWithWystawca(Wystawca wystawca) { List <Event_Wystawca> eW = database.Event_Wystawcy.Include(x => x.Event).Where(x => x.IdWystawca == wystawca.IdWystawca).ToList(); return(eW.Select(x => x.Event).ToList()); }
public static void AddWystawcaToOrganizator(Wystawca wystawca) { loggedUzytkownik.Organizator.Wystawcy.Add(wystawca); database.SaveChanges(); }
public SellerStatistics(Wystawca wystawca) { InitializeComponent(); InitializeInformation(wystawca); }