我必须计算持卡人的总计费金额,用于基于卡的停车场访问。我的费率结构是这样的。停车场的每个区域都会有这些价格的优先列表。
public partial class HourlyPrice
{
public int Id { get; set; }
public int DayId { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public int MinHour { get; set; }
public int MaxHour { get; set; }
public decimal Price { get; set; }
}
DayId
允许例如“从 13:00 开始的周日免费”。MinNour
并且“MaxHour”允许 0 到 2 小时是免费的,其中 5 到 6 小时需要 R11.00。StartTime
并EndTime
允许“18h00 后费用 R7.00,统一费率”。
我担心的是没有指定多日价格。当一辆汽车在某一天进入一个价格结构,并在另一天退出另一个价格结构。在我看来,这就像我必须按顺序访问车辆停放的每个小时并累积到期金额。这似乎是一种非常昂贵的做事方式。
任何关于这种努力的建议将不胜感激。