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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| Private Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
Dim number As String = TextBox1.Text
Dim DatV1 As New DataView
Dim TabV1 As New DataTable
With DatV1
.Table = DBGMAODataSet.Tables("GESTION EQUIPEMENT")
.RowFilter = "N°Contrat ='" & number & "'"
End With
TabV1 = DatV1.ToTable
Dim query = From row In TabV1.AsEnumerable _
Group By Parent = row.Field(Of String)("NIVEAU 0"), child = row.Field(Of String)("NIVEAU 1")
Into count = Count()
Dim query2 = From row In TabV1.AsEnumerable _
Group By parent = row.Field(Of String)("Niveau 1"), child = row.Field(Of String)("NIVEAU 2")
Into count = Count()
Dim query3 = From row In TabV1.AsEnumerable _
Group By parent = row.Field(Of String)("Niveau 2"), child = row.Field(Of String)("NIVEAU 3")
Into count = Count()
Dim query4 = From row In TabV1.AsEnumerable _
Group By parent = row.Field(Of String)("Niveau 3"), child = row.Field(Of String)("NIVEAU 4")
Into count = Count()
Dim query5 = From row In TabV1.AsEnumerable _
Group By parent = row.Field(Of String)("Niveau 4"), child = row.Field(Of String)("NIVEAU 5")
Into count = Count()
Dim query6 = From row In TabV1.AsEnumerable _
Group By parent = row.Field(Of String)("Niveau 5"), child = row.Field(Of String)("NIVEAU 6")
Into count = Count()
Dim nodeList As New List(Of node)
For Each ret In query
nodeList.Add(New node(ret.child, ret.Parent))
Next
For Each ret In query2
nodeList.Add(New node(ret.child, ret.parent))
Next
For Each ret In query3
nodeList.Add(New node(ret.child, ret.parent))
Next
For Each ret In query4
nodeList.Add(New node(ret.child, ret.parent))
Next
For Each ret In query5
nodeList.Add(New node(ret.child, ret.parent))
Next
For Each ret In query6
nodeList.Add(New node(ret.child, ret.parent))
Next
End Sub |
Partager