Example #1
0
        public IActionResult Index()
        {
            Bestemming bestemming = new Bestemming();

            ViewBag.bestemmingen = _bestemmingService.FindAll();

            return(View(bestemming));
        }
Example #2
0
 public Vlucht(Vertrek vertrek, Bestemming bestemming, DateTime datumVertrek, DateTime datumAankomst)
 {
     Vluchtnummer  = vluchtnummer++;
     Vertrek       = vertrek;
     Bestemming    = bestemming;
     DatumVertrek  = datumVertrek;
     DatumAankomst = datumAankomst;
 }
Example #3
0
 public IActionResult BrochureToevoegen(Bestemming b)
 {
     if (this.ModelState.IsValid)
     {
         _bestemmingService.Add(b);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(b));
     }
 }
 public void Add(Bestemming b)
 {
     if (bestemmingen.Count == 0)
     {
         b.ID = 0;
         bestemmingen.Add(0, b);
     }
     else
     {
         b.ID = bestemmingen.Keys.Max() + 1;
         bestemmingen.Add(bestemmingen.Keys.Max() + 1, b);
     }
 }
Example #5
0
 /// <summary>
 /// Reading the file and adding it to the pinglist
 /// </summary>
 /// <returns>Ilist(bestemming)</returns>
 public IList <Bestemming> ReadFile()
 {
     try
     {
         using (var sr = File.OpenText(_path))
         {
             string readLine;
             while ((readLine = sr.ReadLine()) != null)
             {
                 var splitLine  = readLine.Split(_splitter);
                 var bestemming = new Bestemming
                 {
                     Address = splitLine[0],
                     Plaats  = splitLine[1],
                     Status  = "Await" // IMPORTANT at first cycle have everything gray instead of red
                 };
                 _pingList.Add(bestemming);
             }
             sr.Close();
         }
     }
     catch (FileNotFoundException)
     {
         Console.WriteLine("Het bestand is niet gevonden. (maak C:/OnlineTester/addresslijst.txt aan)");
         Console.WriteLine("Druk op enter om de applicatie af te sluiten.");
         Console.ReadLine();
         Environment.Exit(0);
     }
     catch (DirectoryNotFoundException)
     {
         Console.WriteLine("De folder is niet gevonden. (Je hebt geen C schijf?)");
         Console.WriteLine("Druk op enter om de applicatie af te sluiten.");
         Console.ReadLine();
         Environment.Exit(0);
     }
     catch (Exception)
     {
         Console.WriteLine("Een onverwachte fout is opgetreden");
         Console.WriteLine("Druk op enter om de applicatie af te sluiten.");
         Console.ReadLine();
         Environment.Exit(0);
     }
     return(_pingList);
 }
Example #6
0
        /// <summary>
        /// Print a single IP-address with the designated color code
        /// </summary>
        /// <param name="bestemming"></param>
        private static void Print(Bestemming bestemming)
        {
            var space  = "\t\t\t\t";
            var spacer = "\t\t";

            if (bestemming.Status == "Testing")
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
            }

            if (bestemming.Status == "Success")
            {
                Console.ForegroundColor = ConsoleColor.Green;
            }

            if (bestemming.Status != "Testing" && bestemming.Status != "Success")
            {
                Console.ForegroundColor = ConsoleColor.Red;
            }

            // first time, have everything gray instead of red
            if (bestemming.Status == "Await")
            {
                Console.ForegroundColor = ConsoleColor.Gray;
            }

            if (bestemming.Status.Length > 12)
            {
                space = "\t";
            }

            if (bestemming.Address.Length > 7)
            {
                spacer = "\t";
            }


            Console.WriteLine(bestemming.Status + space + bestemming.Address + spacer + bestemming.Plaats);
        }
Example #7
0
 /// <summary>
 /// Emptying the line for the designated "bestemming", this way a previous longer line will be cleared completly (No residu from the previous status)
 /// </summary>
 /// <param name="bestemming"></param>
 private static void EmptyTheLineFor(Bestemming bestemming)
 {
     Console.WriteLine();
     Console.SetCursorPosition(0, _pingList.IndexOf(bestemming));
 }
Example #8
0
 /// <summary>
 /// Sets the cursor to the beginning of the line of the "bestemming"
 /// </summary>
 /// <param name="bestemming"></param>
 private static void GetToLineOf(Bestemming bestemming)
 {
     Console.SetCursorPosition(0, _pingList.IndexOf(bestemming));
 }