Advertisement
Guest User

Untitled

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