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
| Public Structure erreur
Dim type_error As String
Dim nombre_error As Integer
End Structure
Public Structure information
Dim struct_error As List(Of erreur)
Dim messages As String
Dim ssn1 As String
Dim ssn2 As String
Dim succes As String
Dim tentatives As Integer
Dim origines As String
Dim destinations As String
Dim tcapops As String
Dim operateurs As String
Dim country As String
Dim int_outband As String
Dim taille_struct_error As Integer
Dim nbre_faute As Integer
Dim number As Integer
End Structure
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tableau_structure As New List(Of information)
Dim i As New information
Dim a As Integer = 0
Dim fofo As New information
recup = File.ReadAllLines("source.csv")
Dim index = 0
For j = 0 To recup.Length - 1
fofo.operateurs = ""
fofo.country = ""
fofo.int_outband = ""
fofo.tentatives = 1
champs = recup(j).Split(";")
If champs(13) = "Update Location" And champs(4) = "BEG" Then
fofo = chercher_operateur(champs(11), champs(9))
i = fofo
If Not tableau_structure.Contains(i) Then
tableau_structure.Add(i)
Else
'je cherche de quel structure s'agit il
index = tableau_structure.IndexOf(i)
i.tentatives = tableau_structure(index).tentatives + 1
tableau_structure.Remove(tableau_structure(index))
tableau_structure.Insert(index, i)
End If
End If
Next |
bonjour mon projet c'est d ouvrir un fichier CSV qui s’appelle "source" et de le lire ligne par ligne après si certaines conditions sont verifiés je vais aller chercher de quel opérateur s'agit il pour cela j'ai écrit une fonction qui s'appelle "chercher_operateur" qui rend une structure de type information après si cet opérateur existe déjà dans ma liste j'incremente le nombre de tentatives si non j'ouvre une nouvelle rangé dans ma liste avec add mais il s’avère que mon programme ne donne pas de résultat j'arrive pas a le debugger aidez moi svp
ma fonction "chercher_operateur" est comme suit :
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
|
Public Module wahid
Public Function chercher_operateur(ByVal origine As String, ByVal destination As String) As information
Dim intermediate As New information
intermediate.operateurs = ""
intermediate.country = ""
intermediate.int_outband = ""
Dim oper() As String
Dim k As Integer = 4
oper = File.ReadAllLines("movistar.csv")
Dim oper_frac As String()
Dim flag As Boolean = False
If origine.Contains("`21377") Then
intermediate.int_outband = "inbound"
Else
Do
For n As Integer = 0 To oper.Length - 1
oper_frac = oper(n).Split(";")
If origine.Contains(Mid(oper_frac(0), 1, k)) Then
intermediate.operateurs = oper_frac(2)
intermediate.country = oper_frac(3)
flag = True
End If
Next
k = k + 1
Loop Until flag = True Or k = 8
End If
If destination.Contains("`21377") Then
intermediate.int_outband = "outbound"
Else
Do
For n As Integer = 0 To oper.Length - 1
oper_frac = oper(n).Split(";")
If destination.Contains(Mid(oper_frac(0), 1, k)) Then
intermediate.operateurs = oper_frac(2)
intermediate.country = oper_frac(3)
flag = True
End If
Next
k = k + 1
Loop Until flag = True Or k = 8
End If
Return intermediate
End Function |
le probleme c'est meme au niveau de la boucle la ou je parcoure le fichier la ligne de tentatives ne s’incrémente pas
i.tentatives = tableau_structure(index).tentatives + 1
Partager