Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Fatto As Int
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim FTP As FTP
Dim Label1 As Label
Dim Account As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Fatto=0
Account=Main.Account
'Msgbox(Account,"")
Activity.LoadLayout("aggiorna")
ProgressDialogShow("Download")
DoEvents
'If FirstTime Then
FTP.Initialize("FTP","giannimaione.blabla",21,"giannimaione","lamiapassword")
'End If
FTP.PassiveMode=True
Scarica
End Sub
Sub ClientiDATI
'Dim i As Int
'in pratica nel file 9901_dati.txt ci sono anche le istruzioni sql , oltre ai dati contabili
' esempio : INSERT INTO (bla bla bla ..
' in questo modo "piloto" il tutto da PC windows!
ProgressDialogShow("UPDATE DATI CONTABILI")
DoEvents
Dim Reader As TextReader
Reader.Initialize(File.OpenInput(Account, "9901_dati.txt"))
'Main.SQL1.BeginTransaction
Dim line As String
line = Reader.ReadLine
Main.SQL1.BeginTransaction
Try
Do While line <> Null
'Log(line)
' If (i Mod 10)=0 Then
DoEvents
' End If
Main.SQL1.ExecNonQuery(line)
line = Reader.ReadLine
'i=i+1
Loop
Main.SQL1.TransactionSuccessful
Catch
Msgbox("ERRORE","")
End Try
Main.SQL1.EndTransaction
Reader.Close
ProgressDialogHide
'Msgbox("OK","")
Activity.Finish
End Sub
Sub Scarica
Dim nome1 As String
Dim nome2 As String
'Msgbox("accedo","")
nome1="/clienti/public/maione/9901_dati.txt":' la cartella ed il file remoto
nome2="9901_dati.txt":' nome del file locale
DoEvents
FTP.DownloadFile(nome1,True,Account,nome2)
'Msgbox("do","")
End Sub
Sub FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
'Msgbox(ServerPath & ", Success=" & Success,"")
If Success = True Then
InsertDATI
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub