Apply code review suggestions

- Use `Nullable.HasValue` and `Nullable.Value` to handle `DateTime?` type returned by `LicenseCssExpiry`
- Check UTC time when checking CSS license expiry

Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
This commit is contained in:
Danilo Del Busso 2023-07-17 09:33:34 +01:00
parent b8a3a7cdeb
commit cd920531c8
No known key found for this signature in database
2 changed files with 4 additions and 5 deletions

View File

@ -361,9 +361,8 @@ namespace XenAdmin.Dialogs
{
entitlements.Add(Messages.LICENSE_NOT_ELIGIBLE_FOR_SUPPORT);
}
}
if (CurrentState == HostState.Free)
}
else if (CurrentState == HostState.Free)
{
entitlements.Add(Messages.LICENSE_NOT_ELIGIBLE_FOR_SUPPORT);
}

View File

@ -353,10 +353,10 @@ namespace XenAPI
{
var cssExpiry = LicenseCssExpiry();
if (cssExpiry != null)
if (cssExpiry.HasValue)
{
// User can circumvent this by changing system date
return DateTime.Now > cssExpiry;
return DateTime.UtcNow > cssExpiry.Value;
}
return false;