-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRentalCollection.cs
46 lines (36 loc) · 1.05 KB
/
RentalCollection.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TermProject
{
class RentalCollection : Persistable
{
protected List<Rental> rentalsOut;
public RentalCollection()
: base() { rentalsOut = new List<Rental>(); } // call parent default constructor
public void PopulateWithRentedOutBikes()
{
string queryString = "SELECT ID FROM Rental WHERE (DateReturned = '' OR DateReturned IS NULL)";
List<Object> rentalIds = getValues(queryString);
foreach (Object element in rentalIds)
{
Rental r = new Rental();
r.Populate((int)((object[])element)[0]);
rentalsOut.Add(r);
}
}
public List<Rental> GetBikeList()
{
return rentalsOut;
}
public void PrintAll()
{
foreach (Rental rental in rentalsOut)
{
rental.Print();
}
}
}
}