JasperHuyghe

Lagenmodel-oef6-Winform

Mar 14th, 2023
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.96 KB | None | 0 0
  1. Business.cs
  2. class Business
  3.     {
  4.         //ONDERNEMINGSNUMMER
  5.  
  6.         public bool CheckONDNR(string pOND)
  7.         {
  8.             bool resultaat = false;
  9.             if (pOND.Length == 11)
  10.             {
  11.                 // CODE LLK:
  12.                 // char[] cijfers = new char[9]
  13.                 // int i = 0;
  14.                 // for(int teller = 0; teller<9; teller++)
  15.                 //{
  16.                 //    if (pOND[teller] != '.')
  17.                 //    {
  18.                 //        cijfers[i] = nummer[teller]
  19.                 //        i ++;
  20.                 //    }
  21.                 //}
  22.                 // string cijfers1 = new string (cijfers); // string maken van char-array
  23.                                                             // Alle karakters na elkaar zetten
  24.                 // int cijfers2=Convert.Toint32(cijfers1); // Omzetten naar getal met 7 cijfers
  25.                // cijfers = new char[2]
  26.                // cijfers[0] = pOND[nummer.Length-2]
  27.                //cijfers [1] = pOND[Oef6_Ondernemingsnummer.Lentgh - 1]
  28.                // int cijfers3 = Convert.ToInt32(new string(cijfers)); // string maken van karakters
  29.                                                                        // Alle karakters na elkaar zetten
  30.                                                                        // Omzetten naar 2 cijfers
  31.  
  32.                 // int check;
  33.                 // check = 97-(cijfers2%97); // Controlegtal
  34.                 // if check == cijfers3
  35.                 //{resultaat = true}
  36.                 pOND = pOND.Replace(".", "");
  37.                 double getal1 = Convert.ToDouble(pOND.Substring(0, 7));
  38.                
  39.                 double getal2 = (97 - (getal1 % 97));
  40.  
  41.                 double getal3 = Convert.ToDouble(pOND.Substring(7, 2));
  42.                 if (getal2 == getal3)
  43.                 {
  44.                     resultaat = true;
  45.                 }
  46.                
  47.             }
  48.             return resultaat;
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment