public void InsertParkPlace(ParkPlace parkplace) { // SQL statement Insert string sql = "Insert Lecture(parkingId,buildingId,row,cel,description) values(@parkingId,@buildingId,@row,@cel,@description)"; // Uitvoeren SQL statement en doorgeven parametercollectie db.Execute(sql, new { parkplace.ParkingId, parkplace.BuildingId, parkplace.Row, parkplace.Cel, parkplace.Description }); }
public void DeleteParkPlace(ParkPlace parkplace) { // SQL statement delete string sql = "Delete ParkPlace where Id = @id"; // Uitvoeren SQL statement en doorgeven parametercollectie db.Execute(sql, new { parkplace.Id }); }
public void UpdateParkPlace(ParkPlace parkplace) { // SQL statement update string sql = "Update ParkPlace set parkingId=@parkinId, buildingId=@buildingId, row=@row, cel=@cel, description=@description where Id = @id"; // Uitvoeren SQL statement en doorgeven parametercollectie db.Execute(sql, new { parkplace.ParkingId, parkplace.BuildingId, parkplace.Row, parkplace.Cel, parkplace.Description, parkplace.Id }); }
public Boolean IsValidParkPlace(ParkPlace parkPlace) { string sql = "Select * from ParkPlace " + "Where parkingId = @ParkingId AND row = @Row AND cel = @Cel"; ParkPlace parkPlaces = db.Query <ParkPlace>(sql, new { parkPlace.ParkingId, parkPlace.Row, parkPlace.Cel }).FirstOrDefault(); return(parkPlaces == null); }
public ParkPlaceView(ParkPlace parkplace) { Id = parkplace.Id; Parking = parkplace.Parking; Building = parkplace.Building; Row = parkplace.Row; Cel = parkplace.Cel; Description = parkplace.Description; Reservation = new ObservableCollection <Reservation>(); }
public ObservableCollection <Reservation> GetReservationParkPlace(ParkPlace parkPlace) { // Uitschrijven SQL statement & bewaren in een string. string sql = "Select * From Reservation re " + "INNER JOIN Userx us ON us.id = re.userId " + "Where parkPlaceId = '" + parkPlace.Id + "' " + "ORDER BY beginTime DESC"; //Uitvoeren SQL statement op db instance //Type casten van het generieke return type naar een collectie van contactpersonen var reservations = db.Query <Reservation, User, Reservation>(sql, (reservation, user) => { reservation.User = user; return(reservation); }, splitOn: "Id"); return(new ObservableCollection <Reservation>(reservations)); }
public ParkPlaceView GetParkPlaceWithFKView(ParkPlace parkPlace) { // Uitschrijven SQL statement & bewaren in een string. string sql = "Select * from ParkPlace pp JOIN Building bu ON pp.buildingId = bu.Id JOIN Parking pa ON pp.parkingId = pa.Id " + "Where pp.Id = '" + parkPlace.Id + "' " + "Order By parkingId,row,cel"; //Uitvoeren SQL statement op db instance //Type casten van het generieke return type naar een collectie van contactpersonen var parkPlaces = db.Query <ParkPlace, Building, Parking, ParkPlace>(sql, (parkPlac, building, parking) => { parkPlac.Parking = parking; parkPlac.Building = building; return(parkPlac); }, splitOn: "Id"); if (parkPlaces != null) { return(new ParkPlaceView(parkPlaces.First())); } return(null); }