Hybrid Lizenzmodell gefixt

This commit is contained in:
2026-05-04 00:01:06 +02:00
parent 00f8ce83fb
commit eeed2c24e2
2 changed files with 22 additions and 12 deletions

View File

@@ -183,7 +183,7 @@ namespace BeWo.Service.Security
info.MaxEmployeeCount = 1000;
return info;
//return info;
#endif
@@ -197,7 +197,7 @@ namespace BeWo.Service.Security
#if DEBUG
url = ConfigurationManager.AppSettings.Get("LicenseInfoUrl");
url = url.Replace("[TENANT]", "3522103738");
url = url.Replace("[TENANT]", "8002913382");
url += "&t=0";
#endif
//url = url.Replace("[TENANT]", "1441747891");
@@ -214,12 +214,13 @@ namespace BeWo.Service.Security
//}
String[] resultArray = result.Split(';');
int maxLicenses = 0;
int fullLicenses = 0;
int midLicenses = 0;
int isHybrid = 0;
decimal percentFreeEmployees = 0;
if (resultArray.Length > 0)
{
Int32.TryParse(resultArray[0], out maxLicenses);
Int32.TryParse(resultArray[0], out fullLicenses);
if (resultArray.Length > 1)
{
Decimal.TryParse(resultArray[1], out percentFreeEmployees);
@@ -228,19 +229,22 @@ namespace BeWo.Service.Security
{
Int32.TryParse(resultArray[2], out midLicenses);
}
}
if (midLicenses > 0)
if (resultArray.Length > 3)
{
percentFreeEmployees = 0;
maxLicenses += midLicenses;
Int32.TryParse(resultArray[3], out isHybrid);
}
info.MaxLicenseCount = maxLicenses;
info.PercentFreeEmployee = percentFreeEmployees;
}
info.IsHybrid = isHybrid == 1;
info.MaxLicenseCount = info.IsHybrid ? fullLicenses + midLicenses : fullLicenses; // Anzahl max User immer Anzahl voll + Hybrid Lizenzen
info.MaxMidLicenseCount = midLicenses;
info.PercentFreeEmployee = midLicenses > 0 ? 0 : percentFreeEmployees; // Nur für Normale DBs 30 % zusätzlich
info.LicenseInUseCount = DAOFactory.GenericDAO.GetAllActive<ApplicationUser>().Count;
info.EmployeeCount = DAOFactory.GenericDAO.GetAllActive<Employee>().Count;
info.MaxEmployeeCount = (int)Math.Ceiling(maxLicenses * ((100 + percentFreeEmployees) / 100));
info.MaxEmployeeCount = (int)Math.Ceiling((fullLicenses + midLicenses) * ((100 + info.PercentFreeEmployee) / 100)); // Immer voll + Mid/Hybrid
}
}
catch (Exception)

View File

@@ -18,6 +18,12 @@ namespace BS.Shared.DataContracts
[DataMember]
public int MaxLicenseCount { get; set; }
[DataMember]
public int MaxMidLicenseCount { get; set; }
[DataMember]
public bool IsHybrid { get; set; }
[DataMember]
public decimal PercentFreeEmployee { get; set; }