<% 'option explicit Dim Connection, objRS, strSQL Dim blnReserve, blnLoop Dim H_debut, H_fin function verification(salleid,hhdebut,hhfin,dTmp) blnReserve=false blnLoop=false if hhdebut <> "" then H_debut = cdate(hhdebut) end if if hhfin <> "" then H_fin = cdate(hhfin) end if jour = day(dTmp) mois = month(dTmp) annee = year(dTmp) Set objRS = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT * FROM EventsOccur WHERE dt_occur = #" & annee & "-" & mois & "-" & jour & "#" strSQL = strSQL & " AND location = " & cint( salleid) objRS.Open strSQL,Conn,3,3 if not objRS.eof then 'Response.Write strSQL 'Response.Write "
" 'Response.Write objRS("tm_start") 'Response.Write objRS("tm_end") 'Response.Write "
" 'Response.Write H_debut 'Response.Write H_fin 'Response.Write "
" Do Until objRS.EOF OR blnLoop=true If ( H_debut >= objRS("tm_start") AND H_fin <= objRS("tm_end") ) OR ( H_debut >= objRS("tm_start") AND H_debut < objRS("tm_end") ) OR ( H_debut < objRS("tm_start") AND H_fin > objRS("tm_start") ) then blnReserve=true blnLoop=true end if objRS.MoveNext Loop end if objRS.Close Set objRS = Nothing verification=blnReserve end function '************************************************************************************************ function verificationUpdate(salleid,hhdebut,hhfin,dTmp,event_id) blnReserve=false blnLoop=false H_debut = cdate(hhdebut) H_fin = cdate(hhfin) jour = day(dTmp) mois = month(dTmp) annee = year(dTmp) Set objRS = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT * FROM EventsOccur WHERE dt_occur = #" & annee & "-" & mois & "-" & jour & "#" strSQL = strSQL & " AND event_id <> "&event_id&" and location = " & cint( salleid) objRS.Open strSQL,Conn,3,3 if not objRS.eof then 'Response.Write strSQL Do Until objRS.EOF OR blnLoop=true 'Response.Write "
" 'Response.Write objRS("tm_start") 'Response.Write objRS("tm_end") 'Response.Write "
" 'Response.Write H_debut 'Response.Write H_fin 'Response.Write "
" If ( H_debut >= objRS("tm_start") AND H_fin <= objRS("tm_end") ) OR ( H_debut >= objRS("tm_start") AND H_debut < objRS("tm_end") ) OR ( H_debut < objRS("tm_start") AND H_fin > objRS("tm_start") ) then blnReserve=true blnLoop=true end if objRS.MoveNext Loop end if objRS.Close Set objRS = Nothing verificationUpdate=blnReserve end function %>