2020-04-23 10:51:51 +00:00
|
|
|
|
using System;
|
2020-04-27 09:26:45 +00:00
|
|
|
|
using System.IO;
|
2020-04-23 10:51:51 +00:00
|
|
|
|
|
|
|
|
|
namespace Bücherwurm
|
|
|
|
|
{
|
|
|
|
|
class Program
|
|
|
|
|
{
|
2020-04-24 13:56:59 +00:00
|
|
|
|
private static Administration Admin {get; set;}
|
|
|
|
|
public static void Main(string[] args)
|
2020-04-23 10:51:51 +00:00
|
|
|
|
{
|
2020-04-24 13:54:17 +00:00
|
|
|
|
Admin = new Administration();
|
2020-04-27 09:26:45 +00:00
|
|
|
|
if (args.Length == 1)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Versuche JSON Katalog von {0} zu importieren...", args[0]);
|
|
|
|
|
string jsonString = File.ReadAllText(args[0]);
|
|
|
|
|
Admin.MakeImport(jsonString);
|
|
|
|
|
Console.WriteLine("Erfolg!");
|
|
|
|
|
}
|
2020-04-24 13:54:17 +00:00
|
|
|
|
var Continue = true;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Bitte geben Sie den Buchstaben für den Gewünschten Bereich an:");
|
|
|
|
|
Console.Write("(K)atalog, (I)nventar, (A)usleihe, Program beenden (X):");
|
|
|
|
|
var CategorySelect = Console.ReadLine().ToLower();
|
|
|
|
|
switch (CategorySelect)
|
|
|
|
|
{
|
|
|
|
|
case "k":
|
|
|
|
|
{
|
|
|
|
|
CatalogueSelection();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "i":
|
|
|
|
|
{
|
|
|
|
|
InventorySelection();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "a":
|
|
|
|
|
{
|
|
|
|
|
LendingSelection();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "x":
|
|
|
|
|
{
|
|
|
|
|
Continue = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Unbekannte Aktion: {0}", CategorySelect);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} while (Continue);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-24 13:56:59 +00:00
|
|
|
|
private static void CatalogueSelection()
|
2020-04-24 13:54:17 +00:00
|
|
|
|
{
|
|
|
|
|
var Continue = true;
|
|
|
|
|
do
|
|
|
|
|
{
|
2020-04-24 14:03:04 +00:00
|
|
|
|
Console.WriteLine("Bitte geben Sie den Buchstaben für die gewünschte Aktion an:");
|
|
|
|
|
Console.WriteLine("Katalog auf(l)isten, Bu(c)h hinzufügen, Buch entfe(r)nen, Katalog verlassen (x):");
|
|
|
|
|
var CatalogueSelect = Console.ReadLine().ToLower();
|
2020-04-24 13:54:17 +00:00
|
|
|
|
switch (CatalogueSelect)
|
|
|
|
|
{
|
|
|
|
|
case "x":
|
|
|
|
|
{
|
|
|
|
|
Continue = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "l":
|
|
|
|
|
{
|
|
|
|
|
Admin.ListCatalogue();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "c":
|
|
|
|
|
{
|
|
|
|
|
Admin.AddToCatalogue();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "r":
|
|
|
|
|
{
|
|
|
|
|
Admin.RemoveFromCatalogue();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Ungültige Eingabe: {0}", CatalogueSelect);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} while (Continue);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-24 13:56:59 +00:00
|
|
|
|
private static void InventorySelection()
|
2020-04-24 13:54:17 +00:00
|
|
|
|
{
|
|
|
|
|
var Continue = true;
|
|
|
|
|
do
|
|
|
|
|
{
|
2020-04-24 14:03:04 +00:00
|
|
|
|
Console.WriteLine("Bitte geben Sie den Buchstaben für die gewünschte Aktion an:");
|
|
|
|
|
Console.WriteLine("Inventar auf(l)isten, Exemplar hinzufügen (c), Exemplar entfe(r)nen, Inventar verlassen (x):");
|
|
|
|
|
var InventorySelect = Console.ReadLine().ToLower();
|
2020-04-24 13:54:17 +00:00
|
|
|
|
switch (InventorySelect)
|
|
|
|
|
{
|
|
|
|
|
case "x":
|
|
|
|
|
{
|
|
|
|
|
Continue = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "l":
|
|
|
|
|
{
|
|
|
|
|
Admin.ListInventory();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "c":
|
|
|
|
|
{
|
|
|
|
|
Admin.AddToInventory();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "r":
|
|
|
|
|
{
|
|
|
|
|
Admin.RemoveFromInventory();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Ungültige Eingabe: {0}", InventorySelect);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} while (Continue);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-24 13:56:59 +00:00
|
|
|
|
private static void LendingSelection()
|
2020-04-24 13:54:17 +00:00
|
|
|
|
{
|
|
|
|
|
var Continue = true;
|
|
|
|
|
do
|
|
|
|
|
{
|
2020-04-24 14:03:04 +00:00
|
|
|
|
Console.WriteLine("Bitte geben Sie den Buchstaben für die gewünschte Aktion an:");
|
|
|
|
|
Console.WriteLine("Aktive Ausleihen auf(l)isten, Alle Ausleihen Aufli(s)ten, (A)usleihe tätigen, Ausleihe zu(r)ückgeben, Ausleihe verlassen (x):");
|
|
|
|
|
var LendSelect = Console.ReadLine().ToLower();
|
2020-04-24 13:54:17 +00:00
|
|
|
|
switch (LendSelect)
|
|
|
|
|
{
|
|
|
|
|
case "x":
|
|
|
|
|
{
|
|
|
|
|
Continue = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "l":
|
|
|
|
|
{
|
|
|
|
|
Admin.ListActiveLendings();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "s":
|
|
|
|
|
{
|
|
|
|
|
Admin.ListAllLendings();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "a":
|
|
|
|
|
{
|
|
|
|
|
Admin.MakeLending();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "r":
|
|
|
|
|
{
|
|
|
|
|
Admin.ReturnLending();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("UNbekannte Eingabe: {0}", LendSelect);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} while (Continue);
|
2020-04-23 10:51:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|