Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. For Each tbCustomer As tbCustomer In listCustomer
  2. If (BackgroundWorkerMatch.CancellationPending) Then
  3. Exit Sub
  4. End If
  5.  
  6. For Each tbDHN As tbDHN In listDHN
  7.  
  8. If tbDHN.npwp_trimmed.Length >= 5 AndAlso
  9. tbCustomer.npwp_trimmed.Length >= 5 AndAlso
  10. tbDHN.npwp_trimmed.Equals(tbCustomer.npwp_trimmed) Then
  11. listResult.Add(New tbResult With {.periodedate = tbDHN.periodedate, .basenumber = tbCustomer.basenumber,
  12. .npwpDHN = tbDHN.npwp, .npwp = tbCustomer.npwp,
  13. .custnameDHN = tbDHN.customername, .custname = tbCustomer.customername,
  14. .similarityPercent = 100, .similarityBy = "NPWP"})
  15. Else
  16. ' We need to match single words with single words as well. Likewise, multiple words with multiple words as well.
  17. ' Previous implementation is rather flawed. Multiple words can be compared with single words.
  18. If (tbCustomer.isSingleWord AndAlso tbDHN.isSingleWord) OrElse
  19. (Not tbCustomer.isSingleWord AndAlso Not tbDHN.isSingleWord) Then
  20. Dim result = LevenshteinDistance(tbCustomer.customername_excluded, tbDHN.customername_excluded)
  21. If result >= possibility Then
  22. listResult.Add(New tbResult With {.periodedate = tbDHN.periodedate, .basenumber = tbCustomer.basenumber,
  23. .npwpDHN = tbDHN.npwp, .npwp = tbCustomer.npwp,
  24. .custnameDHN = tbDHN.customername, .custname = tbCustomer.customername,
  25. .similarityPercent = result, .similarityBy = "CustomerName"})
  26. End If
  27. End If
  28. End If
  29. countProgressBar += 1 : lineNo += 1
  30. UpdateProgressBar(ProgressBarMatch, If(countProgressBar = 0, 0, (countProgressBar / countMax) * 100))
  31. If lineNo Mod 10 = 0 Then Application.DoEvents()
  32. If listResult.Count Mod 6000 = 0 Then PushToDatabase()
  33. Next
  34. Next
  35.  
  36. Private Class tbDHN
  37. Public Property periodedate As String
  38. Public Property npwp As String
  39. Public Property npwp_trimmed As String
  40. Public Property customername As String
  41. Public Property customername_excluded As String
  42. Public Property isSingleWord As Boolean
  43. End Class
  44. Private Class tbCustomer
  45. Public Property basenumber As String
  46. Public Property npwp As String
  47. Public Property npwp_trimmed As String
  48. Public Property customername As String
  49. Public Property customername_excluded As String
  50. Public Property isSingleWord As Boolean
  51. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement