예제 #1
0
        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);
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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");
            }
        }
예제 #4
0
        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;
            }
        }
예제 #5
0
        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;
        }
예제 #6
0
        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");
            }
        }
예제 #7
0
        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;
            }
        }
예제 #8
0
        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());
        }
예제 #9
0
 public static void AddWystawcaToOrganizator(Wystawca wystawca)
 {
     loggedUzytkownik.Organizator.Wystawcy.Add(wystawca);
     database.SaveChanges();
 }
예제 #10
0
 public SellerStatistics(Wystawca wystawca)
 {
     InitializeComponent();
     InitializeInformation(wystawca);
 }