Exemplo n.º 1
0
 public BestellingController(BestellingRepository bestellingRepository, ProductRepository productRepository, AccountRepository accountRepository, KlantRepository klantRepository)
 {
     this.klantRepository      = klantRepository;
     this.accountRepository    = accountRepository;
     this.productRepository    = productRepository;
     this.bestellingRepository = bestellingRepository;
 }
Exemplo n.º 2
0
        public void Initialize()
        {
            bestellingRepo = new BestellingRepository(new BestellingMemoryContext());
            bestellingen   = new ObservableCollection <Bestelling>(bestellingRepo.GetAll());

            List <ToeslagPercentage> toeslagPercentage = new List <ToeslagPercentage>();

            toeslagPercentage.Add(new ToeslagPercentage(0, 1275, DateTime.Now.AddDays(-30), DateTime.Now.AddDays(-1)));
            toeslagPercentage.Add(new ToeslagPercentage(1, 571, DateTime.Now.AddDays(-1)));

            bestellingen.Add(new Bestelling(1, DateTime.Now.AddDays(-4), DateTime.Now, DateTime.Now, toeslagPercentage[0], false, new Klant(1), new ObservableCollection <Bestelregel>()
            {
                new Bestelregel(1, new Plant(1), 40, 45,
                                new ObservableCollection <Levering>()
                {
                    new Levering(1, 20, DateTime.Now.AddDays(-2), true),
                    new Levering(2, 20, DateTime.Now, true)
                }),
                new Bestelregel(2, new Plant(2), 40, 23),
                new Bestelregel(3, new Plant(2), 40, 25),
                new Bestelregel(4, new Plant(2), 40, 32),
            }));

            bestellingen.Add(new Bestelling(2, DateTime.Now.AddDays(-4), DateTime.Now, DateTime.Now, toeslagPercentage[0], false, new Klant(1), new ObservableCollection <Bestelregel>()
            {
                new Bestelregel(1, new Plant(1), 1, 100),
            }));

            bestellingen.Add(new Bestelling(3, DateTime.Now, DateTime.Now, DateTime.Now, toeslagPercentage[0], false, new Klant(1), new ObservableCollection <Bestelregel>()));
        }
 public BestellingController(IConfiguration config)
 {
     BestellingContext = new BestellingMSSQLContext(config.GetConnectionString("DefaultConnection"));
     GerechtContext    = new GerechtMSSQLContext(config.GetConnectionString("DefaultConnection"));
     BestellingRepo    = new BestellingRepository(BestellingContext, GerechtContext);
     GerechtRepo       = new GerechtRepository(GerechtContext);
 }
Exemplo n.º 4
0
        public Kwekerij(string bedrijfsnaam, string straat, string postcode, string plaats, string telefoonnummer, string faxnummer, string mobiel, string email, string iban, string btwNummer, string kvkNummer)
        {
            // Initialize Properties
            Bedrijfsnaam   = bedrijfsnaam;
            Straat         = straat;
            Postcode       = postcode;
            Plaats         = plaats;
            Telefoonnummer = telefoonnummer;
            Faxnummer      = faxnummer;
            Mobiel         = mobiel;
            Email          = email;
            Iban           = iban;
            BtwNummer      = btwNummer;
            KvkNummer      = kvkNummer;

            // Initialize Repositories with Contexts
            klantRepo      = new KlantRepository(new KlantSQLiteContext());
            bestellingRepo = new BestellingRepository(new BestellingSQLiteContext());
            plantRepo      = new PlantRepository(new PlantSQLiteContext());

            // Initialize Lists
            Klanten      = new ObservableCollection <Klant>(klantRepo.GetAll());
            Planten      = new ObservableCollection <Plant>(plantRepo.GetAll());
            Bestellingen = new ObservableCollection <Bestelling>(bestellingRepo.GetAll());

            // Bind
            foreach (Bestelling bestelling in Bestellingen)
            {
                bestelling.Klant = Klanten.Single(k => k.Id == bestelling.Klant.Id);
                foreach (Bestelregel bestelregel in bestelling.Bestelregels)
                {
                    bestelregel.Plant = Planten.Single(p => p.Id == bestelregel.Plant.Id);
                }
            }

            // Initialialize Change Events in Observable Lists
            Klanten.CollectionChanged += ObservableListCollection_CollectionChanged;
            foreach (Klant klant in Klanten)
            {
                klant.PropertyChanged += ItemPropertyChanged;
            }

            Planten.CollectionChanged += ObservableListCollection_CollectionChanged;
            foreach (Plant plant in Planten)
            {
                plant.PropertyChanged += ItemPropertyChanged;
            }

            Bestellingen.CollectionChanged += ObservableListCollection_CollectionChanged;
            foreach (Bestelling bestelling in Bestellingen)
            {
                bestelling.PropertyChanged += ItemPropertyChanged;
                bestelling.Bestelregels.CollectionChanged += ObservableListCollection_CollectionChanged;
                foreach (Bestelregel bestelregel in bestelling.Bestelregels)
                {
                    bestelregel.Leveringen.CollectionChanged += ObservableListCollection_CollectionChanged;
                }
            }
        }
Exemplo n.º 5
0
        public Pizzeria()
        {
            InventarisRepo = new InventarisRepository(new InventarisContext());
            BestellingRepo = new BestellingRepository(new BestellingContext());
            Klant unknownKlant = new Klant("Unknown", "Unknown");

            HuidigeBestelling = new Bestelling(unknownKlant);
            GetLists();
        }
Exemplo n.º 6
0
 public BestellingController
 (
     ProductRepository productRepository,
     BestellingRepository bestellingRepository,
     KlantRepository klantRepository
 )
 {
     this.productRepository    = productRepository;
     this.bestellingRepository = bestellingRepository;
     this.klantRepository      = klantRepository;
 }
Exemplo n.º 7
0
 public GebruikerController
 (
     KlantRepository klantRepository,
     BestellingRepository bestellingRepository,
     AccountRepository accountRepository
 )
 {
     this.klantRepository      = klantRepository;
     this.bestellingRepository = bestellingRepository;
     this.accountRepository    = accountRepository;
 }
Exemplo n.º 8
0
 private void GetDatabaseStuff()
 {
     LedenlogRepo          = new LedenLogRepository(new SqlLedenLog(_connectieString));
     BestellingRepo        = new BestellingRepository(new SqlBestelling(_connectieString));
     LedenRepo             = new LidRepository(new SqlLid(_connectieString));
     AdresRepo             = new AdresRepository(new SqlAdres(_connectieString));
     BankRepo              = new BankRepository(new SqlBank(_connectieString));
     OudercontactRepo      = new OudercontactRepository(new SqlOudercontact(_connectieString));
     AuthenticatieRepo     = new AuthenticatieRepository(new SqlAuthentication(_connectieString));
     ProductbestellingRepo = new ProductBestellingRepository(new SqlProductBestelling(_connectieString));
     ProductRepo           = new ProductRepository(new SqlProduct(_connectieString));
     KassaRepo             = new KassaRepository(new SqlKassa(_connectieString));
     OmzetRepo             = new OmzetRepository(new SqlOmzet(_connectieString));
     KlasseRepo            = new KlasseRepository(new SqlKlasse(_connectieString));
     KassaLogRepo          = new KassaLogRepository(new SqlKassaLog(_connectieString));
     VoorraadControleRepo  = new VoorraadControleRepository(new SqlVoorraadControle(_connectieString));
 }
Exemplo n.º 9
0
 public void Cleanup()
 {
     bestellingRepo = null;
     bestellingen   = null;
     ToeslagPercentage.Percentages = null;
 }
Exemplo n.º 10
0
        //private readonly AccountViewModelConverter accountController = new AccountViewModelConverter();


        public KlantController(KlantRepository klantRepositorys, BestellingRepository bestellingRepositorys, AccountRepository accountRepositorys)
        {
            this.klantrepository       = klantRepositorys;
            this.bestellingRepositorys = bestellingRepositorys;
            this.accountRepositorys    = accountRepositorys;
        }
Exemplo n.º 11
0
        public void CreateBestellingTest()
        {
            var bestelling = new Bestelling()
            {
                Klant = new Klant()
                {
                    AzureId = "TestUser"
                },
                Id          = 1,
                TotaalPrijs = 60,
                Producten   = new List <BestellingItem>()
                {
                    new BestellingItem()
                    {
                        Aantal  = 2,
                        Id      = 1,
                        Product = new Cursus()
                        {
                            Titel             = "dotNET cursus",
                            Type              = ".NET",
                            Prijs             = 15,
                            Categorie         = "Cursus",
                            IsBuyable         = true,
                            Beschrijving      = "Some example text some ...",
                            LangeBeschrijving = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
                            FotoURLCard       = "https://52bec9fb483231ac1c712343-jebebgcvzf.stackpathdns.com/wp-content/uploads/2016/05/dotnet.jpg"
                        }
                    },
                    new BestellingItem()
                    {
                        Aantal  = 1,
                        Id      = 2,
                        Product = new Traject()
                        {
                            Titel             = "dotNET cursus",
                            Type              = ".NET",
                            Prijs             = 30,
                            Categorie         = "Cursus",
                            IsBuyable         = true,
                            Beschrijving      = "Some example text some ...",
                            LangeBeschrijving = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
                            FotoURLCard       = "https://52bec9fb483231ac1c712343-jebebgcvzf.stackpathdns.com/wp-content/uploads/2016/05/dotnet.jpg"
                        }
                    }
                }
            };

            var mockSet = new Mock <DbSet <Bestelling> >();

            var mockContext = new Mock <DatabaseContext>();

            mockContext.Setup(m => m.Bestellingen).Returns(mockSet.Object);

            var repo = new BestellingRepository(mockContext.Object);
            var createdBestelling = repo.AddBestellingToCustomer(bestelling);

            // Assert
            mockSet.Verify(m => m.Add(It.IsAny <Bestelling>()), Times.Once);
            Assert.AreEqual(bestelling.TotaalPrijs, createdBestelling.TotaalPrijs);
            Assert.IsNotNull(createdBestelling);
            Assert.AreEqual(bestelling.Producten.Count(), createdBestelling.Producten.Count());
            Assert.AreEqual(bestelling.Producten, createdBestelling.Producten);
            Assert.AreEqual(bestelling.Klant.AzureId, createdBestelling.Klant.AzureId);
        }