59 lines
2.0 KiB
C#
59 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Jobs
|
|
{
|
|
internal class JobVerwaltung
|
|
{
|
|
private Queue<Jobs> jobsQue = new Queue<Jobs>();
|
|
public void AddJob(Jobs jobs)
|
|
{
|
|
jobsQue.Enqueue(jobs);
|
|
int jobId = jobsQue.Count();
|
|
if (jobId > 1)
|
|
{
|
|
Console.WriteLine($"Es sind noch {jobId} Jobs offen");
|
|
Console.WriteLine("-----------------------------------");
|
|
Console.WriteLine();
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine($"Es ist noch {jobId} Job offen.");
|
|
Console.WriteLine("-----------------------------------");
|
|
Console.WriteLine();
|
|
}
|
|
}
|
|
public void GetJobDone()
|
|
{
|
|
if (jobsQue.Count() == 0)
|
|
{
|
|
Console.WriteLine("Es sind keine Jobs mehr vorhanden.");
|
|
Console.WriteLine("-----------------------------------");
|
|
Console.WriteLine();
|
|
}
|
|
else
|
|
{
|
|
Jobs nextJobs = jobsQue.Dequeue();
|
|
Console.WriteLine($"Nächst Job ist {nextJobs}");
|
|
int jobId = jobsQue.Count();
|
|
Console.WriteLine($"Es sind noch {jobId} offen");
|
|
Console.WriteLine("-----------------------------------");
|
|
Console.WriteLine();
|
|
}
|
|
}
|
|
public void ShowAllJobs()
|
|
{
|
|
Console.WriteLine("Alle vorhandenen Jobs: ");
|
|
foreach (Jobs jobs in jobsQue)
|
|
{
|
|
Console.WriteLine($"Folgende Jobs stehen noch aus: {jobs.GetBezeichnung()}");
|
|
Console.WriteLine($"Der auftrag kommt von: {jobs.GetAuftraggeber()}");
|
|
Console.WriteLine($"Und wird in der Zeit von: {jobs.GetDauer()} Minuten bearbeitet");
|
|
}
|
|
}
|
|
}
|
|
}
|