Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- For Each tbCustomer As tbCustomer In listCustomer
- If (BackgroundWorkerMatch.CancellationPending) Then
- Exit Sub
- End If
- For Each tbDHN As tbDHN In listDHN
- If tbDHN.npwp_trimmed.Length >= 5 AndAlso
- tbCustomer.npwp_trimmed.Length >= 5 AndAlso
- tbDHN.npwp_trimmed.Equals(tbCustomer.npwp_trimmed) Then
- listResult.Add(New tbResult With {.periodedate = tbDHN.periodedate, .basenumber = tbCustomer.basenumber,
- .npwpDHN = tbDHN.npwp, .npwp = tbCustomer.npwp,
- .custnameDHN = tbDHN.customername, .custname = tbCustomer.customername,
- .similarityPercent = 100, .similarityBy = "NPWP"})
- Else
- ' We need to match single words with single words as well. Likewise, multiple words with multiple words as well.
- ' Previous implementation is rather flawed. Multiple words can be compared with single words.
- If (tbCustomer.isSingleWord AndAlso tbDHN.isSingleWord) OrElse
- (Not tbCustomer.isSingleWord AndAlso Not tbDHN.isSingleWord) Then
- Dim result = LevenshteinDistance(tbCustomer.customername_excluded, tbDHN.customername_excluded)
- If result >= possibility Then
- listResult.Add(New tbResult With {.periodedate = tbDHN.periodedate, .basenumber = tbCustomer.basenumber,
- .npwpDHN = tbDHN.npwp, .npwp = tbCustomer.npwp,
- .custnameDHN = tbDHN.customername, .custname = tbCustomer.customername,
- .similarityPercent = result, .similarityBy = "CustomerName"})
- End If
- End If
- End If
- countProgressBar += 1 : lineNo += 1
- UpdateProgressBar(ProgressBarMatch, If(countProgressBar = 0, 0, (countProgressBar / countMax) * 100))
- If lineNo Mod 10 = 0 Then Application.DoEvents()
- If listResult.Count Mod 6000 = 0 Then PushToDatabase()
- Next
- Next
- Private Class tbDHN
- Public Property periodedate As String
- Public Property npwp As String
- Public Property npwp_trimmed As String
- Public Property customername As String
- Public Property customername_excluded As String
- Public Property isSingleWord As Boolean
- End Class
- Private Class tbCustomer
- Public Property basenumber As String
- Public Property npwp As String
- Public Property npwp_trimmed As String
- Public Property customername As String
- Public Property customername_excluded As String
- Public Property isSingleWord As Boolean
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement