This commit is contained in:
31
AyaNovaQBI/AyaNovaLicense.cs
Normal file
31
AyaNovaQBI/AyaNovaLicense.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace AyaNovaQBI
|
||||||
|
{
|
||||||
|
internal class AyaNovaLicense
|
||||||
|
{
|
||||||
|
public string serverDbId { get; set; }
|
||||||
|
public string licensedTo { get; set; }
|
||||||
|
public string dbId { get; set; }
|
||||||
|
public string keySerial { get; set; }
|
||||||
|
public DateTime licenseExpiration { get; set; }
|
||||||
|
public bool licenseWillExpire { get; set; }
|
||||||
|
public bool maintenanceExpired { get; set; }
|
||||||
|
public DateTime maintenanceExpiration { get; set; }
|
||||||
|
|
||||||
|
public List<AyaNovaLicenseFeatures> features { get; set; }
|
||||||
|
}
|
||||||
|
internal class AyaNovaLicenseFeatures
|
||||||
|
{
|
||||||
|
//name of feature / product
|
||||||
|
public string Feature { get; set; }
|
||||||
|
|
||||||
|
//Optional count for items that require it
|
||||||
|
public long Count { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -76,6 +76,7 @@
|
|||||||
<DependentUpon>auth.cs</DependentUpon>
|
<DependentUpon>auth.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="AuthorizationRoles.cs" />
|
<Compile Include="AuthorizationRoles.cs" />
|
||||||
|
<Compile Include="AyaNovaLicense.cs" />
|
||||||
<Compile Include="MainForm.cs">
|
<Compile Include="MainForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ namespace AyaNovaQBI
|
|||||||
internal static string AyaNovaUserName { get; set; }
|
internal static string AyaNovaUserName { get; set; }
|
||||||
internal static AuthorizationRoles AyaNovaUserRoles { get; set; }
|
internal static AuthorizationRoles AyaNovaUserRoles { get; set; }
|
||||||
internal static UserType AyaNovaUserType { get; set; }
|
internal static UserType AyaNovaUserType { get; set; }
|
||||||
|
|
||||||
|
internal static AyaNovaLicense ALicense { get; set; } = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -459,14 +461,21 @@ namespace AyaNovaQBI
|
|||||||
if (d.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
|
if (d.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//Check if licensed
|
//Get license
|
||||||
var r = await GetAsync("license/has-feature/XQBI");
|
var r = await GetAsync("license");
|
||||||
if (!r.ObjectResponse["data"].Value<bool>())
|
ALicense = r.ObjectResponse["data"]["license"].ToObject < AyaNovaLicense>();
|
||||||
|
if (ALicense.features.FirstOrDefault(z => z.Feature == "QBI") == null)
|
||||||
{
|
{
|
||||||
initErrors.AppendLine("This AyaNova server is not licensed to use QBI");
|
initErrors.AppendLine("QBI not licensed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if (!r.ObjectResponse["data"].Value<bool>())
|
||||||
|
//{
|
||||||
|
// initErrors.AppendLine("QBI not licensed");
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
|
||||||
//check if build date is within licensed date (how did I do that automated build date thing?)
|
//check if build date is within licensed date (how did I do that automated build date thing?)
|
||||||
// copy timestamp.cs and the createtimestamp.exe utility from v7 qbi and create build event to run it here and do same thing
|
// copy timestamp.cs and the createtimestamp.exe utility from v7 qbi and create build event to run it here and do same thing
|
||||||
//check that AyaNova version matches required minimum for this QBI (
|
//check that AyaNova version matches required minimum for this QBI (
|
||||||
@@ -479,6 +488,7 @@ namespace AyaNovaQBI
|
|||||||
//PFC - PopulateQBListCache()
|
//PFC - PopulateQBListCache()
|
||||||
//PFC - PopulateAyaListCache()
|
//PFC - PopulateAyaListCache()
|
||||||
//PFC - integration object check (fetch or create if not present) (Util.integrationObjectCheck())
|
//PFC - integration object check (fetch or create if not present) (Util.integrationObjectCheck())
|
||||||
|
//NOTE: probably can make a class for this and use newtonsoft to convert dynamic returned from api call to class object?
|
||||||
//PFC - Validate settings, create if necessary (Util.ValidateSettings()) and save
|
//PFC - Validate settings, create if necessary (Util.ValidateSettings()) and save
|
||||||
//PFC - verify integration mapped objects still exist at each end (Util.PreFlightCheck() line 199)
|
//PFC - verify integration mapped objects still exist at each end (Util.PreFlightCheck() line 199)
|
||||||
//DONE
|
//DONE
|
||||||
@@ -487,6 +497,8 @@ namespace AyaNovaQBI
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user