|
|
@@ -152,18 +152,18 @@ namespace InABox.Core
|
|
|
|
|
|
#region Fees & Discounts
|
|
|
|
|
|
- private static readonly Dictionary<String, double> _licensefees = new Dictionary<String, double>();
|
|
|
+ private static readonly Dictionary<String, decimal> _licensefees = new Dictionary<String, decimal>();
|
|
|
|
|
|
- private static readonly Dictionary<int, double> _periods = new Dictionary<int, double>();
|
|
|
+ private static readonly Dictionary<int, decimal> _periods = new Dictionary<int, decimal>();
|
|
|
|
|
|
- private static readonly Dictionary<int, double> _userDiscounts = new Dictionary<int, double>();
|
|
|
+ private static readonly Dictionary<int, decimal> _userDiscounts = new Dictionary<int, decimal>();
|
|
|
|
|
|
- public static double GetLicenseFee(String type)
|
|
|
+ public static decimal GetLicenseFee(String type)
|
|
|
{
|
|
|
return _licensefees.GetValueOrDefault(type, 0);
|
|
|
}
|
|
|
|
|
|
- public static double GetLicenseFee<T>() where T : LicenseToken
|
|
|
+ public static decimal GetLicenseFee<T>() where T : LicenseToken
|
|
|
{
|
|
|
return GetLicenseFee(typeof(T).EntityName());
|
|
|
}
|
|
|
@@ -173,7 +173,7 @@ namespace InABox.Core
|
|
|
return _licensefees.Keys;
|
|
|
}
|
|
|
|
|
|
- public static double GetUserDiscount(int users)
|
|
|
+ public static decimal GetUserDiscount(int users)
|
|
|
{
|
|
|
var key = _userDiscounts.Keys
|
|
|
.Where(x => x <= users)
|
|
|
@@ -184,7 +184,7 @@ namespace InABox.Core
|
|
|
return _userDiscounts[key];
|
|
|
}
|
|
|
|
|
|
- public static double GetTimeDiscount(int months)
|
|
|
+ public static decimal GetTimeDiscount(int months)
|
|
|
{
|
|
|
var period = _periods.Keys
|
|
|
.Where(x => x <= months)
|
|
|
@@ -200,9 +200,9 @@ namespace InABox.Core
|
|
|
return _periods.Keys;
|
|
|
}
|
|
|
|
|
|
- public static double CalculateLicenseFee(Dictionary<String, int> licenses, int time)
|
|
|
+ public static decimal CalculateLicenseFee(Dictionary<String, int> licenses, int time)
|
|
|
{
|
|
|
- double licensefee = 0.00F;
|
|
|
+ var licensefee = 0m;
|
|
|
foreach (var license in licenses.Keys)
|
|
|
if (_licensefees.ContainsKey(license))
|
|
|
licensefee += _licensefees[license] * licenses[license];
|
|
|
@@ -212,7 +212,7 @@ namespace InABox.Core
|
|
|
|
|
|
var timediscount = GetTimeDiscount(time);
|
|
|
|
|
|
- var result = licensefee * ((100.0F - userdiscount) / 100.0F) * ((100.0F - timediscount) / 100.0F);
|
|
|
+ var result = licensefee * ((100 - userdiscount) / 100) * ((100 - timediscount) / 100);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
@@ -279,13 +279,13 @@ namespace InABox.Core
|
|
|
{
|
|
|
public LicenseFeeResponse()
|
|
|
{
|
|
|
- LicenseFees = new Dictionary<string, double>();
|
|
|
- TimeDiscounts = new Dictionary<int, double>();
|
|
|
- UserDiscounts = new Dictionary<int, double>();
|
|
|
+ LicenseFees = new Dictionary<string, decimal>();
|
|
|
+ TimeDiscounts = new Dictionary<int, decimal>();
|
|
|
+ UserDiscounts = new Dictionary<int, decimal>();
|
|
|
}
|
|
|
|
|
|
- public Dictionary<string, double> LicenseFees { get; set; }
|
|
|
- public Dictionary<int, double> TimeDiscounts { get; set; }
|
|
|
- public Dictionary<int, double> UserDiscounts { get; set; }
|
|
|
+ public Dictionary<string, decimal> LicenseFees { get; set; }
|
|
|
+ public Dictionary<int, decimal> TimeDiscounts { get; set; }
|
|
|
+ public Dictionary<int, decimal> UserDiscounts { get; set; }
|
|
|
}
|
|
|
}
|