Big Logo
This commit is contained in:
@@ -14,6 +14,9 @@ namespace Display
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
BigLogo();
|
||||||
|
Console.WriteLine("Luminous Sales v0.1 by A. Konarcheva, D. Byalkov & D. Todorov 2021");
|
||||||
|
Console.WriteLine();
|
||||||
var uc = new UserController();
|
var uc = new UserController();
|
||||||
InitialSetup.InitialRegistration(uc);
|
InitialSetup.InitialRegistration(uc);
|
||||||
Console.Write("Enter password: ");
|
Console.Write("Enter password: ");
|
||||||
@@ -34,7 +37,6 @@ namespace Display
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Console.WriteLine("Luminous Sales v0.1");
|
|
||||||
view.ActionHandle();
|
view.ActionHandle();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -42,5 +44,14 @@ namespace Display
|
|||||||
Console.WriteLine(e.Message);
|
Console.WriteLine(e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private static void BigLogo()
|
||||||
|
{
|
||||||
|
Console.WriteLine(" _ _ _____ _ ");
|
||||||
|
Console.WriteLine(" | | (_) / ____| | | ");
|
||||||
|
Console.WriteLine(" | | _ _ _ __ ___ _ _ __ ___ _ _ ___ | (___ __ _| | ___ ___ ");
|
||||||
|
Console.WriteLine(" | | | | | | '_ ` _ \\| | '_ \\ / _ \\| | | / __| \\___ \\ / _` | |/ _ / __|");
|
||||||
|
Console.WriteLine(" | |___| |_| | | | | | | | | | | (_) | |_| \\__ \\ ____) | (_| | | __\\__ \\");
|
||||||
|
Console.WriteLine(" |______\\__,_|_| |_| |_|_|_| |_|\\___/ \\__,_|___/ |_____/ \\__,_|_|\\___|___/");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@ namespace Display.Views
|
|||||||
UserController userctl = new UserController();
|
UserController userctl = new UserController();
|
||||||
public AdminView(User currentUser) : base(currentUser)
|
public AdminView(User currentUser) : base(currentUser)
|
||||||
{
|
{
|
||||||
|
this.currentUser = currentUser;
|
||||||
}
|
}
|
||||||
public override void ShowAvaliableCommands()
|
public override void ShowAvaliableCommands()
|
||||||
{
|
{
|
||||||
@@ -300,6 +300,7 @@ namespace Display.Views
|
|||||||
}
|
}
|
||||||
public void AddItem()
|
public void AddItem()
|
||||||
{
|
{
|
||||||
|
ProductController productctrl = new ProductController(currentUser);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Console.WriteLine("Adding item to database...");
|
Console.WriteLine("Adding item to database...");
|
||||||
|
@@ -11,9 +11,10 @@ namespace Display.Views
|
|||||||
{
|
{
|
||||||
internal ProductController productctrl;
|
internal ProductController productctrl;
|
||||||
private DealController dealctrl;
|
private DealController dealctrl;
|
||||||
private User currentUser;
|
internal User currentUser;
|
||||||
public BaseView(User currentUser)
|
public BaseView(User currentUser)
|
||||||
{
|
{
|
||||||
|
this.currentUser = currentUser;
|
||||||
this.dealctrl = new DealController(currentUser);
|
this.dealctrl = new DealController(currentUser);
|
||||||
}
|
}
|
||||||
public virtual void ShowAvaliableCommands()
|
public virtual void ShowAvaliableCommands()
|
||||||
@@ -107,22 +108,46 @@ namespace Display.Views
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Console.Write("Type in item id or name: ");
|
List<Product> check = new List<Product>();
|
||||||
string itemInput = Console.ReadLine();
|
bool endTyped = false;
|
||||||
int itemId;
|
while (!endTyped)
|
||||||
if (int.TryParse(itemInput, out itemId))
|
|
||||||
{
|
{
|
||||||
var productToAdd = productctrl.Get(itemId);
|
Console.Write("Type in item id or name: ");
|
||||||
Console.Write("Amount: ");
|
string itemInput = Console.ReadLine();
|
||||||
double amount = double.Parse(Console.ReadLine());
|
if (itemInput.ToLower() != "end")
|
||||||
dealctrl.Add(itemId, amount, DateTime.Now);
|
{
|
||||||
}
|
int itemId;
|
||||||
else
|
if (int.TryParse(itemInput, out itemId))
|
||||||
{
|
{
|
||||||
var productToAdd = productctrl.Get(itemInput);
|
var productToAdd = productctrl.Get(itemId);
|
||||||
Console.Write("Amount: ");
|
Console.Write("Amount: ");
|
||||||
double amount = double.Parse(Console.ReadLine());
|
double amount = double.Parse(Console.ReadLine());
|
||||||
dealctrl.Add(itemInput, amount, DateTime.Now);
|
dealctrl.Add(itemId, amount, DateTime.Now);
|
||||||
|
check.Add(productToAdd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var productToAdd = productctrl.Get(itemInput);
|
||||||
|
Console.Write("Amount: ");
|
||||||
|
double amount = double.Parse(Console.ReadLine());
|
||||||
|
dealctrl.Add(itemInput, amount, DateTime.Now);
|
||||||
|
check.Add(productToAdd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
endTyped = true;
|
||||||
|
Console.WriteLine("Check");
|
||||||
|
double sum = 0;
|
||||||
|
var lastdeals = dealctrl.GetAll().OrderByDescending(x => x.Id).ToArray();
|
||||||
|
for (int i = 0; i < check.Count; i++)
|
||||||
|
{
|
||||||
|
sum += check[i].Price * lastdeals[i].Amount;
|
||||||
|
int rowNum = i + 1;
|
||||||
|
Console.WriteLine($"{rowNum} {check[i].Name} {check[i].Price}x{lastdeals[i].Amount}");
|
||||||
|
}
|
||||||
|
Console.WriteLine($"Total: {sum}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
Reference in New Issue
Block a user