Files
BeWoPlaner/Shared/DataContracts/CostRatePeriodDC.cs
2024-12-30 16:12:47 +01:00

107 lines
2.9 KiB
C#

using System;
using System.Diagnostics;
using System.Runtime.Serialization;
namespace BS.Shared.DataContracts
{
[DataContract]
[DebuggerDisplay("{CostRateType} {CostRateValue}")]
public partial class CostRatePeriodDC : IDataContract
{
[DataMember]
public long? CostRatePeriodOid { get; set; }
[DataMember]
public long? CostRatePeriodVersion { get; set; }
[DataMember]
public CostRatePeriodType CostRateType { get; set; }
[DataMember]
public decimal? CostRateValue { get; set; }
[DataMember]
public DateTime? EndDate { get; set; }
[DataMember]
public string Notice { get; set; }
[DataMember]
public DateTime? StartDate { get; set; }
[DataMember]
public string UnitName { get; set; }
[DataMember]
public ValueListEntryDC ValueListEntry { get; set; }
public virtual decimal? GetBEInHours(decimal? be)
{
decimal? crv = this.CostRateValue;
if (!crv.HasValue)
crv = 60;
return (be * crv.Value) / 60m;
}
public virtual decimal GetBEInHours(decimal be)
{
decimal? crv = this.CostRateValue;
if (!crv.HasValue)
crv = 60;
return (be * crv.Value) / 60m;
}
public virtual decimal? GetBEInMinutes(decimal? be)
{
decimal? crv = this.CostRateValue;
if (!crv.HasValue)
crv = 60;
return be * crv.Value;
}
public virtual decimal GetBEInMinutes(decimal be)
{
decimal? crv = this.CostRateValue;
if (!crv.HasValue)
crv = 60;
return be * crv.Value;
}
public virtual decimal? GetHoursInBE(decimal? hours)
{
decimal? crv = this.CostRateValue;
if (!crv.HasValue || crv.Value == 0)
crv = 60;
return (hours * 60m) / crv.Value;
}
public virtual decimal GetHoursInBE(decimal hours)
{
decimal? crv = this.CostRateValue;
if (!crv.HasValue || crv.Value == 0)
crv = 60;
return (hours * 60m) / crv.Value;
}
public virtual decimal? GetMinutesInBE(decimal? minutes)
{
decimal? crv = this.CostRateValue;
if (!crv.HasValue || crv.Value == 0)
crv = 60;
return minutes / crv.Value;
}
public virtual decimal GetMinutesInBE(decimal minutes)
{
decimal? crv = this.CostRateValue;
if (!crv.HasValue || crv.Value == 0)
crv = 60;
return minutes / crv.Value;
}
}
}