ln.provider.data.phone/BilledCDR.cs

43 lines
1.1 KiB
C#

// /**
// * File: BilledCDR.cs
// * Author: haraldwolff
// *
// * This file and it's content is copyrighted by the Author and / or copyright holder.
// * Any use wihtout proper permission is illegal and may lead to legal actions.
// *
// *
// **/
using System;
namespace ln.provider.data.phone
{
public class BilledCDR
{
public CDR CDR { get; }
public Rate Rate { get; }
public int BilledDuration
{
get
{
if (CDR.DurationToBill.TotalSeconds < Rate.FirstBillingInterval)
return Rate.FirstBillingInterval;
int totalSeconds = (int)CDR.DurationToBill.TotalSeconds;
int mod = totalSeconds % Rate.RegularBillingInterval;
if (mod > 0)
totalSeconds = totalSeconds - mod + Rate.RegularBillingInterval;
return totalSeconds;
}
}
public int PricePerThousand => ((Rate.ThousandsPerMinute * BilledDuration) / 60);
public BilledCDR(CDR cdr,Rate rate)
{
CDR = cdr;
Rate = rate;
}
}
}