Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.16 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication4
  7. {
  8.     class Program
  9.     {
  10.         enum statusPass { OK, NietOK, Onbekend};
  11.        
  12.                  
  13.         static void Main(string[] args)
  14.         {
  15.             string userName;
  16.             string passWordUser;
  17.             statusPass InlogStatus;
  18.             InlogStatus = statusPass.Onbekend;
  19.             int poging = (0);
  20.             int maxPoging = (3);
  21.  
  22.                 Console.Write("Console Asks - Please Enter your Name: ");
  23.                 userName = Console.ReadLine();
  24.  
  25.                 Console.WriteLine("");
  26.  
  27.               while (InlogStatus != statusPass.OK)
  28.                 {
  29.                     Console.WriteLine("U heeft nog ({0}/{1}) over", poging, maxPoging);
  30.                     Console.WriteLine("************************************");
  31.                     Console.Write("Console Asks - Please Enter your Password: ");
  32.                     passWordUser = Console.ReadLine();
  33.  
  34.                     InlogStatus =  auth (passWordUser);
  35.                     switch (InlogStatus)
  36.                         {
  37.                             case statusPass.OK:
  38.                                 Console.WriteLine("************************************");
  39.                                 Console.WriteLine("Wacht Woord is Okey");
  40.                                 break;
  41.                        
  42.                             case statusPass.NietOK:
  43.                                 Console.WriteLine("************************************");
  44.                                 Console.WriteLine("Wacht Woord is niet goed");
  45.                                 poging++;
  46.                                     if (poging == 2)
  47.                                     {
  48.                                         Console.WriteLine("LET OP: Laatste poging!");
  49.                                     }
  50.                                 break;                    
  51.                         }
  52.                     if (poging == 3)
  53.                        break;
  54.  
  55.                 }
  56.  
  57.               if (InlogStatus == statusPass.OK)
  58.                   {    
  59.                       Console.WriteLine("************************************");
  60.                       Console.Write("Welkom bij Sharpsound ({0})", userName);
  61.                       Console.ReadLine();
  62.                   }
  63.               else
  64.                   {
  65.                       Console.Write("Max aantal poginen begrijkt neem contact op met uw netwerk administrator");
  66.                       Console.ReadLine();
  67.                   }
  68.        
  69.         }
  70.  
  71.         private static statusPass auth(string passWordUser)
  72.         {
  73.            
  74.             {
  75.                 string passWord = "SHARPSOUND";
  76.                 statusPass InlogStatus;
  77.                 InlogStatus = statusPass.Onbekend;
  78.  
  79.                 if (passWordUser == passWord)
  80.                 {
  81.                     InlogStatus = statusPass.OK;
  82.                 }
  83.                 else
  84.                 {
  85.                     InlogStatus = statusPass.NietOK;
  86.                 }
  87.                 return (InlogStatus);
  88.             }
  89.        }
  90.  
  91.  
  92.  
  93.     }
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement