Files
BeWoPlaner/Shared/Services/AccountingPeriod.cs

82 lines
2.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BS.Shared.DataContracts;
namespace BS.Shared.Services
{
public class AccountingPeriod
{
private List<ServiceRecordDC> serviceRecords = null;
public DateTime PeriodStart { get; set; }
public DateTime PeriodEnd { get; set; }
public List<CostRatePeriodDC> CostRatesInPeriod { get; set; }
public decimal Amount { get; set; }
public decimal RateFactor { get; set; }
public decimal? MaxApprovedAmount { get; set; }
public decimal? MaxApprovedUnitCount { get; set; }
public decimal? ApprovedPerUnit { get; set; }
public AccountingIntervalType? ApprovalUnit { get; set; }
public String UnitName { get; set; }
public AccountingIntervalType AccountingInterval { get; set; }
public ServiceCategoryDC ServiceCategory { get; set; }
public SupportConceptApprovalPeriodDC SupportConceptApprovalPeriod { get; set; }
public String Notice { get; set; }
public List<ServiceRecordDC> ServiceRecordsInPeriod
{
get { return serviceRecords ?? (serviceRecords = new List<ServiceRecordDC>()); }
set { serviceRecords = value; }
}
public decimal? ProzentAbrechenbar { get; set; }
public override bool Equals(object obj)
{
AccountingPeriod ap = obj as AccountingPeriod;
if (ap != null)
{
if (ap.PeriodStart == this.PeriodStart &&
ap.PeriodEnd == this.PeriodEnd &&
ap.Amount == this.Amount &&
ap.RateFactor == this.RateFactor &&
ap.AccountingInterval == this.AccountingInterval &&
ap.Notice == this.Notice)
{
if (ap.ServiceCategory == null && this.ServiceCategory == null)
return true;
if (ap.ServiceCategory != null && this.ServiceCategory != null)
return ap.ServiceCategory.ServiceCategoryOid == this.ServiceCategory.ServiceCategoryOid;
}
}
return false;
}
public override int GetHashCode()
{
int dtHash = PeriodStart.GetHashCode() ^ PeriodEnd.GetHashCode() ^ Amount.GetHashCode() ^
RateFactor.GetHashCode() ^ AccountingInterval.GetHashCode();
if (ServiceCategory != null)
dtHash = dtHash ^ ServiceCategory.GetHashCode();
return this.GetType().Name.GetHashCode() ^ dtHash;
}
}
}