This commit is contained in:
@@ -288,6 +288,7 @@ namespace AyaNova.Biz
|
|||||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||||
foreach (LoanUnit w in orderedList)
|
foreach (LoanUnit w in orderedList)
|
||||||
{
|
{
|
||||||
|
await PopulateVizFields(w);
|
||||||
var jo = JObject.FromObject(w);
|
var jo = JObject.FromObject(w);
|
||||||
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
||||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||||
@@ -297,12 +298,17 @@ namespace AyaNova.Biz
|
|||||||
return ReportData;
|
return ReportData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//populate viz fields from provided object
|
||||||
|
private async Task PopulateVizFields(LoanUnit o)
|
||||||
|
{
|
||||||
|
if (o.UnitId != null)
|
||||||
|
o.UnitViz = await ct.Unit.AsNoTracking().Where(x => x.Id == o.UnitId).Select(x => x.Serial).FirstOrDefaultAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// IMPORT EXPORT
|
// IMPORT EXPORT
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
public async Task<JArray> GetExportData(long[] idList)
|
public async Task<JArray> GetExportData(long[] idList)
|
||||||
{
|
{
|
||||||
//for now just re-use the report data code
|
//for now just re-use the report data code
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace AyaNova.Biz
|
|||||||
if (httpContext != null)
|
if (httpContext != null)
|
||||||
return new PartBiz(ct, UserIdFromContext.Id(httpContext.Items), UserTranslationIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
|
return new PartBiz(ct, UserIdFromContext.Id(httpContext.Items), UserTranslationIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
|
||||||
else
|
else
|
||||||
return new PartBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, AuthorizationRoles.BizAdminFull);
|
return new PartBiz(ct, 1, translationId, AuthorizationRoles.BizAdminFull);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -511,6 +511,7 @@ namespace AyaNova.Biz
|
|||||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||||
foreach (Part w in orderedList)
|
foreach (Part w in orderedList)
|
||||||
{
|
{
|
||||||
|
await PopulateVizFields(w);
|
||||||
var jo = JObject.FromObject(w);
|
var jo = JObject.FromObject(w);
|
||||||
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
||||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||||
@@ -520,12 +521,20 @@ namespace AyaNova.Biz
|
|||||||
return ReportData;
|
return ReportData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//populate viz fields from provided object
|
||||||
|
private async Task PopulateVizFields(Part o)
|
||||||
|
{
|
||||||
|
if (o.WholeSalerId != null)
|
||||||
|
o.WholeSalerViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.WholeSalerId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||||
|
if (o.ManufacturerId != null)
|
||||||
|
o.ManufacturerViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.ManufacturerId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||||
|
if (o.AlternativeWholeSalerId != null)
|
||||||
|
o.AlternativeWholeSalerViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.AlternativeWholeSalerId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// IMPORT EXPORT
|
// IMPORT EXPORT
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
public async Task<JArray> GetExportData(long[] idList)
|
public async Task<JArray> GetExportData(long[] idList)
|
||||||
{
|
{
|
||||||
//for now just re-use the report data code
|
//for now just re-use the report data code
|
||||||
@@ -533,7 +542,6 @@ namespace AyaNova.Biz
|
|||||||
return await GetReportData(idList);
|
return await GetReportData(idList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<List<string>> ImportData(JArray ja)
|
public async Task<List<string>> ImportData(JArray ja)
|
||||||
{
|
{
|
||||||
List<string> ImportResult = new List<string>();
|
List<string> ImportResult = new List<string>();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace AyaNova.Models
|
|||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public bool Active { get; set; }
|
public bool Active { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public string Wiki { get; set; }
|
public string Wiki { get; set; }
|
||||||
@@ -25,8 +25,11 @@ namespace AyaNova.Models
|
|||||||
public List<string> Tags { get; set; }
|
public List<string> Tags { get; set; }
|
||||||
|
|
||||||
public string Serial { get; set; }
|
public string Serial { get; set; }
|
||||||
|
|
||||||
//MIGRATE_OUTSTANDING this needs to be set in migrate v8 once workorderitemloan is coded and importable
|
//MIGRATE_OUTSTANDING this needs to be set in migrate v8 once workorderitemloan is coded and importable
|
||||||
public long? WorkOrderItemLoanId { get; set; }
|
public long? WorkOrderItemLoanId { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string WorkOrderItemLoanViz { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public decimal RateHour { get; set; }
|
public decimal RateHour { get; set; }
|
||||||
@@ -43,7 +46,11 @@ namespace AyaNova.Models
|
|||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public LoanUnitRateUnit DefaultRate { get; set; }
|
public LoanUnitRateUnit DefaultRate { get; set; }
|
||||||
|
|
||||||
public long? UnitId { get; set; }//Shadow unit
|
public long? UnitId { get; set; }//Shadow unit
|
||||||
|
[NotMapped]
|
||||||
|
public string UnitViz { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public LoanUnit()
|
public LoanUnit()
|
||||||
|
|||||||
@@ -26,10 +26,16 @@ namespace AyaNova.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public string PartNumber { get; set; }
|
public string PartNumber { get; set; }
|
||||||
public long? ManufacturerId { get; set; }
|
public long? ManufacturerId { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string ManufacturerViz { get; set; }
|
||||||
public string ManufacturerNumber { get; set; }
|
public string ManufacturerNumber { get; set; }
|
||||||
public long? WholeSalerId { get; set; }
|
public long? WholeSalerId { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string WholeSalerViz { get; set; }
|
||||||
public string WholeSalerNumber { get; set; }
|
public string WholeSalerNumber { get; set; }
|
||||||
public long? AlternativeWholeSalerId { get; set; }
|
public long? AlternativeWholeSalerId { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string AlternativeWholeSalerViz { get; set; }
|
||||||
public string AlternativeWholeSalerNumber { get; set; }
|
public string AlternativeWholeSalerNumber { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public decimal Cost { get; set; }
|
public decimal Cost { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user