{"id":294,"date":"2007-06-19T14:08:22","date_gmt":"2007-06-19T13:08:22","guid":{"rendered":"http:\/\/www.galhano.com\/blog\/?p=294"},"modified":"2017-01-12T11:54:45","modified_gmt":"2017-01-12T11:54:45","slug":"validar-niss-vbnet","status":"publish","type":"post","link":"http:\/\/galhano.com\/blog\/?p=294","title":{"rendered":"Validar NISS (VB.Net)"},"content":{"rendered":"<p><span style=\"font-size: small;\"><span style=\"font-family: Verdana;\"><span style=\"color: #0000ff; font-size: small;\">Fun\u00e7\u00e3o para validar NISS, com base nos crit\u00e9rios deste documento (<a id=\"p290\" href=\"http:\/\/www.galhano.com\/blog\/wp-content\/2007\/06\/NISS.pdf\">NISS.pdf<\/a>)<\/span><\/span><\/span><\/p>\n<p><span style=\"font-size: small;\"><a id=\"p295\" href=\"http:\/\/www.galhano.com\/blog\/wp-content\/2007\/06\/ValidarNISS_VBNet.txt\">ValidarNISS_VBNet.txt<\/a><a id=\"p295\" title=\"ValidarNISS_VBNet.txt\" href=\"http:\/\/www.galhano.com\/blog\/wp-admin\/ValidarNISS_VBNet.txt\"><\/a><\/span><\/p>\n<p><!--more--><\/p>\n<p>[vb]<br \/>\nFunction IsValidNISS(ByVal NISS As String) As Boolean<\/p>\n<p>If Len(NISS) = 11 Then<\/p>\n<p>Dim factor() As Integer = {29, 23, 19, 17, 13, 11, 7, 5, 3, 2}<\/p>\n<p>Dim t As Integer = Int32.Parse(GetChar(NISS, 1)) * factor(0) + _<\/p>\n<p>Int32.Parse(GetChar(NISS, 2)) * factor(1) + _<\/p>\n<p>Int32.Parse(GetChar(NISS, 3)) * factor(2) + _<\/p>\n<p>Int32.Parse(GetChar(NISS, 4)) * factor(3) + _<\/p>\n<p>Int32.Parse(GetChar(NISS, 5)) * factor(4) + _<\/p>\n<p>Int32.Parse(GetChar(NISS, 6)) * factor(5) + _<\/p>\n<p>Int32.Parse(GetChar(NISS, 7)) * factor(6) + _<\/p>\n<p>Int32.Parse(GetChar(NISS, 8)) * factor(7) + _<\/p>\n<p>Int32.Parse(GetChar(NISS, 9)) * factor(8) + _<\/p>\n<p>Int32.Parse(GetChar(NISS, 10)) * factor(9)<\/p>\n<p>Dim x As Integer = (9 &#8211; (Math.IEEERemainder(t, 10)))<\/p>\n<p>If x.ToString = GetChar(NISS, 11) Then<\/p>\n<p>Return True<\/p>\n<p>Else<\/p>\n<p>Return False<\/p>\n<p>End If<\/p>\n<p>Else<\/p>\n<p>Return False<\/p>\n<p>End If<\/p>\n<p>End Function<br \/>\n[\/vb]<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fun\u00e7\u00e3o para validar NISS, com base nos crit\u00e9rios deste documento (NISS.pdf) ValidarNISS_VBNet.txt<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"close","ping_status":"close","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,14],"tags":[],"class_list":["post-294","post","type-post","status-publish","format-standard","hentry","category-truques-dicas","category-tutorials","author-admin"],"_links":{"self":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=294"}],"version-history":[{"count":3,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/294\/revisions"}],"predecessor-version":[{"id":2094,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/294\/revisions\/2094"}],"wp:attachment":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=294"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}