Skip to content
7 changes: 6 additions & 1 deletion Order.Management.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.87
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Order.Management", "Order.Management\Order.Management.csproj", "{1DAC7794-3F0E-4083-95A9-2E6FF9512C0C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Order.Management", "Order.Management\Order.Management.csproj", "{1DAC7794-3F0E-4083-95A9-2E6FF9512C0C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4B49C9C7-B797-4C36-B4F5-1EEA2554D763}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
105 changes: 105 additions & 0 deletions Order.Management/CustomerInputHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
using Order.Management.ToyBlocks;
using System;
using System.Collections.Generic;

namespace Order.Management
{
public class CustomerInputHandler
{
// Get customer Info
public (string customerName, string address, string dueDate) GetCustomerInfoInput()
{
string customerName = GetUserInputAsString("Please input your Name: ");

string address = GetUserInputAsString("Please input your Address: ");

// TODO: should probably be DateTime with valid user input for DateTime
string dueDate = GetUserInputAsString("Please input your Due Date: ");
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be parsing user input into DateTime


return (customerName, address, dueDate);
}

public List<Shape> GetCustomerOrderInput()
{
Square square = OrderSquaresInput();
Triangle triangle = OrderTrianglesInput();
Circle circle = OrderCirclesInput();

var orderedShapes = new List<Shape>();
orderedShapes.Add(square);
orderedShapes.Add(triangle);
orderedShapes.Add(circle);

return orderedShapes;
}

private static Circle OrderCirclesInput()
{
Console.WriteLine();
int redCircle = GetUserInputAsInt("Please input the number of Red Circle: ");
int blueCircle = GetUserInputAsInt("Please input the number of Blue Circle: ");
int yellowCircle = GetUserInputAsInt("Please input the number of Yellow Circle: ");

Circle circle = new Circle(redCircle, blueCircle, yellowCircle);

return circle;
}

private static Square OrderSquaresInput()
{
Console.WriteLine();
int redSquare = GetUserInputAsInt("Please input the number of Red Squares: ");
int blueSquare = GetUserInputAsInt("Please input the number of Blue Squares: ");
int yellowSquare = GetUserInputAsInt("Please input the number of Yellow Squares: ");

Square square = new Square(redSquare, blueSquare, yellowSquare);
return square;
}

private static Triangle OrderTrianglesInput()
{
Console.WriteLine();
int redTriangle = GetUserInputAsInt("Please input the number of Red Triangles: ");
int blueTriangle = GetUserInputAsInt("Please input the number of Blue Triangles: ");
int yellowTriangle = GetUserInputAsInt("Please input the number of Yellow Triangles: ");

Triangle triangle = new Triangle(redTriangle, blueTriangle, yellowTriangle);

return triangle;
}

private static string GetUserInputAsString(string message)
{
if (string.IsNullOrWhiteSpace(message))
{
throw new ArgumentNullException(nameof(message));
}

Console.Write(message);

// Get user input
string input = Console.ReadLine().Trim();
while (string.IsNullOrEmpty(input))
{
Console.WriteLine("please enter valid details");
Console.Write(message);
input = Console.ReadLine();
}

return input;
}

private static int GetUserInputAsInt(string message) //TODO: example had ints being nullable from input
{
string input = GetUserInputAsString(message);

while (!int.TryParse(input, out var _))
{
Console.WriteLine("please enter valid details");
input = GetUserInputAsString(message);
}

return int.Parse(input);
}
}
}
68 changes: 0 additions & 68 deletions Order.Management/CuttingListReport.cs

This file was deleted.

98 changes: 0 additions & 98 deletions Order.Management/InvoiceReport.cs

This file was deleted.

13 changes: 5 additions & 8 deletions Order.Management/Order.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
using System;
using Order.Management.ToyBlocks;
using System.Collections.Generic;
using System.Text;

namespace Order.Management
{
abstract class Order
public class Order
{
public string CustomerName { get; set; }
public string Address { get; set; }
public string DueDate { get; set; }
public string DueDate { get; set; } // TODO: should probably be DateTime
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be DateTime

public int OrderNumber { get; set; }
public List<Shape> OrderedBlocks { get; set; }
public List<Shape> OrderedBlocks { get; set; } = new List<Shape>();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OrderedBlocks data structure should be its own class with properties for each Shape type i.e.

public class OrderedBlocks
{
    public List<Square> Squares { get; set; }
    public List<Triangle> Triangles { get; set; }
    public List<Circle> Circles { get; set; }
}


public abstract void GenerateReport();

public string ToString()
public override string ToString()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer not to override the .net class ToString() method. Rather just have a Print() method or something like that

{
return "\nName: " + CustomerName + " Address: " + Address + " Due Date: " + DueDate + " Order #: " + OrderNumber;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: String interpolation better

}
Expand Down
67 changes: 0 additions & 67 deletions Order.Management/PaintingReport.cs

This file was deleted.

Loading