public int creatingSessions(Session session) { bool isError = false; try { db.addSession(session); } catch (Exception ex) { isError = true; Console.WriteLine(ex); Console.WriteLine("Failed to update the Database --- check error ABOVE"); } Sessions.Add(session); //return isError; foreach (Session s in db.retrieveSessions()) { if (session.Title == s.Title) { return(s.Id); } } return(-1); }
} // CURRENT SELECTED SESSION OBJECT public SessionViewModel() { db = new SessionsDatabaseManager(); SessionTestData sessionTestData = new SessionTestData(); this.Sessions = new ObservableCollection <Session>(db.getSessions()); // GETS SESSION DATA FROM DB this.dbList = new List <Session>(db.retrieveSessions()); this.SessionCollection = CollectionViewSource.GetDefaultView(this.Sessions); TimeSlotsDatabaseManager ts = new TimeSlotsDatabaseManager(); this.AvailableTimeSlots = new ObservableCollection <TimeSlot>(ts.retrieveTimeSlots()); // ACESS TIME SLOTS this.AvailableSpeakers = new ObservableCollection <Speaker>(db.getAllSpeakers()); // GETS SPEAKERS this.AvailableRooms = new ObservableCollection <Room>(db.getAllRooms()); // GET ROOMS SessionCollection.Filter = FilterSpeakers; }