bonjour ,
J'essai d'utiliser un timer dans un service windows. Le problème que le timer n'a pas l'air de se déclancher. c'est a dire le script que j'ai met
dans Tupdate_Tick n'execute pas
voila le code
Merci beaucoup de me répondre
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 Protected Overrides Sub OnStart(ByVal args() As String) Maclass.GPassage.chaine = "Provider=VFPOLEDB.1;Data Source=\\192.168.1.26\atlascom_old\UNIVERS2013\UNIVERS2013\bdgestc.dbc;" Tupdate.Interval = 100 Tupdate.Enabled = True End Sub Protected Overrides Sub OnShutdown() Tupdate.Dispose() End Sub Private Sub Tupdate_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tupdate.Tick affectertax() End Sub Sub affectertax() ds = Maclass.getdataset(" SELECT Nfact,Sum(Qte) As QteTSFB from lFacturec where Nfact in (select Nfact from Facturec where Anouveau=.f. And Valide=.T. And len(alltrim(Message))=0 ) And Code in (select code from article where Sfamille='TSFB') group by Nfact Order By Nfact desc") If ds.Tables(0).Rows.Count <> 0 Then 'If CInt(ds.Tables(0).Rows(0).Item("QteTSFB")) >= 1000 Then qtetonne = CInt(ds.Tables(0).Rows(0).Item("QteTSFB")) / 1000 If Maclass.Execute("UPDATE FACTUREC SET Message=' Dont TSB =" & CDec(qtetonne) * CDec(parametretaxe) & " Dhs' where NfACT=" & ds.Tables(0).Rows(0).Item("Nfact")) = True Then doc.Load(My.Application.Info.DirectoryPath & "\Facture.xml") fact = doc.CreateElement("Facture") Nfact = doc.CreateElement("Nfact") message = doc.CreateElement("observation") dtmodif = doc.CreateElement("Date") Nfact.InnerText = ds.Tables(0).Rows(0).Item("nfact") message.InnerText = " Dont TSB =" & CDec(qtetonne) * CDec(parametretaxe) & " Dhs" dtmodif.InnerText = Date.Now fact.AppendChild(Nfact) fact.AppendChild(message) fact.AppendChild(dtmodif) doc.DocumentElement.AppendChild(fact) doc.Save(My.Application.Info.DirectoryPath & "\Facture.xml") End If 'End If End If End Sub
Partager