This commit is contained in:
@@ -562,6 +562,105 @@ namespace Sockeye.Biz
|
||||
{
|
||||
bool isNew = currentObj == null;
|
||||
|
||||
//fetched keys are never editable, must be duped if re-issue
|
||||
if (currentObj.FetchedOn != null)
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", "Fetched, not changeable, duplicate instead");
|
||||
return;
|
||||
}
|
||||
|
||||
//MISC product group is not valid for keys
|
||||
if (currentObj.PGroup == ProductGroup.Misc)
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "pGroup");
|
||||
return;
|
||||
}
|
||||
|
||||
//If Active and fetchable (and were here as it's not yet fetched)
|
||||
//then more rules apply than if just saving while working on it...
|
||||
if (proposedObj.Active)
|
||||
{
|
||||
//It's being offered for fetch so make sure it's ready here
|
||||
if (string.IsNullOrWhiteSpace(proposedObj.RegTo))
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "RegTo");
|
||||
return;
|
||||
}
|
||||
|
||||
if (proposedObj.Users < 1)//both require Users to be set
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Users");
|
||||
return;
|
||||
}
|
||||
|
||||
//all non trial keys require a customer id matched
|
||||
if (proposedObj.CustomerId == null && !proposedObj.TrialMode)
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "CustomerId");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Active state rules for each product group
|
||||
switch (proposedObj.PGroup)
|
||||
{
|
||||
|
||||
case ProductGroup.RavenPerpetual:
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(proposedObj.DbId))
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "DbID");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case ProductGroup.RavenSubscription:
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(proposedObj.DbId))
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "DbID");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//sub keys *always* expire
|
||||
if (proposedObj.LicenseExpire == null)
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "LicenseExpire");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (proposedObj.CustomerUsers < 250)
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "CustomerUsers");
|
||||
return;
|
||||
}
|
||||
if (proposedObj.MaxDataGB == null || proposedObj.MaxDataGB < 20)
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "MaxDataGB");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case ProductGroup.AyaNova7:
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(proposedObj.FetchEmail))
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "FetchEmail");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Any form customizations to validate?
|
||||
@@ -581,9 +680,9 @@ namespace Sockeye.Biz
|
||||
private void ValidateCanDeleteAsync(License inObj)
|
||||
{
|
||||
|
||||
if(inObj.FetchedOn!=null)
|
||||
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", "Fetched, not deletable");
|
||||
|
||||
if (inObj.FetchedOn != null)
|
||||
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", "Fetched, not deletable");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Sockeye.Models
|
||||
[NotMapped]
|
||||
public int? MaxDataGB { get; set; }//v8 - subscription only
|
||||
[NotMapped]
|
||||
public bool TrialMode { get; set; } = false;//v8
|
||||
public bool TrialMode { get; set; } = false;//v8 indicates it was requested by user as trial request or manually created as a trial request in UI
|
||||
//shared dto props
|
||||
[NotMapped]
|
||||
public int Users { get; set; }//v7 scheduled users, v8 internal users
|
||||
|
||||
Reference in New Issue
Block a user