frogsoftware 1 год назад
Родитель
Сommit
2129bf7aa1
1 измененных файлов с 12 добавлено и 7 удалено
  1. 12 7
      InABox.Core/Licensing/LicenseUtils.cs

+ 12 - 7
InABox.Core/Licensing/LicenseUtils.cs

@@ -96,23 +96,23 @@ namespace InABox.Core
 
         #region Fees & Discounts
 
-        private static readonly Dictionary<Type, double> _licensefees = new Dictionary<Type, double>();
+        private static readonly Dictionary<String, double> _licensefees = new Dictionary<String, double>();
 
         private static readonly Dictionary<int, double> _periods = new Dictionary<int, double>();
 
         private static readonly Dictionary<int, double> _userDiscounts = new Dictionary<int, double>();
 
-        public static double GetLicenseFee(Type type)
+        public static double GetLicenseFee(String type)
         {
             return _licensefees.GetValueOrDefault(type, 0);
         }
 
         public static double GetLicenseFee<T>() where T : LicenseToken
         {
-            return GetLicenseFee(typeof(T));
+            return GetLicenseFee(typeof(T).EntityName());
         }
 
-        public static IEnumerable<Type> LicenseTypes()
+        public static IEnumerable<String> LicenseTypes()
         {
             return _licensefees.Keys;
         }
@@ -144,7 +144,7 @@ namespace InABox.Core
             return _periods.Keys;
         }
 
-        public static double CalculateLicenseFee(Dictionary<Type, int> licenses, int time)
+        public static double CalculateLicenseFee(Dictionary<String, int> licenses, int time)
         {
             double licensefee = 0.00F;
             foreach (var license in licenses.Keys)
@@ -168,7 +168,7 @@ namespace InABox.Core
             _userDiscounts.Clear();
 
             foreach (var license in summary.LicenseFees)
-                _licensefees[CoreUtils.GetEntity(license.Key)] = license.Value;
+                _licensefees[license.Key] = license.Value;
             foreach (var (months, period) in summary.TimeDiscounts)
                 _periods[months] = period;
             foreach (var (users, discount) in summary.UserDiscounts)
@@ -230,6 +230,11 @@ namespace InABox.Core
         #endregion
     }
 
+    public class LicenseSummaryRequest
+    {
+        public Guid RegistrationID { get; set; }
+    }
+    
     public class LicenseSummary
     {
         public LicenseSummary()
@@ -238,7 +243,7 @@ namespace InABox.Core
             TimeDiscounts = new Dictionary<int, double>();
             UserDiscounts = new Dictionary<int, double>();
         }
-
+        
         public Dictionary<string, double> LicenseFees { get; set; }
         public Dictionary<int, double> TimeDiscounts { get; set; }
         public Dictionary<int, double> UserDiscounts { get; set; }