Sub replysms
'Dim SQLQry As String = "DELETE FROM Recievedsms"
'Starter.SQL1.ExecNonQuery(SQLQry)
cursor1 = Starter.SQL1.ExecQuery("SELECT phone AS Phone,Sex FROM Register")
If cursor1.RowCount > 0 Then
cursor1.Position =0
Dim phone As String
phone = cursor1.Getstring("Phone")
Dim sx As String
sx = cursor1.Getstring("Sex")
' sx = "Father"
End If
Dim CustID As String = phone' Customer ID
Dim jtk As HttpJob
jtk.Initialize("", Me)
'j.Download("http://192.168.1.239/Generic_Handler_JSON/HandlerVB.ashx?customerid=" & CustID)
jtk.Download("http://kccug.com/Generic_Handler_JSON/HandlerVBGetreply.ashx?customerid=" & CustID & "&bcode=" & sx)
'jtk.Download("http://192.168.1.239/Generic_Handler_JSON/HandlerVBGetreply.ashx?customerid=" & CustID & "&bcode=" & sx)
jtk.GetRequest.Timeout = 10000 ' 10 seconds
Wait For (jtk) JobDone(jtk As HttpJob)
If jtk.Success Then ' if job is success (http status code 200)
Dim RetVal As String
Log(RetVal)
RetVal = jtk.GetString
If jtk.GetString = "[]" Then
'Msgbox("Please try Again ","SMIS")
'Return
Else
Dim jpt As JSONParser
jpt.Initialize(jtk.GetString)
Log(jpt) ' will pr
Dim quotes As List = jpt.NextArray
For Each quot As Map In quotes
Log("Account: " & quot.Get("Account"))
Log("sms: " & quot.Get("sms"))
Log("Datesent: " & quot.Get("Datesent"))
Log("Status: " & quot.Get("Status"))
Log("codes: " & quot.Get("Code"))
Log("atk: " & quot.Get("atk"))
'Log("Tos: " & quot.Get("Tos"))
Dim ltt As Long
DateTime.DateFormat = "dd/MM/yyyy" ' "1961-08-29"
Dim datestring As String = DateTime.Date(JsonDateToTick( quot.Get("Datesent")))
ltt = DateTime.DateParse(datestring)
DateTime.DateFormat = "dd/MM/yyyy"
Log(DateTime.Date(ltt))
Dim now As Long
now = DateTime.Now
Log(DateTime.Now)
DateTime.DateFormat = "dd/MM/yyyy" : DateTime.TimeFormat = "hh:mm a"
Log(DateTime.Date(ltt)& " "& DateTime.Time(now))
'"SELECT DISTINCT Daterecieved,Sms as RecievedMessage,ID FROM Recievedsms"
'Starter.SQL1.ExecNonQuery("INSERT INTO Recievedsms VALUES('" & DateTime.Date(ltt) & "','" & quot.Get("sms") & "','" & quot.Get("Code") & "')")
Starter.SQL1.ExecNonQuery2("INSERT INTO Recievedsms VALUES(?, ?, ?)", Array As Object(DateTime.Date(ltt)& " "& DateTime.Time(now), quot.Get("sms"), quot.Get("Code")))
Dim n As NB6
n.Initialize("default", Application.LabelName, "HIGH").SmallIcon(smiley)
n.Build(quot.Get("sms"), "Kabojja Junior School", "tag", Me).Notify(9)
Dim jtkt As HttpJob
jtkt.Initialize("", Me)
jtkt.Download("http://kccug.com/Generic_Handler_JSON/HandlerVBDelReply.ashx?customerid=" & quot.Get("atk"))
Next
End If
End If
End Sub