This commit is contained in:
2023-04-21 19:34:11 +00:00
parent a296bc9b4f
commit 8f2ab38ba2
3 changed files with 24 additions and 4 deletions

View File

@@ -312,9 +312,15 @@ namespace Sockeye.Biz
{ {
if (!vc.Has("productname", item.ProductId)) if (!vc.Has("productname", item.ProductId))
{ {
vc.Add(await ct.Product.AsNoTracking().Where(x => x.Id == item.ProductId).Select(x => x.Name).FirstOrDefaultAsync(), "productname", item.ProductId); var productInfo = await ct.Product.AsNoTracking().Where(x => x.Id == item.ProductId).FirstOrDefaultAsync();
vc.Add(productInfo.Name, "productname", item.ProductId);
vc.Add(productInfo.InitialPrice.ToString(), "productinitialprice", item.ProductId);
vc.Add(productInfo.RenewPrice.ToString(), "productrenewprice", item.ProductId);
} }
item.ProductViz = vc.Get("productname", item.ProductId); item.ProductViz = vc.Get("productname", item.ProductId);
item.RenewPriceViz = vc.GetAsDecimal("productrenewprice", item.ProductId) ?? 0;
item.InitialPriceViz = vc.GetAsDecimal("productinitialprice", item.ProductId) ?? 0;
} }
} }

View File

@@ -15,8 +15,13 @@ namespace Sockeye.Models
[Required] [Required]
public string Name { get; set; } public string Name { get; set; }
public bool Active { get; set; } public bool Active { get; set; }
public decimal InitialPrice { get; set; } = 0;
public decimal RenewPrice { get; set; } = 0;
[Required] [Required]
public ProductGroup PGroup {get;set;} public ProductGroup PGroup { get; set; }
public long VendorId { get; set; } public long VendorId { get; set; }
public TimeSpan LicenseInterval { get; set; } public TimeSpan LicenseInterval { get; set; }
public TimeSpan MaintInterval { get; set; } public TimeSpan MaintInterval { get; set; }

View File

@@ -19,8 +19,7 @@ namespace Sockeye.Models
public bool Active { get; set; } public bool Active { get; set; }
[Required] [Required]
public long ProductId { get; set; } public long ProductId { get; set; }
[NotMapped]
public string ProductViz { get; set; }
[Required] [Required]
public DateTime ExpireDate { get; set; } public DateTime ExpireDate { get; set; }
[Required] [Required]
@@ -30,6 +29,16 @@ namespace Sockeye.Models
[Required] [Required]
public DateTime OriginalOrderDate { get; set; } public DateTime OriginalOrderDate { get; set; }
public bool Renewal { get; set; }
[NotMapped]
public decimal RenewPriceViz { get; set; } = 0;
[NotMapped]
public decimal InitialPriceViz { get; set; } = 0;
[NotMapped]
public string ProductViz { get; set; }
public List<string> Tags { get; set; } = new List<string>(); public List<string> Tags { get; set; } = new List<string>();