Beispiel #1
0
 public CursistTest()
 {
     locatie = new Locatie("a", 2, "Bel", 9000, "Gent");
     school  = school = new School("Test", "*****@*****.**", locatie);
     email   = "*****@*****.**";
     cursist = new Cursist("Jochem", "Van Hespen", "*****@*****.**");
 }
Beispiel #2
0
        public static List <Locatie> GetLocaties()
        {
            SqlConnection connection = DALConnection.GetConnectionByName("Reader");

            List <Locatie> locations = new List <Locatie>();

            // select all columns (but no * because columns may be added in the future)
            string sqlQuery = "SELECT LocatieId, Gebouw, Zaal, Omschrijving FROM Locatie";

            SqlCommand    command = new SqlCommand(sqlQuery, connection);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                Locatie location = new Locatie();

                location.Id           = (int)reader["LocatieId"];
                location.Gebouw       = (string)reader["Gebouw"];
                location.Zaal         = (string)reader["Zaal"];
                location.Omschrijving = (string)reader["Omschrijving"];

                locations.Add(location);
            }

            // dispose of all open connections
            reader.Close();
            DALConnection.CloseSqlConnection(connection);

            return(locations);
        }
        public ActionResult Create(VoorraadViewModel voorraadViewModel)
        {
            Voorraad newVoorraad = new Voorraad();

            ProductLocatie_regel newLocatie = new ProductLocatie_regel(voorraadViewModel.Aantal);

            ProductLocatie_regel newProductLocatieRegel = new ProductLocatie_regel(voorraadViewModel.Aantal);

            if (voorraadViewModel.ProductId != null)
            {
                foreach (int item in voorraadViewModel.ProductId)
                {
                    Product foundProduct = db.ProductDbSet.Find(item);
                    ProductVoorraad_regel productVoorraad = new ProductVoorraad_regel {
                        Product = foundProduct, Voorraad = newVoorraad
                    };                                                                                                                    //maak een nieuwe productvoorraadregel aan met het id van product en id van voorraad
                    newVoorraad.VoorraadProduct.Add(productVoorraad);
                }
            }
            if (voorraadViewModel.LocatieId != null)
            {
                foreach (int item in voorraadViewModel.LocatieId)
                {
                    Locatie foundLocatie = db.LocatieDbSet.Find(item);
                    ProductLocatie_regel productLocatie = new ProductLocatie_regel {
                        Locatie = foundLocatie, Voorraad = newVoorraad, Aantal = newProductLocatieRegel.Aantal
                    };                                                                                                                                                         //maak een nieuwe productlocatie regel aan in de db met productid van product en locatieid van loatie en het aantal (stuks) producten dat is meegegeven
                    newVoorraad.LocatieProduct.Add(productLocatie);
                }

                db.VoorraadDbSet.Add(newVoorraad);
                db.SaveChanges();
            }
            return(this.RedirectToAction("Index"));
        }
Beispiel #4
0
        public void DeleteRestaurant(int restaurantid)
        {
            Restaurant dbRestaurant = ctx.RESTAURANTS.SingleOrDefault(r => r.RestaurantID == restaurantid);

            if (dbRestaurant != null)
            {
                ctx.RESTAURANTS.Remove(dbRestaurant);
            }
            IEnumerable <Afbeelding> dbAfbeeldingen = (from a in ctx.AFBEELDINGEN
                                                       where a.RestaurantID == restaurantid
                                                       select a).ToList();

            if (dbAfbeeldingen != null && dbAfbeeldingen.Any())
            {
                foreach (Afbeelding dbAfbeelding in dbAfbeeldingen)
                {
                    ctx.AFBEELDINGEN.Remove(dbAfbeelding);
                }
            }

            //On delete cascade will remove this for me
            Locatie dbLocatie = ctx.LOCATIES.SingleOrDefault(l => l.LocatieID == dbRestaurant.LocatieID);

            //if (dbLocatie != null)
            //    ctx.LOCATIES.Remove(dbLocatie);

            ctx.SaveChanges();
        }
Beispiel #5
0
        public async Task <IActionResult> PutMarker([FromBody] Locatie locatie, [FromRoute] int regioid, [FromRoute] int locatieid)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var regio = await _context.Regios.Include(r => r.locaties).ThenInclude(l => l.puzzels).SingleOrDefaultAsync(m => m.id == regioid);

            if (regio == null)
            {
                return(NotFound());
            }
            var dblocatie = regio.locaties.SingleOrDefault(r => r.id == locatieid);

            if (dblocatie == null)
            {
                return(NotFound());
            }
            dblocatie.lat         = locatie.lat;
            dblocatie.lng         = locatie.lng;
            dblocatie.locatienaam = locatie.locatienaam;
            //await _context.SaveChangesAsync();
            _context.SaveChanges();

            return(Ok(dblocatie));
        }
Beispiel #6
0
        public void UpdateMuseum(Museum museum)
        {
            Museum dbMuseum = ctx.MUSEA.SingleOrDefault(m => m.MuseumID == museum.MuseumID);

            if (dbMuseum != null)
            {
                dbMuseum.Naam         = museum.Naam;
                dbMuseum.LocatieID    = museum.LocatieID;
                dbMuseum.Omschrijving = museum.Omschrijving;
                dbMuseum.Maandag      = museum.Maandag;
                dbMuseum.Dinsdag      = museum.Dinsdag;
                dbMuseum.Woensdag     = museum.Woensdag;
                dbMuseum.Donderdag    = museum.Donderdag;
                dbMuseum.Vrijdag      = museum.Vrijdag;
                dbMuseum.Zaterdag     = museum.Vrijdag;
                dbMuseum.Zondag       = museum.Zondag;
                dbMuseum.Kids         = museum.Kids;
                dbMuseum.Adults       = museum.Adults;
                dbMuseum.Telefoon     = museum.Telefoon;
                dbMuseum.Website      = museum.Website;

                Afbeelding dbAfbeelding = ctx.AFBEELDINGEN.SingleOrDefault(a => a.MuseumID == museum.MuseumID && a.Type == "museumbanner");
                if (dbAfbeelding != null)
                {
                    dbAfbeelding.Link = museum.MuseumAfbeelding.Link;
                }
                Afbeelding dbOverview = ctx.AFBEELDINGEN.SingleOrDefault(a => a.MuseumID == museum.MuseumID && a.Type == "museumoverview");
                if (dbOverview != null)
                {
                    dbOverview.Link = museum.OverviewAfbeelding.Link;
                }
                Locatie dbLocatie = ctx.LOCATIES.SingleOrDefault(l => l.LocatieID == museum.LocatieID);
                ctx.SaveChanges();
            }
        }
Beispiel #7
0
        public void UpdateRestaurant(Restaurant restaurant)
        {
            Restaurant dbRestaurant = ctx.RESTAURANTS.SingleOrDefault(r => r.RestaurantID == restaurant.RestaurantID);

            if (dbRestaurant != null)
            {
                dbRestaurant.Telefoon     = restaurant.Telefoon;
                dbRestaurant.Email        = restaurant.Email;
                dbRestaurant.Website      = restaurant.Website;
                dbRestaurant.Naam         = restaurant.Naam;
                dbRestaurant.Omschrijving = restaurant.Omschrijving;
                Afbeelding dbAfbeelding = ctx.AFBEELDINGEN.SingleOrDefault(a => a.RestaurantID == restaurant.RestaurantAfbeelding.AfbeeldingID && a.Type == "restaurantbanner");
                if (dbRestaurant != null)
                {
                    dbAfbeelding.Link = restaurant.RestaurantAfbeelding.Link;
                }
                Afbeelding dbOverview = ctx.AFBEELDINGEN.SingleOrDefault(a => a.RestaurantID == restaurant.OverviewAfbeelding.AfbeeldingID && a.Type == "restaurantoverview");
                if (dbOverview != null)
                {
                    dbOverview.Link = restaurant.OverviewAfbeelding.Link;
                }
                Locatie dbLocatie = ctx.LOCATIES.SingleOrDefault(l => l.LocatieID == restaurant.LocatieID);
                if (dbLocatie != null)
                {
                    dbLocatie.Straat     = restaurant.RestaurantLocatie.Straat;
                    dbLocatie.Huisnummer = restaurant.RestaurantLocatie.Huisnummer;
                    dbLocatie.Toevoeging = restaurant.RestaurantLocatie.Toevoeging;
                    dbLocatie.Postcode   = restaurant.RestaurantLocatie.Postcode;
                    dbLocatie.Plaats     = restaurant.RestaurantLocatie.Plaats;
                }
                ctx.SaveChanges();
            }
        }
Beispiel #8
0
        private void OnZoekBeschikbareLimosClick(object sender, RoutedEventArgs e)
        {
            //DateTime? startDatum = StartDatumDatePicker.SelectedDate;
            //DateTime? eindDatum = EindDatumDatePicker.SelectedDate;

            DateTime startDatum;
            DateTime eindDatum;

            if (StartDatumDatePicker.SelectedDate == null)
            {
                startDatum = DateTime.MinValue;
            }
            else
            {
                startDatum = (DateTime)StartDatumDatePicker.SelectedDate;
            }

            if (EindDatumDatePicker.SelectedDate == null)
            {
                eindDatum = DateTime.MaxValue;
            }
            else
            {
                eindDatum = (DateTime)EindDatumDatePicker.SelectedDate;
            }

            Locatie     startLocatie = (Locatie)StartLocatieComboBox.SelectionBoxItem;
            Arrangement arrangement  = (Arrangement)ArrangementComboBox.SelectionBoxItem;

            BeschikbareLimosListView.ItemsSource = _repo.OphalenLimosMetFilters(startDatum, eindDatum, startLocatie, arrangement);
        }
        public List <Standplaats> GetByLocatie(Locatie locatie)
        {
            SqlConnection      conn          = Connection.SQLconnection;
            List <Standplaats> staanplaatsen = new List <Standplaats>();

            try
            {
                string     query = "SELECT P.ID, P.capaciteit, P.nummer, S.naam, P.prijs FROM PLEK P INNER JOIN PLEK_SPECIFICATIE PS ON P.ID = PS.plek_id INNER JOIN SPECIFICATIE S ON PS.specificatie_id = S.ID WHERE S.naam != 'coordinaat x' AND S.naam != 'coordinaat y' AND PS.waarde = 'ja' AND P.locatie_id = @locatieid";
                SqlCommand cmd   = new SqlCommand(query, conn);
                cmd.Parameters.AddWithValue("@locatieid", locatie.Id);

                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    int     ID           = Convert.ToInt32(reader["P.ID"].ToString());
                    int     capaciteit   = Convert.ToInt32(reader["P.capaciteit"].ToString());
                    int     nummer       = Convert.ToInt32(reader["P.nummer"].ToString());
                    decimal prijs        = Convert.ToDecimal(reader["P.prijs"].ToString());
                    string  specificatie = reader["S.naam"].ToString();

                    staanplaatsen.Add(new Standplaats(ID, nummer, capaciteit, prijs, specificatie));
                }
                conn.Close();
            }
            catch { }
            return(staanplaatsen);
        }
        public List <Standplaats> GetFreeStaanplaatsenByLocatie(Locatie locatie, DateTime startdatum, DateTime einddatum)
        {
            SqlConnection      conn          = Connection.SQLconnection;
            List <Standplaats> staanplaatsen = new List <Standplaats>();

            try
            {
                string query =
                    "SELECT * FROM (SELECT a.ID, a.capaciteit, a.nummer, a.prijs, S.naam, ROW_NUMBER() OVER (PARTITION BY a.id ORDER BY a.ID) AS RowNumber FROM PLEK a FULL OUTER JOIN PLEK_RESERVERING b on b.plek_id = a.ID LEFT JOIN RESERVERING c on c.ID = b.reservering_id LEFT JOIN PLEK_SPECIFICATIE PS on a.ID = PS.plek_id LEFT JOIN SPECIFICATIE S on PS.specificatie_id = S.ID  WHERE a.locatie_id = 1 AND S.naam != 'coordinaat x' AND S.naam != 'coordinaat y' AND PS.waarde = 'ja' AND (('06/12/2017' NOT BETWEEN c.datumStart AND c.datumEinde AND '06/14/2017' NOT BETWEEN c.datumStart AND c.datumEinde) OR (c.datumStart is null AND c.datumEinde is null))) AS a WHERE a.rownumber = 1";
                SqlCommand cmd = new SqlCommand(query, conn);
                cmd.Parameters.AddWithValue("@locatieid", locatie.Id);
                cmd.Parameters.AddWithValue("@begindatum", startdatum);
                cmd.Parameters.AddWithValue("@einddatum", einddatum);

                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    int     ID           = Convert.ToInt32(reader["ID"]);
                    int     capaciteit   = Convert.ToInt32(reader["capaciteit"]);
                    int     nummer       = Convert.ToInt32(reader["nummer"]);
                    decimal prijs        = Convert.ToDecimal(reader["prijs"]);
                    string  specificatie = reader["naam"].ToString();

                    staanplaatsen.Add(new Standplaats(ID, nummer, capaciteit, prijs, specificatie));
                }
                conn.Close();
            }
            catch
            {
                throw;
            }
            return(staanplaatsen);
        }
Beispiel #11
0
        public ActionResult Verwijder(int?id)
        {
            var locatie = new Locatie(id.GetValueOrDefault());

            locatie.Verwijderen();

            return(RedirectToAction("Index"));
        }
Beispiel #12
0
        public ActionResult Bewerk(int?id, string txtNaam, string txtAdres, string txtPostcode, string txtPlaats)
        {
            var locatie = new Locatie(id.GetValueOrDefault());

            locatie.Opslaan(txtNaam, txtAdres, txtPostcode, txtPlaats);

            return(RedirectToAction("Index"));
        }
Beispiel #13
0
        // methodes

        public override string ToString()
        {
            return("Latijnse naam: " + LatijnseNaam + Environment.NewLine
                   + Environment.NewLine + "Nederlandse naam: " + NederlandseNaam
                   + Environment.NewLine + Environment.NewLine + "Levensduur: " + Levensduur
                   + Environment.NewLine + Environment.NewLine + "Bloeiwijze: " + BloeiwijzePlant
                   + Environment.NewLine + Environment.NewLine + "Locatie: " + Locatie.ToString());
        }
 public LocatieViewModel(Locatie l)
 {
     this.Continent    = l.Land.Continent.Naam;
     this.Land         = l.Land.Naam;
     this.Naam         = l.Naam;
     this.Lengtegraad  = l.Klimatogram.Lengtegraad;
     this.Breedtegraad = l.Klimatogram.Breedtegraad;
 }
Beispiel #15
0
        public void KlimatogramToekennenEnOpvragenGeeftCorrecteKlimatogram()
        {
            string naam = "Ukkel";

            locatie             = new Locatie(naam);
            locatie.Klimatogram = klimatogram;
            Assert.AreEqual(klimatogram, locatie.Klimatogram);
        }
        public ActionResult Aanmaken(string locatie, DateTime datumVan, DateTime datumTot, string titel, string beschrijving)
        {
            Locatie = new Locatie();
            Event events = new Event(Locatie.LocatieBijNaam(locatie), datumVan, datumTot, titel, beschrijving);

            events.EventAanmaken(events);
            return(RedirectToAction("Index", "Beheer"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Locatie locatie = db.Locaties.Find(id);

            db.Locaties.Remove(locatie);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #18
0
        public ActionResult DeleteConfirmed(int id)
        {
            Locatie locatie = db.LocatieDbSet.Find(id); // verwijder de locatie met hetzelfde id als is meegegeven in de link

            db.LocatieDbSet.Remove(locatie);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #19
0
        public void LocatieKanSlechtsEenmaalToegevoegdWorden()
        {
            Land    l   = new Land("België");
            Locatie naz = new Locatie("Nazareth");

            l.VoegLocatieToe(naz);
            l.VoegLocatieToe(naz);
        }
        public ActionResult <Locatie> PostLocatie(Locatie item)
        {
            _repo.Create(item);
            _repo.Save();


            return(CreatedAtAction(nameof(GetLocatie), new { id = item.Id }, item));
        }
Beispiel #21
0
        public void LandToevoegenPastAttribuutContinentVanDatLandAan()
        {
            Land    belgie = new Land("België");
            Locatie ukkel  = new Locatie("Ukkel");

            belgie.VoegLocatieToe(ukkel);
            Assert.AreEqual(belgie, ukkel.Land);
        }
Beispiel #22
0
        public void VoegLocatieToeVoegtEenLocatieToe()
        {
            Land    belgië = new Land("België");
            Locatie gent   = new Locatie("TestLocatie");

            belgië.VoegLocatieToe(gent);
            Assert.IsTrue(belgië.Locaties.Contains(gent));
        }
        //Gebruik bij EEN locatie geselecteerd
        public LocationSelector(int eventId, int locatieId)
        {
            InitializeComponent();

            //eventId koppelen aan DataBase ==> eventId
            this.eventId = eventId;
            eventItem    = DatabaseOperations.OphalenEvent(eventId);
            locatie      = DatabaseOperations.OphalenLocatie(locatieId);
        }
        public ActionResult Bewerk(int?id)
        {
            var ronde    = new Ronde(id.GetValueOrDefault());
            var locaties = Locatie.GeefLijst().OrderBy(l => l.Naam).ToList();

            ViewBag.Locaties = locaties;

            return(View(ronde));
        }
        public ActionResult <Locatie> PostLocatie(LocatieDTO locatieDTO)
        {
            Locatie locatieToCreate = new Locatie(locatieDTO.Gemeente, locatieDTO.Straatnaam, locatieDTO.Huisnummer, locatieDTO.Postcode);

            _locatieRepository.Add(locatieToCreate);
            _locatieRepository.SaveChanges();

            return(CreatedAtAction(nameof(GetLocatie), new { id = locatieToCreate.LocatieId }, locatieToCreate));
        }
Beispiel #26
0
 public Contract(Guid?guid, Guid employeeGuid, decimal fte, string function, Locatie location, DateTime startDate, DateTime?endDate)
 {
     Guid         = guid ?? Guid.NewGuid();
     EmployeeGuid = employeeGuid;
     Fte          = fte;
     Function     = function;
     Location     = location;
     StartDate    = startDate;
     EndDate      = EndDate;
 }
 public IActionResult PutLocatie(int id, Locatie locatie)
 {
     if (id != locatie.Id)
     {
         return(BadRequest());
     }
     _locatieRepository.Update(locatie);
     _locatieRepository.SaveChanges();
     return(NoContent());
 }
 public ActionResult Edit(Locatie locatie)
 {
     if (ModelState.IsValid)
     {
         db.Locatie.Update(locatie);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(locatie));
 }
Beispiel #29
0
        public void LandToekennenEnOpvragenGeeftCorrectLand()
        {
            string naam = "Ukkel";

            locatie = new Locatie(naam);
            Land land = new Land("België");

            locatie.Land = land;
            Assert.AreEqual(land, locatie.Land);
        }
Beispiel #30
0
 public ActionResult Edit([Bind(Include = "LocatieId,Adres,Postcode,Plaats")] Locatie locatie)
 {
     if (ModelState.IsValid)
     {
         db.Entry(locatie).State = EntityState.Modified;
         db.SaveChanges(); //slaat de fabrikant op met de aangepaste data
         return(RedirectToAction("Index"));
     }
     return(View(locatie));
 }