Exemple #1
0
        public static List <YogaReservations> TestWorkshopWaitingList(int cId)
        {//Method used to verify the bookings
            List <YogaReservations> reservation  = new List <YogaReservations>();
            OleDbConnection         myConnection = GetConnection();
            string       myQuery   = "SELECT WorkshopReservationID, WClientUsername FROM YogaWorkshopReservation WHERE YogaWorkshopID =" + cId + " AND WorkshopWaitinglistStatus =1";
            OleDbCommand myCommand = new OleDbCommand(myQuery, myConnection);

            try
            {
                myConnection.Open();
                OleDbDataReader myReader = myCommand.ExecuteReader();

                while (myReader.Read())
                {
                    YogaReservations w = new YogaReservations((int.Parse(myReader["WorkshopReservationID"].ToString())), (myReader["WClientUsername"].ToString()));
                    reservation.Add(w);
                }
                return(reservation);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception in DBHandler", ex);
                return(null);
            }
            finally
            {
                myConnection.Close();
            }
        }
Exemple #2
0
        public static List <YogaReservations> LoadClassWaitingListNr(int cId)
        {//Method used to count the bookings
            List <YogaReservations> reservation  = new List <YogaReservations>();
            OleDbConnection         myConnection = GetConnection();
            string       myQuery   = "SELECT ClassReservationID, CClientUsername FROM YogaClassReservation WHERE YogaClassID =" + cId;
            OleDbCommand myCommand = new OleDbCommand(myQuery, myConnection);

            try
            {
                myConnection.Open();
                OleDbDataReader myReader = myCommand.ExecuteReader();

                while (myReader.Read())
                {
                    YogaReservations w = new YogaReservations((int.Parse(myReader["ClassReservationID"].ToString())), (myReader["CClientUsername"].ToString()));
                    reservation.Add(w);
                }
                return(reservation);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception in DBHandler", ex);
                return(null);
            }
            finally
            {
                myConnection.Close();
            }
        }