private List <CampingSpot> GetCampingSpots() { string sql = "SELECT * FROM camping_spot"; List <CampingSpot> temp = new List <CampingSpot>(); try { myDataHelper.OpenConnection(); MySqlDataReader reader = myDataHelper.DataReader(sql); while (reader.Read()) { CampingSpot spot = new CampingSpot(reader["spotNr"].ToString(), reader["spotCode"].ToString()); temp.Add(spot); } return(temp); } catch { return(null); } finally { myDataHelper.CloseConnection(); } }
// constructors public Visitor(int id, string first, string last, DateTime dob, Gender gender, Ticket ticketType, double balance) : base(id, first, last, dob, gender) // visitor buying ticket at gate, no camp reserved { this.eventAccount = GenerateEventAccountNr(); this.ticketType = ticketType; isCheckedIn = false; borrowings = new Dictionary <EventItem, int>(); this.balance = balance; rfid = ""; ticketNr = GenerateTicketNr(); spotCode = ""; hasReserveCamp = false; reservedSpot = null; }
public bool ReserveCampingSpot(CampingSpot spot) { if (spot.AddMoreRenter(this)) { hasReserveCamp = true; reservedSpot = spot; if (spot.Renters[0] == this) { spotCode = spot.SpotCode; } return(true); } hasReserveCamp = false; return(false); }
public Visitor(int id, string first, string last, Gender gender, int ticketNr, Ticket ticketType, double balance) : base(id, first, last, gender) {// constructor for visitors who already bought tickets online, event account is unknown, no camping reserved this.eventAccount = GenerateEventAccountNr(); this.ticketType = ticketType; isCheckedIn = false; borrowings = new Dictionary <EventItem, int>(); this.balance = balance; this.rfid = ""; this.ticketNr = ticketNr; issuedTickets.Add(ticketNr); spotCode = ""; hasReserveCamp = false; reservedSpot = null; }