Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions Order.Management/Circle.cs

This file was deleted.

26 changes: 26 additions & 0 deletions Order.Management/CommonConst.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Collections.Generic;

namespace Order.Management
{
class CommonConst
{
public const decimal SquarePrice = 1;
public const decimal TrianglePrice = 2;
public const decimal CirclePrice = 3;
public const decimal RedAdditionalCharge = 1;

public static List<Shape> ShapeList = new List<Shape>()
{
Shape.Square,
Shape.Triangle,
Shape.Circle,
};

public static List<Color> ColorList = new List<Color>()
{
Color.Red,
Color.Blue,
Color.Yellow
};
}
}
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.

22 changes: 0 additions & 22 deletions Order.Management/Order.cs

This file was deleted.

49 changes: 49 additions & 0 deletions Order.Management/Order/Order.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace Order.Management
{
public class Order
{
public string CustomerName { get; set; }
public string Address { get; set; }
public DateTime DueDate { get; set; }
public int OrderNumber { get; set; }
public List<ToyInfo> ToyInfos { get; set; }

public int GetCountByColor(Color color)
{
return ToyInfos.Where(item => item.Color.Equals(color)).ToList().Sum(item => item.Quantity);
}

public int GetCountByShape(Enum shape)
{
return ToyInfos.Where(item => item.Shape.Equals(shape)).ToList().Sum(item => item.Quantity);
}

public int GetCountByShapeAndColor(Enum shape, Color color)
{
return ToyInfos.Where(item => item.Shape.Equals(shape) && item.Color.Equals(color)).ToList().Sum(item => item.Quantity);
}

public decimal GetShapePrice(Enum shape)
{
switch (shape)
{
case Shape.Triangle:
return CommonConst.TrianglePrice;
case Shape.Circle:
return CommonConst.CirclePrice;
case Shape.Square:
default:
return CommonConst.SquarePrice;
}
}

public override string ToString()
{
return $"\nName: {CustomerName} Address: {Address} Due Date: {DueDate.ToShortDateString()} Order #: {OrderNumber}";
}
}
}
23 changes: 23 additions & 0 deletions Order.Management/Order/ToyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace Order.Management
{
public class ToyInfo
{
public Shape Shape { get; set; }
public Color Color { get; set; }
public int Quantity { get; set; }
}

public enum Shape
{
Square,
Triangle,
Circle
}

public enum Color
{
Red,
Blue,
Yellow
}
}
67 changes: 0 additions & 67 deletions Order.Management/PaintingReport.cs

This file was deleted.

Loading