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
|
Private DT_SsFAMILLES As DataTable
Private Sub DT_SsFAMILLES_CreateHeadersColumns()
Dim workCol As DataColumn = DT_SsFAMILLES.Columns.Add("SousFamilleId", Type.GetType("System.Int32"))
workCol.AllowDBNull = False
workCol.Unique = True
DT_SsFAMILLES.Columns.Add("SousFamilleNom", Type.GetType("System.String"))
DT_SsFAMILLES.Columns.Add("IsNotEmpty", Type.GetType("System.Boolean"))
End Sub
Private Sub DT_SsFAMILLES_InsertRow(ByVal intId As Integer, ByVal strName As String, ByVal BoolNotEmpty As Boolean)
Dim workRow As DataRow = DT_SsFAMILLES.NewRow()
workRow("SousFamilleId") = intId
workRow("SousFamilleNom") = strName
workRow("IsNotEmpty") = BoolNotEmpty
DT_SsFAMILLES.Rows.Add(workRow)
End Sub
Public Function Load_SousFamilles(ByVal intIdFam As Integer) As Boolean
ErreursTxt = ""
Dim boolReturnValue As Boolean = False
Try
boolReturnValue = GetSsFams(intIdFam) 'effectue une requête sql qui remplie mon dataset DT1 avec des sous familles
If ErreursTxt = "" Then
If boolReturnValue Then
Dim intId As Integer
Dim strName As String
Dim BoolNotIsEmpty As Boolean
DT_SsFAMILLES = New DataTable("ListeSsFams")
DT_SsFAMILLES_CreateHeadersColumns()
For i As Integer = 0 To intCptmax
intId = DT1.Tables(0).Rows(i)("SousFamilleId")
strName = DT1.Tables(0).Rows(i)("SousFamilleNom")
BoolNotIsEmpty = Verif_Sous_Famille_IsNotEmpty(intId) 'vérifie un critère et retourne True or false
DT_SsFAMILLES_InsertRow(intId, strName, BoolNotIsEmpty)
Next
DT1 = Nothing
End If
End If
Catch ex As Exception
ErreursTxt = ex.ToString()
End Try
Return boolReturnValue
End Function |
Partager