<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DotBert &#187; elfproef</title>
	<atom:link href="http://dotbert.loedeman.nl/category/elfproef/feed" rel="self" type="application/rss+xml" />
	<link>http://dotbert.loedeman.nl</link>
	<description>.NET thoughts by Bert Loedeman</description>
	<lastBuildDate>Thu, 18 Mar 2010 12:49:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Dutch bank account number check</title>
		<link>http://dotbert.loedeman.nl/dutch-bank-account-number-check</link>
		<comments>http://dotbert.loedeman.nl/dutch-bank-account-number-check#comments</comments>
		<pubDate>Thu, 13 Aug 2009 07:55:31 +0000</pubDate>
		<dc:creator>Bert Loedeman</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[11-proef]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[elfproef]]></category>

		<guid isPermaLink="false">http://dotbert.loedeman.nl/?p=111</guid>
		<description><![CDATA[For a Dutch customer I currently work for, I worked out the bank account number check (in Dutch: elfproef voor bankrekeningnummers). After checking out the Internet for the correct definition of Dutch bank account numbers (found on Wikipedia), I created the next check in C#:

var cleanAccNumber = accountNumber.Replace(&#34;.&#34;, &#34;&#34;);

// A bank account number consists of [...]]]></description>
			<content:encoded><![CDATA[<p>For a Dutch customer I currently work for, I worked out the bank account number check (in Dutch: elfproef voor bankrekeningnummers). After checking out the Internet for the correct definition of Dutch bank account numbers (found on Wikipedia), I created the next check in C#:</p>
<pre class="brush: csharp;">
var cleanAccNumber = accountNumber.Replace(&quot;.&quot;, &quot;&quot;);

// A bank account number consists of 9 or 10 digits
if (!(cleanAccNumber.Length == 9 || cleanAccNumber.Length == 10)) return false;

// ... all being numeric and not resulting in a 0 when converted to a number ...
long l;
if (!long.TryParse(cleanAccNumber, out l)) return false;
if (l == 0) return false;

// pad it to the left to 10 digits with preceding zero's.
cleanAccNumber = cleanAccNumber.PadLeft(10, '0');

// ... the number must be validatable to the so-called 11-proof ...
long total = 0;
for (var i = 1; i &lt;= cleanAccNumber.Length; i++)
{
// 11-proof for 10 digit bank account numbers (bron: Wikipedia): (1*A + 2*B + 3*C + 4*D + 5*E + 6*F + 7*G + 8*H + 9*H + 10*I) % 11 == 0
var number = Convert.ToInt32(cleanAccNumber[i - 1].ToString());
total += number*i;
}

// ... not result in a 0 when dividing by 11 ...
if (total == 0) return false;

// ... and not have a modulo when dividing by 11.
return total % 11 == 0;
</pre>
<p>Good luck when you should build one for yourself!</p>
]]></content:encoded>
			<wfw:commentRss>http://dotbert.loedeman.nl/dutch-bank-account-number-check/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dutch social security number check</title>
		<link>http://dotbert.loedeman.nl/dutch-social-security-number-check</link>
		<comments>http://dotbert.loedeman.nl/dutch-social-security-number-check#comments</comments>
		<pubDate>Thu, 20 Nov 2008 12:15:00 +0000</pubDate>
		<dc:creator>Bert Loedeman</dc:creator>
				<category><![CDATA[11-proef]]></category>
		<category><![CDATA[bsn]]></category>
		<category><![CDATA[burgerservicenummer]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[elfproef]]></category>
		<category><![CDATA[social security number]]></category>

		<guid isPermaLink="false">http://www.loedeman.net/wordpress/?p=24</guid>
		<description><![CDATA[For a Dutch customer I currently work for, I dealed with an incorrect social security number check (in Dutch: elfproef voor BSN&#8217;s/burgerservicenummers). After checking out the Internet for the correct definition of Dutch social security numbers (e.g. Burgerservicenummer &#8211; Wikipedia), I created the next check in C#:

string cleanBsnNr = bsnNr.Trim().Replace(&#34;.&#34;, &#34;&#34;);

// A BSN consists of [...]]]></description>
			<content:encoded><![CDATA[<p>For a Dutch customer I currently work for, I dealed with an incorrect social security number check (in Dutch: elfproef voor BSN&#8217;s/burgerservicenummers). After checking out the Internet for the correct definition of Dutch social security numbers (e.g. <a href="http://nl.wikipedia.org/wiki/Burgerservicenummer">Burgerservicenummer &#8211; Wikipedia</a>), I created the next check in C#:</p>
<pre class="brush: csharp;">
string cleanBsnNr = bsnNr.Trim().Replace(&quot;.&quot;, &quot;&quot;);

// A BSN consists of 9 characters ...
if(cleanBsnNr.Length != 9) return false;

// ... all being numeric and not resulting in a 0 when converted to a number ...
long l;
if(!long.TryParse(cleanBsnNr, out l)) return false;
else if(l == 0) return false;

// ... the number must be validatable to the so-called 11-proof ...
long total = 0;
for(int i = 1; i &lt;= 9; i++)
{
    // 11-proof voor BSN's: (9*A + 8*B + 7*C + 6*D + 5*E + 4*F + 3*G + 2*H + (-1*I)) % 11 == 0
    int number = Convert.ToInt32(cleanBsnNr[i - 1].ToString());
    int multiplier = 10 - i;
    if(i == 9) multiplier = -1 * multiplier;

    total += number * multiplier;
}

// ... not result in a 0 when dividing by 11 ...
if(total == 0) return false;

// ... and not have a modulo when dividing by 11.
return total % 11 == 0;
</pre>
<p>Good luck when you should build one for yourself. Checking your own built check can be done using <a href="http://cgi.dit.nl/sofi.cgi">this website</a> with generated BSN&#8217;s (or your own, of course) by <a href="http://www.wilmans.com/sofinummer/">Menno Wilmans</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotbert.loedeman.nl/dutch-social-security-number-check/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
