Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.21 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.         static void Main(string[] args)
  13.         {
  14.             string userName;
  15.             string passWordUser;
  16.             statusPass InlogStatus;
  17.             InlogStatus = statusPass.Onbekend;
  18.             int poging = (0);
  19.             int maxPoging = (3);
  20.  
  21.             Console.Write("Console Asks - Please Enter your Name: ");
  22.             userName = Console.ReadLine();
  23.  
  24.             Console.WriteLine("");
  25.  
  26.             while (InlogStatus != statusPass.OK)
  27.             {
  28.                 Console.WriteLine("U heeft nog ({0}/{1}) over", poging, maxPoging);
  29.                 Console.WriteLine("************************************");
  30.                 Console.Write("Console Asks - Please Enter your Password: ");
  31.                 passWordUser = Console.ReadLine();
  32.  
  33.                 InlogStatus = auth(passWordUser);
  34.                 switch (InlogStatus)
  35.                 {
  36.                     case statusPass.OK:
  37.                         Console.WriteLine("************************************");
  38.                         Console.WriteLine("Wacht Woord is Okey");
  39.                         break;
  40.  
  41.                     case statusPass.NietOK:
  42.                         Console.WriteLine("************************************");
  43.                         Console.WriteLine("Wacht Woord is niet goed");
  44.                         poging++;
  45.                         if (poging == 2)
  46.                         {
  47.                             Console.WriteLine("LET OP: Laatste poging!");
  48.                         }
  49.                         break;
  50.                 }
  51.                 if (poging == 3)
  52.                     break;
  53.  
  54.             }
  55.  
  56.             if (InlogStatus == statusPass.OK)
  57.             {
  58.                 Console.WriteLine("************************************");
  59.                 Console.Write("Welkom bij Sharpsound ({0})", userName);
  60.              
  61.                 ShowMenu();
  62.  
  63.                 Console.WriteLine("Doei");
  64.                 Console.ReadLine();
  65.  
  66.  
  67.             }
  68.             else
  69.             {
  70.                 Console.Write("Max aantal pogingen begrijkt neem contact op met uw netwerk administrator");
  71.                 Console.ReadLine();
  72.             }
  73.  
  74.         }
  75.  
  76.  
  77.         private static statusPass auth(string passWordUser)
  78.         {
  79.  
  80.             {
  81.                 string passWord = "1";
  82.                 statusPass InlogStatus;
  83.                 InlogStatus = statusPass.Onbekend;
  84.  
  85.                 if (passWordUser == passWord)
  86.                 {
  87.                     InlogStatus = statusPass.OK;
  88.                 }
  89.                 else
  90.                 {
  91.                     InlogStatus = statusPass.NietOK;
  92.                 }
  93.                 return (InlogStatus);
  94.             }
  95.         }
  96.  
  97.  
  98.         private static void ShowMenu()
  99.         {
  100.             ConsoleKeyInfo pressed;
  101.  
  102.             Console.WriteLine("My Options");
  103.             Console.WriteLine();
  104.             Console.WriteLine("1. Overzicht mp3 spelers");
  105.             Console.WriteLine("2 - menu option 2");
  106.             Console.WriteLine("3 - menu option 3");
  107.             Console.WriteLine("4 - menu option 4");
  108.             Console.WriteLine("5 - menu option 5");
  109.             Console.WriteLine("6 - menu option 6");
  110.             Console.WriteLine("7 - menu option 7");
  111.             Console.WriteLine("8 - menu option 8");
  112.             Console.WriteLine("9 - menu option 9");
  113.  
  114.             Console.Write("Choice (1,2,3,4,5,6,7,8,or 9): ");
  115.             Console.WriteLine(" ");
  116.             pressed = Console.ReadKey();
  117.             showSelectedMenu(pressed.Key.ToString());
  118.  
  119.  
  120.         }
  121.  
  122.  
  123.         private static void showSelectedMenu(string MyChoice)
  124.         {
  125.             //ConsoleKeyInfo pressed;
  126.             switch (MyChoice)
  127.             {
  128.                 case "D1":
  129.                     Console.WriteLine(" gekozen actie: 1. Overzicht mp3 spelers");
  130.                     Console.ReadLine();
  131.                     DataMp3Player = showAllMp3();
  132.            
  133.             for (int i = 0; i <= DataMp3Player.GetUpperBound(0); i++)
  134.                 {
  135.                         string s1 = DataMp3Player[i, 0]; // GET technologies .inc --> volgende iteratie --> Far & Loud, etc...
  136.                         string s2 = DataMp3Player[i, 1]; // HF 410 --> volgende iteratie --> XM 600, etc...
  137.                         Console.WriteLine("{0}, {1}", s1, s2);
  138.                 }
  139.                
  140.                     break;
  141.  
  142.                 case "D2":
  143.                     Console.WriteLine(" test applicatie");
  144.                     Console.ReadLine();
  145.                     break;
  146.                 case "D3":
  147.                     Console.WriteLine(" test applicatie");
  148.                     Console.ReadLine();
  149.                     break;
  150.                 case "D4":
  151.                     Console.WriteLine(" test applicatie");
  152.                     Console.ReadLine();
  153.                     break;
  154.                 case "D5":
  155.                     Console.WriteLine(" test applicatie");
  156.                     Console.ReadLine();
  157.                     break;
  158.                 case "D6":
  159.                     Console.WriteLine(" test applicatie");
  160.                     Console.ReadLine();
  161.                     break;
  162.                 case "D7":
  163.                     Console.WriteLine(" test applicatie");
  164.                     Console.ReadLine();
  165.                     break;
  166.                 case "D8":
  167.                     Console.WriteLine(" test applicatie");
  168.                     Console.ReadLine();
  169.                     break;
  170.                 case "D9":
  171.                     Console.WriteLine(" \nPress enter to end program");
  172.                     Console.ReadLine();
  173.                     break;
  174.                 default:
  175.                     Console.WriteLine(" unknown MenuItem");
  176.                     Console.ReadLine();
  177.                     break;  
  178.             }
  179.  
  180.             return ;
  181.  
  182.         }
  183.  
  184.         private static void showAllMp3()
  185.         {
  186.            
  187.            DataMp3Player[1].ID = 1;
  188.            DataMp3Player[1].Make = "GET technologies .inc";
  189.            DataMp3Player[1].Model = "HF 410";
  190.            DataMp3Player[1].MBSize = "4096 MB";
  191.            DataMp3Player[1].Price = "129.95";
  192.  
  193.            DataMp3Player[2].ID = 1;
  194.            DataMp3Player[2].Make = "Far & Loud";
  195.            DataMp3Player[2].Model = "XM 600";
  196.            DataMp3Player[2].MBSize = "8192 MB";
  197.            DataMp3Player[2].Price = "224.95";
  198.  
  199.            DataMp3Player[3].ID = 1;
  200.            DataMp3Player[3].Make = "Innotivative";
  201.            DataMp3Player[3].Model = "Z3";
  202.            DataMp3Player[3].MBSize = "512 MB";
  203.            DataMp3Player[3].Price = "79.95";
  204.  
  205.            DataMp3Player[4].ID = 1;
  206.            DataMp3Player[4].Make = "Resistance S.A.";
  207.            DataMp3Player[4].Model = "3001";
  208.            DataMp3Player[4].MBSize = "4096 MB";
  209.            DataMp3Player[4].Price = "124.95";
  210.  
  211.            DataMp3Player[5].ID = 1;
  212.            DataMp3Player[5].Make = "CBA";
  213.            DataMp3Player[5].Model = "NXT volume";
  214.            DataMp3Player[5].MBSize = "2048 MB";
  215.            DataMp3Player[5].Price = "159.05";
  216.        return DataMp3Player;   
  217.         }
  218.  
  219.     }
  220. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement