Big Logo
This commit is contained in:
@@ -14,6 +14,9 @@ namespace Display
|
||||
{
|
||||
try
|
||||
{
|
||||
BigLogo();
|
||||
Console.WriteLine("Luminous Sales v0.1 by A. Konarcheva, D. Byalkov & D. Todorov 2021");
|
||||
Console.WriteLine();
|
||||
var uc = new UserController();
|
||||
InitialSetup.InitialRegistration(uc);
|
||||
Console.Write("Enter password: ");
|
||||
@@ -34,7 +37,6 @@ namespace Display
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Console.WriteLine("Luminous Sales v0.1");
|
||||
view.ActionHandle();
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -42,5 +44,14 @@ namespace Display
|
||||
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();
|
||||
public AdminView(User currentUser) : base(currentUser)
|
||||
{
|
||||
|
||||
this.currentUser = currentUser;
|
||||
}
|
||||
public override void ShowAvaliableCommands()
|
||||
{
|
||||
@@ -300,6 +300,7 @@ namespace Display.Views
|
||||
}
|
||||
public void AddItem()
|
||||
{
|
||||
ProductController productctrl = new ProductController(currentUser);
|
||||
try
|
||||
{
|
||||
Console.WriteLine("Adding item to database...");
|
||||
|
@@ -11,9 +11,10 @@ namespace Display.Views
|
||||
{
|
||||
internal ProductController productctrl;
|
||||
private DealController dealctrl;
|
||||
private User currentUser;
|
||||
internal User currentUser;
|
||||
public BaseView(User currentUser)
|
||||
{
|
||||
this.currentUser = currentUser;
|
||||
this.dealctrl = new DealController(currentUser);
|
||||
}
|
||||
public virtual void ShowAvaliableCommands()
|
||||
@@ -106,9 +107,15 @@ namespace Display.Views
|
||||
private void SaleItem()
|
||||
{
|
||||
try
|
||||
{
|
||||
List<Product> check = new List<Product>();
|
||||
bool endTyped = false;
|
||||
while (!endTyped)
|
||||
{
|
||||
Console.Write("Type in item id or name: ");
|
||||
string itemInput = Console.ReadLine();
|
||||
if (itemInput.ToLower() != "end")
|
||||
{
|
||||
int itemId;
|
||||
if (int.TryParse(itemInput, out itemId))
|
||||
{
|
||||
@@ -116,6 +123,7 @@ namespace Display.Views
|
||||
Console.Write("Amount: ");
|
||||
double amount = double.Parse(Console.ReadLine());
|
||||
dealctrl.Add(itemId, amount, DateTime.Now);
|
||||
check.Add(productToAdd);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -123,6 +131,23 @@ namespace Display.Views
|
||||
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)
|
||||
|
Reference in New Issue
Block a user