Implemented program
This commit is contained in:
parent
d0c4877369
commit
7b322690b7
1 changed files with 32 additions and 7 deletions
|
|
@ -56,10 +56,20 @@ static void WriteRule(string text)
|
||||||
|
|
||||||
static IEnumerable<Teacher> LoadData(bool realData)
|
static IEnumerable<Teacher> LoadData(bool realData)
|
||||||
{
|
{
|
||||||
// TODO
|
string generalDataFilePath = "Data/teachers.csv";
|
||||||
// ITeacherDataImporter importer ...
|
string businessCardDataFilePath = "Data/teachers-with-business-card.csv";
|
||||||
// files: "Data/teachers.csv" & "Data/teachers-with-business-card.csv"
|
|
||||||
return null!;
|
if (!File.Exists(generalDataFilePath))
|
||||||
|
{
|
||||||
|
AnsiConsole.MarkupLine($"[red]Error:[/] File '{generalDataFilePath}' not found");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
ITeacherDataImporter importer = realData
|
||||||
|
? new TeacherDataCsvImporter(generalDataFilePath, businessCardDataFilePath)
|
||||||
|
: new TeacherDataFakeImporter();
|
||||||
|
|
||||||
|
return importer.LoadTeacherData();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Task DisplayFakeProgress()
|
static Task DisplayFakeProgress()
|
||||||
|
|
@ -90,7 +100,15 @@ static void PrintStatistics(IReadOnlyCollection<Teacher> teachers)
|
||||||
var hasBusinessCard = 0;
|
var hasBusinessCard = 0;
|
||||||
foreach (var teacher in teachers)
|
foreach (var teacher in teachers)
|
||||||
{
|
{
|
||||||
// TODO
|
if (teacher.ConsultingHour != null)
|
||||||
|
{
|
||||||
|
hasConsultingHours++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (teacher is TeacherWithBusinessCard)
|
||||||
|
{
|
||||||
|
hasBusinessCard++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double total = teachers.Count;
|
double total = teachers.Count;
|
||||||
|
|
@ -130,8 +148,15 @@ static SortOrder AskForSortOrder()
|
||||||
|
|
||||||
static ExportFormat AskForExportFormat()
|
static ExportFormat AskForExportFormat()
|
||||||
{
|
{
|
||||||
// TODO (similar to AskForDataToUse)
|
const string Csv = "Csv";
|
||||||
return default;
|
const string Html = "Html";
|
||||||
|
string dataToUse = AnsiConsole.Prompt(new SelectionPrompt<string>()
|
||||||
|
.Title("Do you want to load [blue]real[/] or [blue]sample[/] data?")
|
||||||
|
.AddChoices(Csv, Html));
|
||||||
|
|
||||||
|
AnsiConsole.MarkupLine($"Selected: [green]{dataToUse}[/]");
|
||||||
|
|
||||||
|
return dataToUse == Csv ? ExportFormat.Csv : ExportFormat.Html;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool AskForDataToUse()
|
static bool AskForDataToUse()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue