You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
privateval eventDao by lazy { AppDatabase.getDatabase(this).eventDao() }
84
-
privateval repository by lazy { EventRepository(eventDao) }
86
+
privateval ticketDao by lazy { AppDatabase.getDatabase(this).ticketDao() }
87
+
privateval eventRepository by lazy { EventRepository(eventDao) }
88
+
privateval ticketRepository by lazy { TicketRepository(ticketDao) }
85
89
privateval eventViewModel:EventViewModel by viewModels {
86
-
EventViewModelFactory(repository)
90
+
EventViewModelFactory(eventRepository)
87
91
}
88
-
92
+
val viewModel:TicketViewModel by viewModels { TicketViewModelFactory(ticketRepository) }
89
93
overridefunonCreate(savedInstanceState:Bundle?) {
90
94
super.onCreate(savedInstanceState)
91
95
@@ -136,7 +140,8 @@ class MainActivity : ComponentActivity() {
136
140
}
137
141
138
142
// Appel de la fonction populateDatabase
139
-
populateDatabase()
143
+
populateDatabase()
144
+
140
145
141
146
// initialisation de l'adaptateur NFC
142
147
nfcAdapter =NfcAdapter.getDefaultAdapter(this)
@@ -193,15 +198,24 @@ class MainActivity : ComponentActivity() {
193
198
}
194
199
195
200
privatefunpopulateDatabase() {
196
-
// val eventDao = AppDatabase.getDatabase(this).eventDao()
201
+
val eventDao =AppDatabase.getDatabase(this).eventDao()
197
202
198
203
// Créez des instances de Event
199
-
// val event1 = Event(eventId = 1, name = "Les Ardentes", description = " Les Ardentes Festival in Moncton is a must for music fans. Every year, this event brings together internationally renowned artists and emerging talents, offering an eclectic programme ranging from rap and rock to electro and pop.", dateTime = "21-23 Juin 2024", location = "123 Rue Main, Street Moncton")
200
-
// val event2 = Event(eventId = 2, name = "Festival Mural", description = "he Mural Festival is an annual event celebrating urban art and creativity, attracting artists from around the world to transform public spaces with vibrant, large-scale murals. Held in a dynamic city environment, the festival features live painting sessions, art exhibitions, workshops, and interactive installations. It aims to engage the community, promote cultural exchange, and rejuvenate urban landscapes through the power of art. ", dateTime = "10-22 Juin 2024", location = "67 Rue Main, Bathurst K.C Irving")
204
+
val event1 =Event(eventId =1, name ="Les Ardentes", description =" Les Ardentes Festival in Moncton is a "+
205
+
"must for music fans. Every year, this event brings together "+
206
+
"internationally renowned artists and emerging talents, "+
207
+
"offering an eclectic programme ranging "+
208
+
"from rap and rock to electro and pop.", date="21-23 Juin 2024", hour="19h - 23h", location ="123 Rue Main, Street Moncton")
209
+
210
+
val event2 =Event(eventId =2, name ="Festival Mural", description ="he Mural Festival is an annual event celebrating urban "+
211
+
"art and creativity, attracting artists from around the world to transform public spaces with vibrant, "+
212
+
"large-scale murals. Held in a dynamic city environment, "+
213
+
"the festival features live painting sessions, art exhibitions, "+
214
+
"workshops, and interactive installations. It aims to engage the community, "+
215
+
"promote cultural exchange, and rejuvenate urban landscapes through the power of art. ", date ="10-22 Juin 2024", hour="16h00 - 22h00", location ="67 Rue Main, Bathurst K.C Irving")
201
216
// GlobalScope.launch {
202
217
// // Inserenles événements dans la base de données
203
-
//// eventDao.insertEvent(event1)
204
-
//// eventDao.insertEvent(event2)
218
+
205
219
// // Recupere les events de ma db
206
220
//// val events = eventDao.getAllEvents()
207
221
//
@@ -219,41 +233,45 @@ class MainActivity : ComponentActivity() {
219
233
val ticketDao =AppDatabase.getDatabase(this).ticketDao()
220
234
221
235
// remplir les donneees pour ma table user
222
-
val userDao =AppDatabase.getDatabase(this).userDao()
0 commit comments