This commit is contained in:
@@ -86,18 +86,25 @@ namespace rockfishCore.Controllers
|
||||
/// <returns></returns>
|
||||
private bool CustomerHasLapsed(long customerId)
|
||||
{
|
||||
// if(customerId==117){
|
||||
// long l=customerId;
|
||||
// }
|
||||
long EpochNow = DateUtil.NowAsEpoch();
|
||||
|
||||
var count = ct.Purchase
|
||||
var v7PurchasedSubscriptionCount = ct.Purchase
|
||||
.Where(c => c.CustomerId.Equals(customerId))
|
||||
.Where(c => c.CancelDate == null || c.CancelDate > EpochNow)
|
||||
.Where(c => c.ExpireDate != null && c.ExpireDate > EpochNow)
|
||||
.Count();
|
||||
|
||||
//handle raven keys here
|
||||
// var ravActiveMaintenanceCount=ct.License.Where(z=>z.CustomerId==customerId && z.)
|
||||
|
||||
return count < 1;
|
||||
var ravActiveMaintenanceCount = ct.License.Where(z => z.CustomerId == customerId && z.DtMaintenanceExpiration > EpochNow).Count();
|
||||
if (ravActiveMaintenanceCount > 0 || v7PurchasedSubscriptionCount > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -133,12 +140,12 @@ namespace rockfishCore.Controllers
|
||||
};
|
||||
|
||||
//Force immediate query execution
|
||||
var resList = res.ToList();
|
||||
var siteList = res.ToList();
|
||||
|
||||
foreach (dtoNameIdChildrenItem child in resList)
|
||||
foreach (dtoNameIdChildrenItem site in siteList)
|
||||
{
|
||||
var subs = from c in ct.Purchase
|
||||
.Where(c => c.SiteId.Equals(child.id))
|
||||
.Where(c => c.SiteId.Equals(site.id))
|
||||
.Where(c => c.CancelDate == null || c.CancelDate > EpochNow)
|
||||
.OrderByDescending(c => c.PurchaseDate)
|
||||
select new dtoNameIdItem
|
||||
@@ -149,11 +156,22 @@ namespace rockfishCore.Controllers
|
||||
|
||||
foreach (dtoNameIdItem sub in subs)
|
||||
{
|
||||
child.children.Add(sub);
|
||||
site.children.Add(sub);
|
||||
}
|
||||
|
||||
|
||||
var ActiveRavLicense = ct.License.Where(z => z.SiteId == site.id && z.DtMaintenanceExpiration > EpochNow).FirstOrDefault();
|
||||
if (ActiveRavLicense != null)
|
||||
{
|
||||
site.children.Add(new dtoNameIdItem() { id = 0, name = $"Raven license exp: { DateUtil.EpochToString(ActiveRavLicense.DtMaintenanceExpiration, "d")}" });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return resList;
|
||||
|
||||
|
||||
|
||||
return siteList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -131,6 +131,8 @@ namespace rockfishCore.Controllers
|
||||
DBLicense.Code = "na";
|
||||
DBLicense.Key = Key;
|
||||
DBLicense.RegTo = l.RegisteredTo;
|
||||
DBLicense.DtLicenseExpiration=l.LicenseExpirationDate;
|
||||
DBLicense.DtMaintenanceExpiration=l.MaintenanceExpirationDate;
|
||||
await ct.License.AddAsync(DBLicense);
|
||||
await ct.SaveChangesAsync();
|
||||
|
||||
|
||||
@@ -123,7 +123,14 @@ app.customers = (function() {
|
||||
//cardDisplay += "<li>" + sites[SitesIndex].children[SitePurchasesIndex].name + "</li>";
|
||||
var PurchaseId=sites[SitesIndex].children[SitePurchasesIndex].id;
|
||||
var SiteId=sites[SitesIndex].id;
|
||||
var PurchaseUrl='<a href="#!/purchaseEdit/'+PurchaseId+'/'+SiteId+'">' + sites[SitesIndex].children[SitePurchasesIndex].name + '</a>';
|
||||
var PurchaseUrl;
|
||||
if(PurchaseId>0){
|
||||
PurchaseUrl='<a href="#!/purchaseEdit/'+PurchaseId+'/'+SiteId+'">' + sites[SitesIndex].children[SitePurchasesIndex].name + '</a>';
|
||||
}else{
|
||||
//raven key so go to site
|
||||
//customerSiteEdit/122/117
|
||||
PurchaseUrl='<a href="#!/customerSiteEdit/'+SiteId+'/'+customerId+'">' + sites[SitesIndex].children[SitePurchasesIndex].name + '</a>';
|
||||
}
|
||||
cardDisplay += '<li>'+ PurchaseUrl + '</li>';
|
||||
}
|
||||
cardDisplay += "</ul>";
|
||||
|
||||
Reference in New Issue
Block a user