Sub bt_Click
Dim bt As Button = Sender
Dim ListParent As List = bt.Tag
' valori del ListParent
' index 0 = etichetta
' index 1 = parent
' index 2 = colroot value (record)
' index 3 = id record
Try
Dim xp As Panel = ListParent.Get(1)
If ListParent.Get(0) = "modifica" Then
Dim a,b,c,d,e, query As String
Dim colroot As Map = ListParent.Get(2)
a = colroot.Get("0") ' descrizione
a = a.Replace("'","'")
b = colroot.Get("1") ' prezzo
c = colroot.Get("2") ' visibile
d = colroot.Get("4") ' info
e = colroot.Get("5") ' id
For i = 0 To xp.NumberOfViews-1
If xp.GetView(i) Is TextField Then
Dim tx1 As TextField = xp.GetView(i)
If tx1.Tag = "descrizione" Then a = tx1.Text.Replace("'","\'").Replace("è","e\'").Replace("é","e\'").Replace("à","à\'").Replace("ù","u\'").Replace("ì","i\'")
If tx1.Tag = "prezzo" Then b = tx1.Text
If tx1.Tag = "info" Then d = tx1.Text.Replace("'","\'").Replace("è","e\'").Replace("é","e\'").Replace("à","à\'").Replace("ù","u\'").Replace("ì","i\'")
End If
If xp.GetView(i) Is Switch Then
Dim sw1 As Switch = xp.GetView(i)
c = sw1.Value
End If
Next
query = "UPDATE `bar_db_prodotti` SET `descrizione`='" & a & "',`prezzo`='" & b & "',`visibile`='" & c & "',`info`='" & d & "' WHERE id='" & e &"';"
Mod_Global.getJsonUrl2(query,"998")
query = "SELECT * FROM `bar_db_prodotti`"
Mod_Global.getJsonUrl2(query,"2")
Dim mhud As HUD
mhud.ToastMessageShow("Modifica andata a buon fine",False)
End If
Catch
Msgbox("Ho ho, qualcosa è andato storto...", "Message")
End Try
End Sub