Beispiel #1
0
 private void buttonShowAllStudents_Click(object sender, EventArgs e)
 {
     dataGridViewStudents.DataSource = null;
     dataGridViewStudents.DataSource = _readStudentRepository.GetAll()
                                       .Select(x => new
     {
         Imię        = x.Name,
         Nazwisko    = x.Surname,
         Miasto      = x.Address.City,
         KodPocztowy = x.Address.PostCode
     })
                                       .ToList();
 }
 public void ShowSupplies()
 {
     dataGridViewRestaurantManagementSystem.DataSource = null;
     dataGridViewRestaurantManagementSystem.DataSource = _readSupplyRepository
                                                         .GetAll()
                                                         .Select(x => new
     {
         x.ID,
         Data_Zamowienia   = x.Date,
         Zamowiony_Produkt = x.OrderedProduct,
         Cena     = x.Price,
         Dostawca = _readSupplierRepository.GetByID(x.ProviderID).Name
     }).ToList();
     _currentTable = "supplies";
 }
 public void ShowSuppliers()
 {
     dataGridViewRestaurantManagementSystem.DataSource = null;
     dataGridViewRestaurantManagementSystem.DataSource = _readSupplierRepository
                                                         .GetAll()
                                                         .Select(x => new
     {
         x.ID,
         Nazwa       = x.Name,
         Lokalizacja = x.Localization,
         Czas_Dostaw = x.DeliveryTime,
     }).ToList();
     _currentTable = "suppliers";
 }
 public void ShowMenuProducts()
 {
     dataGridViewRestaurantManagementSystem.DataSource = null;
     dataGridViewRestaurantManagementSystem.DataSource = _readMenuProductRepository
                                                         .GetAll()
                                                         .Select(x => new
     {
         x.ID,
         Kategoria  = x.Category,
         Nazwa      = x.Name,
         Ilosc_Kcal = x.AmountOfCalories,
         Cena       = x.Price
     }).ToList();
     _currentTable = "menuproducts";
 }
 //Metody wyświetlające obiekty tabel z bazy danych w DataGridView
 public void ShowSellers()
 {
     dataGridViewRestaurantManagementSystem.DataSource = null;
     dataGridViewRestaurantManagementSystem.DataSource = _readSellerRepository
                                                         .GetAll()
                                                         .Select(x => new
     {
         x.ID,
         Imie_Sprzedawcy        = x.Name,
         Nazwisko               = x.Surname,
         Lata_Doswiadczenia     = x.YearsOfExperience,
         Znajomosc_Angielskiego = x.EnglishLevel,
     }).ToList();
     _currentTable = "sellers";
 }
 public void ShowOrders()
 {
     dataGridViewRestaurantManagementSystem.DataSource = null;
     dataGridViewRestaurantManagementSystem.DataSource = _readOrderRepository
                                                         .GetAll()
                                                         .Select(x => new
     {
         x.ID,
         Data        = x.Date,
         Sprzedajacy = _readSellerRepository.GetByID(x.SellerID).Name + " " + _readSellerRepository.GetByID(x.SellerID).Surname,
         Cena        = x.Price,
         Kalorie     = x.AmountOfCalories,
     }).ToList();
     _currentTable = "orders";
 }
Beispiel #7
0
        //Po kliknięciu danego przycisku okoreślającego kategorię produktów menu wyświetli się lista tychże produktów.
        private void buttonCategories_Click(object sender, EventArgs e)
        {
            var button = (Button)sender;
            var option = button.Text;

            switch (option)
            {
            case "Kubełki":

                dataGridViewListOfProducts.DataSource = null;
                dataGridViewListOfProducts.DataSource = _readMenuProductRepository.GetAll().Where(x => x.Category == "kubełek").Select(x => new
                {
                    x.ID,
                    Kategoria  = x.Category,
                    Nazwa      = x.Name,
                    Ilosc_Kcal = x.AmountOfCalories,
                    Cena       = x.Price
                }).ToList();
                break;

            case "Big Boxy":
                dataGridViewListOfProducts.DataSource = null;
                dataGridViewListOfProducts.DataSource = _readMenuProductRepository.GetAll().Where(x => x.Category == "big box").Select(x => new
                {
                    x.ID,
                    Kategoria  = x.Category,
                    Nazwa      = x.Name,
                    Ilosc_Kcal = x.AmountOfCalories,
                    Cena       = x.Price
                }).ToList();
                break;

            case "Zestawy":
                dataGridViewListOfProducts.DataSource = null;
                dataGridViewListOfProducts.DataSource = _readMenuProductRepository.GetAll().Where(x => x.Category == "zestaw").Select(x => new
                {
                    x.ID,
                    Kategoria  = x.Category,
                    Nazwa      = x.Name,
                    Ilosc_Kcal = x.AmountOfCalories,
                    Cena       = x.Price
                }).ToList();
                break;

            case "Kanapki":
                dataGridViewListOfProducts.DataSource = null;
                dataGridViewListOfProducts.DataSource = _readMenuProductRepository.GetAll().Where(x => x.Category == "kanapka").Select(x => new
                {
                    x.ID,
                    Kategoria  = x.Category,
                    Nazwa      = x.Name,
                    Ilosc_Kcal = x.AmountOfCalories,
                    Cena       = x.Price
                }).ToList();
                break;

            case "Sałatki":
                dataGridViewListOfProducts.DataSource = null;
                dataGridViewListOfProducts.DataSource = _readMenuProductRepository.GetAll().Where(x => x.Category == "sałatka").Select(x => new
                {
                    x.ID,
                    Kategoria  = x.Category,
                    Nazwa      = x.Name,
                    Ilosc_Kcal = x.AmountOfCalories,
                    Cena       = x.Price
                }).ToList();
                break;

            case "Napoje":
                dataGridViewListOfProducts.DataSource = null;
                dataGridViewListOfProducts.DataSource = _readMenuProductRepository.GetAll().Where(x => x.Category == "napój").Select(x => new
                {
                    x.ID,
                    Kategoria  = x.Category,
                    Nazwa      = x.Name,
                    Ilosc_Kcal = x.AmountOfCalories,
                    Cena       = x.Price
                }).ToList();
                break;
            }
        }