%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
EB Agenda - Insert/Update One Day
<%
CheckSecurity(1)
SemRedirect = GetParam("SemRedirect")
DateIntervention = GetParam("DateInterv")
IdEmpl = GetParam("IdEmpl")
CountEvents = CInt(GetParam("CountEvents"))
For CntEv = 0 to CountEvents
Customer = ""
SQLInsertTables = ""
SQLInsertValues = ""
ChkInsertNew = 1
CBFullDay = GetParam("FullDay_" & CntEv)
FullDay = 0
If CBFullDay = "on" then
FullDay = 1
BeginTime = "00:00"
EndTime = "23:59"
else
FullDay = 0
ETH = GetParam("EndTimeHour_" & CntEv)
ETM = GetParam("EndTimeMinutes_" & CntEv)
If CStr(ETH) = "24" AND Cstr(ETM) = "0" then
EndTime = "23:59"
else
If ETH < 10 then
ETH = "0" & ETH
End if
If ETM < 10 then
ETM = "0" & ETM
End if
EndTime = ETH & ":" & ETM
end if
BTH = GetParam("BeginTimeHour_" & CntEv)
BTM = GetParam("BeginTimeMinutes_" & CntEv)
If BTH < 10 then
BTH = "0" & BTH
End if
If BTM < 10 then
BTM = "0" & BTM
End if
BeginTime = BTH & ":" & BTM
End if
typeEvent = Int(GetParam("typeEvent_" & CntEv))
Select Case typeEvent
Case 3
Customer = "EB"
SQLInsertTables = SQLInsertTables & "idTypeEvent,idTypePrestation,"
SQLInsertValues = SQLInsertValues & "3,1,"
' définir ID dans liste clients
Case 4
Customer = "Hotline"
SQLInsertTables = SQLInsertTables & "idTypeEvent,idTypePrestation,"
SQLInsertValues = SQLInsertValues & "3,1,"
' définir ID dans liste clients
Case 5
Customer = "Home"
SQLInsertTables = SQLInsertTables & "idTypeEvent,idTypePrestation,"
SQLInsertValues = SQLInsertValues & "5,1,"
' définir ID dans liste clients
Case 77
Customer = "OFF"
SQLInsertTables = SQLInsertTables & "idTypeEvent,idTypePrestation,"
SQLInsertValues = SQLInsertValues & "4,5,"
' définir ID dans liste clients
Case 99
Customer = GetParam("CustInt_" & CntEv)
If Customer = "" then
ChkInsertNew = 0
'Response.Redirect("EBEditDay.asp?DateInterv=" & DateIntervention & "&IdEmpl=" & IdEmpl)
End if
SQLInsertTables = SQLInsertTables & "idTypeEvent,idTypePrestation,"
SQLInsertValues = SQLInsertValues & "1,1,"
Case 333
CustomerList = GetParam("CustIntList_" & CntEv)
Customer = DLookUp("custint", "Customer", "id=" & CustomerList)
SQLInsertTables = SQLInsertTables & "idTypeEvent,idTypePrestation,"
SQLInsertValues = SQLInsertValues & "1,1,"
End select
Response.Write(BeginTime & " <- start - end -> " & EndTime & "
")
RecordBeginTime = BeginTime & ":00"
RecordEndTime = EndTime & ":00"
Response.Write(RecordBeginTime & " <- start record - end record -> " & RecordEndTime & "
")
Response.Write("Type Event : " & typeEvent & "
")
JD = GetParam("JobDescription_" & CntEv)
Response.Write(JD & "
")
If CntEv = 0 then
' Insert new event si pas vide
Response.Write("Insert new event si pas vide - " & CntEv & "
")
Set rsInsertNew = Server.CreateObject("ADODB.recordset")
SQLInsertNew = "insert into reldatelieupers_2 (" & _
"DateInt," & _
"CustInt," & _
"idEmpl," & _
"FullDay," & _
"BeginTime," & _
"EndTime," & _
"JobDescription," & _
SQLInsertTables & _
"FlagDebut," & _
"FlagFin," & _
"TypeEventAgenda)" & _
" values (" & _
ToSQL(DateIntervention, "Text") & "," & _
ToSQL(Customer, "Text") & "," & _
ToSQL(IdEmpl, "Number") & "," & _
ToSQL(FullDay, "Number") & "," & _
ToSQL(RecordBeginTime, "Text") & "," & _
ToSQL(RecordEndTime, "Text") & "," & _
ToSQL(JD, "Text") & "," & _
SQLInsertValues & _
ToSQL(DateIntervention, "Text") & "," & _
ToSQL(DateIntervention, "Text") & "," & _
ToSQL(typeEvent, "Number") & _
")"
If ChkInsertNew = 1 then
Response.Write("SQLInsertNew : " & SQLInsertNew & "
")
openrs rsInsertNew, SQLInsertNew
End if
Else
' update all events
idInt = GetParam("idInt_" & CntEv)
Set rsUpdateEvent = Server.CreateObject("ADODB.recordset")
SQLUpdateEvent = "update reldatelieupers_2 set " & _
"CustInt=" & ToSQL(Customer, "Text") & _
",FullDay=" & ToSQL(FullDay, "Number") & _
",BeginTime=" & ToSQL(RecordBeginTime, "Text") & _
",EndTime=" & ToSQL(RecordEndTime, "Text") & _
",TypeEventAgenda=" & ToSQL(typeEvent, "Number") & _
",JobDescription=" & ToSQL(JD, "Text") & _
" where id=" & idInt
openrs rsUpdateEvent, SQLUpdateEvent
Response.Write(SQLUpdateEvent & "
")
Response.Write("update all events - " & CntEv & "
")
End if
next
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SaveAndClose = GetParam("SaveAndClose")
If SaveAndClose = "on" then
PageRedirect = "EBAgenda.asp?Semaine=" & SemRedirect & ""
Else
PageRedirect = "ebeditday.asp?DateInterv=" & DateIntervention & "&IdEmpl=" & IdEmpl
End if
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Redirect(PageRedirect)
'Response.Write(PageRedirect)
%>