//############################################### RETRIEVE ###############################################
        public List <Attendance> RetrieveCount()
        {
            List <Attendance> countList = new List <Attendance>();

            using (MySqlConnection mysqlCon = new MySqlConnection(connectionString))
            {
                DataTable dt = new DataTable();
                mysqlCon.Open();
                MySqlCommand mySqlCmdNewRooom = new MySqlCommand("retrieve_count", mysqlCon);
                mySqlCmdNewRooom.CommandType = CommandType.StoredProcedure;
                MySqlDataAdapter da = new MySqlDataAdapter(mySqlCmdNewRooom);

                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Attendance count = new Attendance();
                        count.Id         = Int16.Parse(dt.Rows[i]["count_id"].ToString());
                        count.Count_beg  = Int16.Parse(dt.Rows[i]["count_beg"].ToString());
                        count.Count_mid  = Int16.Parse(dt.Rows[i]["count_mid"].ToString());
                        count.Count_end  = Int16.Parse(dt.Rows[i]["count_end"].ToString());
                        count.Session_id = Int16.Parse(dt.Rows[i]["session_id"].ToString());

                        SessionsDatabaseManager sdb = new SessionsDatabaseManager();
                        //Console.WriteLine("running here");
                        Session session          = sdb.get_session_by_id(count.Session_id);
                        RoomsDatabaseManager rdb = new RoomsDatabaseManager();
                        Room room = rdb.get_room_by_id(session.Room);
                        SpeakerDatabaseManager spdb = new SpeakerDatabaseManager();
                        Speaker speaker             = spdb.get_speaker_by_id(session.Speaker);

                        TimeSlotsDatabaseManager tdb = new TimeSlotsDatabaseManager();
                        TimeSlot timeslot            = tdb.get_timeslot_by_id(session.TimeSlots);


                        count.Session_title   = session.Title;
                        count.Session_room    = room.Name;
                        count.Capacity        = room.Capacity;
                        count.Session_speaker = speaker.Name;
                        count.Timeslot        = timeslot.ConcatTimeSlot;
                        //Console.WriteLine(count.Timeslot);
                        count.Date = session.Date;

                        countList.Add(count);
                    }
                }
                mySqlCmdNewRooom.ExecuteNonQuery();
                mysqlCon.Close();


                return(countList);
            }
        }
Ejemplo n.º 2
0
        }                                         // 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;
        }