Пример #1
0
 public BestellingController(BestellingRepository bestellingRepository, ProductRepository productRepository, AccountRepository accountRepository, KlantRepository klantRepository)
 {
     this.klantRepository      = klantRepository;
     this.accountRepository    = accountRepository;
     this.productRepository    = productRepository;
     this.bestellingRepository = bestellingRepository;
 }
Пример #2
0
        private static void initializeEventDispatcher()
        {
            string sqlConnectionString = "server=db;userid=jomaya;password=jomaya;database=jomaya-frontend;";

            var optionsBuilder = new DbContextOptionsBuilder <FrontEndContext>();

            optionsBuilder.UseMySQL(sqlConnectionString);
            _context = new FrontEndContext(optionsBuilder.Options);

            _klantRepo      = new KlantRepository(_context);
            _autoRepo       = new AutoRepository(_context);
            _onderhoudsRepo = new OnderhoudRepository(_context);

            var config = new EventBusConfig()
            {
                Host      = "rabbitmq",
                Port      = 5672,
                QueueName = "jomaya.frontend.auto.dispatcher"
            };

            var publisher = new EventPublisher(config);

            _autoDispatcher = new AutoDispatcher(config, _autoRepo, _onderhoudsRepo);

            config = new EventBusConfig()
            {
                Host      = "rabbitmq",
                Port      = 5672,
                QueueName = "jomaya.frontend.klant.dispatcher"
            };
            _klantDispatcher = new KlantDispatcher(config, _klantRepo);
        }
Пример #3
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;
                }
            }
        }
Пример #4
0
 public void RemoveKlantById(int id)
 {
     if (id <= 0)
     {
         throw new ArgumentException("Invalid klantId provided.");
     }
     KlantRepository.RemoveKlantById(id);
 }
Пример #5
0
 public void RemoveKlant(Klant klant)
 {
     if (klant == null)
     {
         throw new ArgumentNullException("Provided klant was null.");
     }
     KlantRepository.RemoveKlant(klant);
 }
Пример #6
0
 public Klant(string Naam, string Adres)
 {
     KlantRepo = new KlantRepository(new KlantContext());
     KlantRepo.AddKlant(Naam, Adres);
     this.Naam        = Naam;
     this.Adres       = Adres;
     this.Klantnummer = KlantRepo.GeefKlantNummer(this);
 }
Пример #7
0
 public WinkelwagenController
 (
     ProductRepository productRepository, KlantRepository klantRepository
 )
 {
     this.klantRepository   = klantRepository;
     this.productRepository = productRepository;
 }
        public DataInitializer(Context ctx)
        {
            _ctx = ctx;

            _klantRepo   = new KlantRepository(ctx);
            _limoRepo    = new LimousineRepository(ctx);
            _locaRepo    = new LocatieRepository(ctx);
            _staffelRepo = new StaffelkortingRepository(ctx);
        }
Пример #9
0
 public void AddKlant(Klant klant)
 {
     if (klant.Bedrijfsnaam != null && klant.Email != null && klant.Huisnummer >= 0 && klant.Postcode != null && klant.Telefoonnummer != null)
     {
         KlantRepository.CreateKlant(klant);
     }
     else
     {
         throw new InvalidOperationException("Invalid arguments were given when creating a klant.");
     }
 }
Пример #10
0
 public UnitOfWork(IsisContext context)
 {
     _context = context;
     Datums = new DatumRepository(context);
     Klanten = new KlantRepository(context);
     KlantTypes = new KlantTypeRepository(context);
     Strijkers = new StrijkerRepository(context);
     Prestaties = new PrestatieRepository(context);
     StukPrestaties = new StukPrestatieRepository(context);
     TijdPrestaties = new TijdPrestatieRepository(context);
 }
Пример #11
0
 public BestellingController
 (
     ProductRepository productRepository,
     BestellingRepository bestellingRepository,
     KlantRepository klantRepository
 )
 {
     this.productRepository    = productRepository;
     this.bestellingRepository = bestellingRepository;
     this.klantRepository      = klantRepository;
 }
Пример #12
0
 public GebruikerController
 (
     KlantRepository klantRepository,
     BestellingRepository bestellingRepository,
     AccountRepository accountRepository
 )
 {
     this.klantRepository      = klantRepository;
     this.bestellingRepository = bestellingRepository;
     this.accountRepository    = accountRepository;
 }
Пример #13
0
        public void TestAdd()
        {
            using (var repo = new KlantRepository(new KlantContext(_options)))
            {
                repo.Insert(new Klant()
                {
                    Voorletters = "YP"
                });
            }


            using (var repo = new KlantRepository(new KlantContext(_options)))
            {
                Assert.AreEqual(1, repo.Count());
            }
        }
Пример #14
0
        public void TestDelete()
        {
            using (var repo = new KlantRepository(new KlantContext(_options)))
            {
                var pen = new Klant()
                {
                    Voorletters = "YP"
                };
                repo.Insert(pen);
                repo.Delete(1);
            }

            using (var repo = new KlantRepository(new KlantContext(_options)))
            {
                Assert.AreEqual(0, repo.Count());
            }
        }
Пример #15
0
        public void TestAdd()
        {
            using (var repo = new KlantRepository(new FrontEndContext(_options)))
            {
                repo.Insert(new Klant()
                {
                    Voorletters = "Y.P",
                    Achternaam  = "Keemink"
                });
            }


            using (var repo = new KlantRepository(new FrontEndContext(_options)))
            {
                Assert.AreEqual(1, repo.Count());
            }
        }
Пример #16
0
        public void Repository_InsertsKlant()
        {
            // Arrange
            var         options = CreateNewContextOptions();
            IRepository target  = new KlantRepository(options);

            var klant = new Klant()
            {
            };

            // Act
            target.Insert(klant);

            // Assert
            using (var context = new KlantContext(options))
            {
                Assert.AreEqual(1, context.Klanten.Count());
            }
        }
Пример #17
0
        public void TestDelete()
        {
            using (var repo = new KlantRepository(new FrontEndContext(_options)))
            {
                Klant klant = new Klant()
                {
                    Voorletters = "Y.P",
                    Achternaam  = "Keemink"
                };
                repo.Insert(klant);
                Assert.AreEqual(1, repo.Count());
                repo.Delete(1);
            }

            using (var repo = new KlantRepository(new FrontEndContext(_options)))
            {
                Assert.AreEqual(0, repo.Count());
            }
        }
Пример #18
0
        public void TestFind()
        {
            using (var repo = new KlantRepository(new FrontEndContext(_options)))
            {
                repo.Insert(new Klant()
                {
                    Voorletters = "Y.P",
                    Achternaam  = "Keemink"
                });
            }

            using (var repo = new KlantRepository(new FrontEndContext(_options)))
            {
                var result = repo.Find(1);
                Assert.AreEqual(1, result.Id);
                Assert.AreEqual("Keemink", result.Achternaam);
                Assert.AreEqual("Y.P", result.Voorletters);
            }
        }
Пример #19
0
        public void TestFindAll()
        {
            using (var repo = new KlantRepository(new KlantContext(_options)))
            {
                var klant = new Klant()
                {
                    Voorletters = "YP"
                };
                repo.Insert(klant);
                klant = new Klant()
                {
                    Voorletters = "YPK"
                };
                repo.Insert(klant);
            }

            using (var repo = new KlantRepository(new KlantContext(_options)))
            {
                Assert.AreEqual(2, repo.Count());
            }
        }
Пример #20
0
 public ObservableCollection <KlantVM> GetKlanten()
 {
     return(new ObservableCollection <KlantVM>(KlantRepository.GetKlanten()));
 }
Пример #21
0
 public void UpdateKlant(Klant k)
 {
     KlantRepository.UpdateKlant(k);
 }
Пример #22
0
        //private readonly AccountViewModelConverter accountController = new AccountViewModelConverter();


        public KlantController(KlantRepository klantRepositorys, BestellingRepository bestellingRepositorys, AccountRepository accountRepositorys)
        {
            this.klantrepository       = klantRepositorys;
            this.bestellingRepositorys = bestellingRepositorys;
            this.accountRepositorys    = accountRepositorys;
        }