This commit is contained in:
@@ -342,7 +342,7 @@ namespace AyaNova.Biz
|
||||
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("Unit"));
|
||||
if (await ct.CustomerServiceRequest.AnyAsync(m => m.CustomerId == inObj.Id))
|
||||
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("CustomerServiceRequest"));
|
||||
if (await ct.PurchaseOrder.AnyAsync(m => m.DropShipToCustomerId == inObj.Id))
|
||||
if (await ct.PurchaseOrder.AnyAsync(m => m.DropShipToCustomerId == inObj.Id))
|
||||
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("PurchaseOrder"));
|
||||
|
||||
// await Task.CompletedTask;
|
||||
@@ -365,6 +365,7 @@ namespace AyaNova.Biz
|
||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||
foreach (Customer w in orderedList)
|
||||
{
|
||||
await PopulateVizFields(w);
|
||||
var jo = JObject.FromObject(w);
|
||||
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||
@@ -374,6 +375,15 @@ namespace AyaNova.Biz
|
||||
return ReportData;
|
||||
}
|
||||
|
||||
//populate viz fields from provided object
|
||||
private async Task PopulateVizFields(Customer o)
|
||||
{
|
||||
if (o.HeadOfficeId != null)
|
||||
o.HeadOfficeViz = await ct.HeadOffice.AsNoTracking().Select(x => x.Name).FirstOrDefaultAsync();
|
||||
if (o.ContractId != null)
|
||||
o.ContractViz = await ct.Contract.AsNoTracking().Select(x => x.Name).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// IMPORT EXPORT
|
||||
|
||||
@@ -30,10 +30,14 @@ namespace AyaNova.Models
|
||||
public string PopUpNotes { get; set; }
|
||||
public bool BillHeadOffice { get; set; }
|
||||
public long? HeadOfficeId { get; set; }
|
||||
[NotMapped]
|
||||
public string HeadOfficeViz { get; set; }
|
||||
public string TechNotes { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
public bool UsesBanking { get; set; }
|
||||
public long? ContractId { get; set; }
|
||||
[NotMapped]
|
||||
public string ContractViz { get; set; }
|
||||
public DateTime? ContractExpires { get; set; }
|
||||
public long? DefaultServiceTemplateId { get; set; }
|
||||
public string Phone1 { get; set; }
|
||||
|
||||
@@ -24,12 +24,18 @@ namespace AyaNova.Models
|
||||
|
||||
public string VendorMemo { get; set; }
|
||||
public long? DropShipToCustomerId { get; set; }
|
||||
[NotMapped]
|
||||
public string DropShipToCustomerViz { get; set; }
|
||||
public string ReferenceNumber { get; set; }
|
||||
public long VendorId { get; set; }
|
||||
[NotMapped]
|
||||
public string VendorViz { get; set; }
|
||||
public DateTime? OrderedDate { get; set; }
|
||||
public DateTime? ExpectedReceiveDate { get; set; }
|
||||
public PurchaseOrderStatus Status { get; set; }
|
||||
public long? ProjectId { get; set; }
|
||||
[NotMapped]
|
||||
public string ProjectViz { get; set; }
|
||||
public string Text1 { get; set; }
|
||||
public string Text2 { get; set; }
|
||||
public List<PurchaseOrderItem> Items { get; set; } = new List<PurchaseOrderItem>();
|
||||
|
||||
Reference in New Issue
Block a user