122 lines
3.6 KiB
C#
122 lines
3.6 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace AppLogic
|
|||
|
{
|
|||
|
public class VTNZ_StoreFront : IStoreFront
|
|||
|
{
|
|||
|
string _storefrontName;
|
|||
|
string _storefrontAddress;
|
|||
|
string _storefrontPhoneNumber;
|
|||
|
string[] _storefrontOpenDays;
|
|||
|
TimeSpan[] _storefrontTimeOpen;
|
|||
|
|
|||
|
List<IProduct> _storeProducts;
|
|||
|
|
|||
|
public string GetName => _storefrontName;
|
|||
|
|
|||
|
public string GetAddress => _storefrontAddress;
|
|||
|
|
|||
|
public string[] GetOpenDays => _storefrontOpenDays;
|
|||
|
|
|||
|
public TimeSpan[] GetOpenTime => _storefrontTimeOpen;
|
|||
|
|
|||
|
public string GetPhoneNumber => _storefrontPhoneNumber;
|
|||
|
|
|||
|
public List<IProduct> GetProducts => _storeProducts;
|
|||
|
|
|||
|
public VTNZ_StoreFront(string name, string location, string phone, string[] workingDays, TimeSpan[] dayLengths)
|
|||
|
{
|
|||
|
_storefrontName = name;
|
|||
|
_storefrontAddress = location;
|
|||
|
_storefrontPhoneNumber = phone;
|
|||
|
_storefrontOpenDays = workingDays;
|
|||
|
_storefrontTimeOpen = dayLengths;
|
|||
|
_storeProducts = new List<IProduct>
|
|||
|
{
|
|||
|
new WofInspectionWrap(new VTNZ_Immutable.General("Wof", 25)),
|
|||
|
new ModifiedInspectionWrap(new VTNZ_Immutable.ModifiedInspection()),
|
|||
|
new PrePurchaseInspectionWrap(new VTNZ_Immutable.PrePurchaseInspection()),
|
|||
|
new CoFInspectionWrap(new VTNZ_Immutable.CoFInspection())
|
|||
|
};
|
|||
|
}
|
|||
|
public override string ToString()
|
|||
|
{
|
|||
|
return _storefrontName;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public class WofInspectionWrap : IProduct
|
|||
|
{
|
|||
|
VTNZ_Immutable.General _inspection;
|
|||
|
public string Name => _inspection.Name;
|
|||
|
|
|||
|
public decimal Value => _inspection.Value;
|
|||
|
|
|||
|
public WofInspectionWrap(VTNZ_Immutable.General inspection)
|
|||
|
{
|
|||
|
this._inspection = inspection;
|
|||
|
}
|
|||
|
|
|||
|
public override string ToString()
|
|||
|
{
|
|||
|
return Name + (Name.Length < 27 ? new string(' ', 27 - Name.Length) : "") + Value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public class ModifiedInspectionWrap : IProduct
|
|||
|
{
|
|||
|
VTNZ_Immutable.ModifiedInspection _inspection;
|
|||
|
public string Name => _inspection.InspectionType;
|
|||
|
|
|||
|
public decimal Value => _inspection.Value;
|
|||
|
|
|||
|
public ModifiedInspectionWrap(VTNZ_Immutable.ModifiedInspection inspection)
|
|||
|
{
|
|||
|
this._inspection = inspection;
|
|||
|
}
|
|||
|
public override string ToString()
|
|||
|
{
|
|||
|
return Name + (Name.Length < 27 ? new string(' ', 27 - Name.Length) : "")+ Value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public class PrePurchaseInspectionWrap : IProduct
|
|||
|
{
|
|||
|
VTNZ_Immutable.PrePurchaseInspection _inspection;
|
|||
|
public string Name => _inspection.Name;
|
|||
|
|
|||
|
public decimal Value => _inspection.Value;
|
|||
|
|
|||
|
public PrePurchaseInspectionWrap(VTNZ_Immutable.PrePurchaseInspection inspection)
|
|||
|
{
|
|||
|
this._inspection = inspection;
|
|||
|
}
|
|||
|
public override string ToString()
|
|||
|
{
|
|||
|
return Name + (Name.Length < 27 ? new string(' ', 27 - Name.Length) : "")+ Value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public class CoFInspectionWrap : IProduct
|
|||
|
{
|
|||
|
VTNZ_Immutable.CoFInspection _inspection;
|
|||
|
public string Name => _inspection.Name;
|
|||
|
|
|||
|
public decimal Value => _inspection.Value;
|
|||
|
|
|||
|
public CoFInspectionWrap(VTNZ_Immutable.CoFInspection inspection)
|
|||
|
{
|
|||
|
this._inspection = inspection;
|
|||
|
}
|
|||
|
public override string ToString()
|
|||
|
{
|
|||
|
return Name + (Name.Length < 27 ? new string(' ', 27 - Name.Length) : "") + Value;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|