Function DoUpdate (Id As Integer) As Integer
Dim Ret%
Dim sData$
Dim s$
sData = " UPDATE Client SET "
Select Case CurEcran
Case 0
TabSQLValue(0, 0) = Trim$(Right$(Cb(35).Text, 20))
s = XasSetChar(txT(4).Text, "'", "''", 0, 0)
TabSQLValue(0, 1) = Trim$(s)
TabSQLValue(0, 2) = Trim$(txT(5).Text)
s = XasSetChar(txT(7).Text, "'", "''", 0, 0)
TabSQLValue(0, 3) = Trim$(s)
s = XasSetChar(txT(8).Text, "'", "''", 0, 0)
TabSQLValue(0, 4) = Trim$(s)
s = XasSetChar(txT(9).Text, "'", "''", 0, 0)
TabSQLValue(0, 5) = Trim$(s)
s = XasSetChar(txT(10).Text, "'", "''", 0, 0)
TabSQLValue(0, 6) = Trim$(s)
s = XasSetChar(txT(11).Text, "'", "''", 0, 0)
TabSQLValue(0, 7) = Trim$(s)
s = XasSetChar(txT(12).Text, "'", "''", 0, 0)
TabSQLValue(0, 8) = Trim$(s)
s = XasSetChar(txT(13).Text, "'", "''", 0, 0)
TabSQLValue(0, 9) = Trim$(s)
TabSQLValue(0, 10) = Trim$(txT(14).Text)
TabSQLValue(0, 11) = Trim$(txT(15).Text)
TabSQLValue(0, 12) = Trim$(txT(16).Text)
TabSQLValue(0, 13) = Trim$(Right$(Cb(0).Text, 20))
TabSQLValue(0, 14) = Trim$(Right$(Cb(1).Text, 20))
TabSQLValue(0, 15) = Trim$(Right$(Cb(2).Text, 20))
TabSQLValue(0, 16) = Trim$(Right$(Cb(3).Text, 20))
TabSQLValue(0, 17) = Trim$(Right$(Cb(4).Text, 20))
TabSQLValue(0, 18) = Trim$(Right$(Cb(5).Text, 20))
TabSQLValue(0, 19) = Trim$(Right$(Cb(6).Text, 20))
TabSQLValue(0, 20) = Trim$(Right$(Cb(7).Text, 20))
TabSQLValue(0, 21) = Trim$(Right$(Cb(8).Text, 20))
TabSQLValue(0, 30) = Trim$(txT(45).Text)
Case 1
Ret = 1
If Chk(1).Value = 1 Or Chk(2).Value = 1 Then
Ret = 0
End If
TabSQLValue(0, 22) = CStr(Ret)
Case 2
TabSQLValue(0, 23) = Trim$(txT(29).Text)
TabSQLValue(0, 24) = Trim$(txT(30).Text)
TabSQLValue(0, 25) = Trim$(txT(31).Text)
TabSQLValue(0, 26) = Trim$(Left$(Cb(9).Text, 30))
'TabSQLValue(0, 27) = Trim$(Left$(Cb(34).Text, 30))
TabSQLValue(0, 27) = CStr(Chk(3).Value)
Case 3
' update maj
Case 4
s = TxtUp.Text
If Trim$(s) <> "" Then
Ret = InsertLinkFile(CurEntity_id, s)
End If
If (Chk(4).Value = 1) And (Val(GlobPU.XasDroit) > 6) Then
Ret = InsertToDRMTest(CurEntity_id)
If Ret = 2 Then
LabMsg(0).Caption = "Client Déjà dans DRMTEST"
End If
End If
End Select
Ret = UpdateClient(CurEntity_id, CurEcran)
If Ret = True Then
If ModeEasy = True Then
TabSQLValue(0, 23) = Trim$(txT(29).Text)
TabSQLValue(0, 24) = Trim$(txT(30).Text)
TabSQLValue(0, 25) = Trim$(txT(31).Text)
TabSQLValue(0, 26) = Trim$(Left$(Cb(9).Text, 30))
TabSQLValue(0, 27) = CStr(Chk(3).Value)
Ret = UpdateClient(CurEntity_id, 2)
End If
If (CurEcran = 2) Or (ModeEasy = True) Then
Ret = UpdateLinkSite(IdXmlSite, 1, CurEntity_id)
Ret = UpdateLinkChild(CurEntity_id)
End If
If CurEcran = 3 Then
Ret = UpdateLinkCritere(CurEntity_id, 1)
End If
LabMsg(0).Caption = "Enregistrement Mise à Jour"
BtnOk.Visible = True
Ret = DoSqlEntity(CurEntity_id)
PicBtn(3).Visible = True
PicBtn(5).Visible = True
PicBtn(7).Visible = True
Maj = 1
Else
LabMsg(0).ForeColor = 255
LabMsg(0).Caption = "Problème lors de l'enregistrement"
End If
End Function
|