public static void UpdateTimeSlot(TimeSlotModel timeSlot)
        {
            using IDbConnection cnn = new SQLiteConnection(LoadConnectionString());
            string q = string.Concat("UPDATE time_slots SET roomid = '", timeSlot.Roomid, "', datetime ='", timeSlot.Datetime, "', timeslot='", timeSlot.Timeslot, "', booked='", timeSlot.Booked, "' WHERE id =", timeSlot.Id.ToString(), ";");

            cnn.Execute(q, timeSlot);
        }
        public static void BookTimeSlot(TimeSlotModel timeSlot)
        {
            List <TimeSlotModel> list = LoadTimeSlots(timeSlot.Datetime, timeSlot.Timeslot);

            if (list.Count > 0)
            {
                using IDbConnection cnn = new SQLiteConnection(LoadConnectionString());
                cnn.Execute("INSERT into time_slots (roomid, datetime, timeslot, booked) values (@RoomId, @Datetime, @Timeslot, @Booked)", timeSlot);
            }
        }
Beispiel #3
0
        private void BookRoom(int roomId)
        {
            TimeSlotModel timeslot = new TimeSlotModel
            {
                Roomid   = roomId,
                Datetime = bookableDateTimes[comboBoxDates.SelectedIndex].ToShortDateString(),
                Timeslot = comboBoxTimeSlots.Items[comboBoxTimeSlots.SelectedIndex].ToString(),
                Booked   = true
            };

            SqliteDataAccess.BookTimeSlot(timeslot);

            LoadAvailability();
        }