Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.45 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.                     DataMp3Player = showAllMp3();
  141.            
  142.             for (int i = 0; i <= DataMp3Player.GetUpperBound(0); i++)
  143.                 {
  144.                         string s1 = DataMp3Player[i, 0]; // GET technologies .inc --> volgende iteratie --> Far & Loud, etc...
  145.                         string s2 = DataMp3Player[i, 1]; // HF 410 --> volgende iteratie --> XM 600, etc...
  146.                         Console.WriteLine("{0}, {1}", s1, s2);
  147.                 }
  148.                
  149.                     break;
  150.  
  151.                 case "D2":
  152.                     Console.WriteLine(" test applicatie");
  153.                     Console.ReadLine();
  154.                     break;
  155.                 case "D3":
  156.                     Console.WriteLine(" test applicatie");
  157.                     Console.ReadLine();
  158.                     break;
  159.                 case "D4":
  160.                     Console.WriteLine(" test applicatie");
  161.                     Console.ReadLine();
  162.                     break;
  163.                 case "D5":
  164.                     Console.WriteLine(" test applicatie");
  165.                     Console.ReadLine();
  166.                     break;
  167.                 case "D6":
  168.                     Console.WriteLine(" test applicatie");
  169.                     Console.ReadLine();
  170.                     break;
  171.                 case "D7":
  172.                     Console.WriteLine(" test applicatie");
  173.                     Console.ReadLine();
  174.                     break;
  175.                 case "D8":
  176.                     Console.WriteLine(" test applicatie");
  177.                     Console.ReadLine();
  178.                     break;
  179.                 case "D9":
  180.                     Console.WriteLine(" \nPress enter to end program");
  181.                     Console.ReadLine();
  182.                     break;
  183.                 default:
  184.                     Console.WriteLine(" unknown MenuItem");
  185.                     Console.ReadLine();
  186.                     break;  
  187.             }
  188.  
  189.             return ;
  190.  
  191.         }
  192.  
  193.         private static void showAllMp3()
  194.         {
  195.            Mp3players[] DataMp3Player = new Mp3players[5];
  196.            
  197.            DataMp3Player[1].ID = 1;
  198.            DataMp3Player[1].Make = "GET technologies .inc";
  199.            DataMp3Player[1].Model = "HF 410";
  200.            DataMp3Player[1].MBSize = "4096 MB";
  201.            DataMp3Player[1].Price = "129.95";
  202.  
  203.            DataMp3Player[2].ID = 1;
  204.            DataMp3Player[2].Make = "Far & Loud";
  205.            DataMp3Player[2].Model = "XM 600";
  206.            DataMp3Player[2].MBSize = "8192 MB";
  207.            DataMp3Player[2].Price = "224.95";
  208.  
  209.            DataMp3Player[3].ID = 1;
  210.            DataMp3Player[3].Make = "Innotivative";
  211.            DataMp3Player[3].Model = "Z3";
  212.            DataMp3Player[3].MBSize = "512 MB";
  213.            DataMp3Player[3].Price = "79.95";
  214.  
  215.            DataMp3Player[4].ID = 1;
  216.            DataMp3Player[4].Make = "Resistance S.A.";
  217.            DataMp3Player[4].Model = "3001";
  218.            DataMp3Player[4].MBSize = "4096 MB";
  219.            DataMp3Player[4].Price = "124.95";
  220.  
  221.            DataMp3Player[5].ID = 1;
  222.            DataMp3Player[5].Make = "CBA";
  223.            DataMp3Player[5].Model = "NXT volume";
  224.            DataMp3Player[5].MBSize = "2048 MB";
  225.            DataMp3Player[5].Price = "159.05";
  226.        return DataMp3Player;   
  227.         }
  228.  
  229.     }
  230. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement