public ScheduleRoom GetScheduleRoomListByDate(string date)
        {
            ScheduleRoom scheduleRoom=new ScheduleRoom();

            SqlConnection connection = new SqlConnection(connectionString);

            string query = "SELECT * FROM ScheduleRoom WHERE BookedDate='"+date+"'";

            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                scheduleRoom.Id = int.Parse(reader["Id"].ToString());
                scheduleRoom.CategoryId = int.Parse(reader["Category_Id"].ToString());
                scheduleRoom.RoomId = int.Parse(reader["Room_Id"].ToString());
                scheduleRoom.BookedDate = reader["BookedDate"].ToString();
                scheduleRoom.BookedBy = reader["BookedBy"].ToString();
                scheduleRoom.Address = reader["Address"].ToString();

            }

            reader.Close();
            connection.Close();

            return scheduleRoom;
        }
        public string InsertSchedule(ScheduleRoom scheduleRoom)
        {
            if (scheduleRoom.CategoryId.ToString() == "")
            {
                return "Select a category";
            }

            else if (scheduleRoom.RoomId.ToString() == "")
            {
                return "Select a room";
            }

            else if (scheduleRoom.BookedDate.ToString()=="")
            {
                return "Select a date";
            }

            else if (scheduleRoom.BookedBy == "")
            {
                return "Enter a person name";
            }
            else if (scheduleRoom.Address == "")
            {
                return "Enter a person permenet address";
            }

            else if (roomGateway.HasThisAlreadyBooked(scheduleRoom.RoomId,scheduleRoom.BookedDate))
            {
                return "This room is already booked on given date";
            }

            else
            {
                int value = roomGateway.InsertSchedule(scheduleRoom);

                if (value > 0)
                {
                    return "Room booked Successfully";
                }
                else
                {
                    return "Operation Failed";
                }
            }
        }
        public int InsertSchedule(ScheduleRoom scheduleRoom)
        {
            SqlConnection connection = new SqlConnection(connectionString);

            string query = "INSERT INTO ScheduleRoom VALUES('"+scheduleRoom.CategoryId+"','"+scheduleRoom.RoomId+"','"+scheduleRoom.BookedDate+"','"+scheduleRoom.BookedBy+"','"+scheduleRoom.Address+"')";

            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();
            int rowsAffected = command.ExecuteNonQuery();

            connection.Close();
            return rowsAffected;
        }