This commit is contained in:
@@ -73,7 +73,6 @@ namespace AyaNova.Api.Controllers
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
List<KeyValuePair<string, string>> ret = new List<KeyValuePair<string, string>>();
|
||||
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(UserType).ToString()), "AyaNova user account types"));
|
||||
ret.Add(new KeyValuePair<string, string>("insideusertype", "AyaNova user account types for staff / contractors"));
|
||||
@@ -85,7 +84,11 @@ namespace AyaNova.Api.Controllers
|
||||
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(NotifyEventType).ToString()), "Notification event types"));
|
||||
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(NotifyDeliveryMethod).ToString()), "Notification delivery methods"));
|
||||
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(NotifyMailSecurity).ToString()), "Notification SMTP mail server security method"));
|
||||
todo: add missing from below
|
||||
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(AyaEvent).ToString()), "Event log object change types"));
|
||||
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(LoanUnitRateUnit).ToString()), "Loan unit rate unit types"));
|
||||
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(CustomerServiceRequestPriority).ToString()), "csr priorities"));
|
||||
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(CustomerServiceRequestStatus).ToString()), "csr status"));
|
||||
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(PurchaseOrderStatus).ToString()), "PO Status"));
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
}
|
||||
|
||||
@@ -446,6 +449,9 @@ todo: add missing from below
|
||||
ReturnList.Add(new NameIdItem() { Name = LT["PurchaseOrderStatusClosedNoneReceived"], Id = (long)PurchaseOrderStatus.ClosedNoneReceived });
|
||||
ReturnList.Add(new NameIdItem() { Name = LT["PurchaseOrderStatusClosedPartialReceived"], Id = (long)PurchaseOrderStatus.ClosedPartialReceived });
|
||||
}
|
||||
//#################################################################################################################
|
||||
//################### NEW HERE DO NOT FORGET TO ADD TO LISTS AVAILABLE ABOVE AS WELL ##############################
|
||||
//#################################################################################################################
|
||||
else
|
||||
{
|
||||
ReturnList.Add(new NameIdItem() { Name = $"Unknown enum type list key value {enumKey}", Id = 0 });
|
||||
|
||||
@@ -46,7 +46,6 @@ namespace AyaNova.Biz
|
||||
{
|
||||
ct.Database.OpenConnection();
|
||||
return Name(ayaType, id, command);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -389,7 +389,6 @@ namespace AyaNova.Biz
|
||||
// IMPORT EXPORT
|
||||
//
|
||||
|
||||
|
||||
public async Task<JArray> GetExportData(long[] idList)
|
||||
{
|
||||
//for now just re-use the report data code
|
||||
@@ -397,9 +396,6 @@ namespace AyaNova.Biz
|
||||
return await GetReportData(idList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<List<string>> ImportData(JArray ja)
|
||||
{
|
||||
List<string> ImportResult = new List<string>();
|
||||
|
||||
@@ -198,6 +198,7 @@ namespace AyaNova.Biz
|
||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||
foreach (CustomerNote w in orderedList)
|
||||
{
|
||||
await PopulateVizFields(w);
|
||||
var jo = JObject.FromObject(w);
|
||||
ReportData.Add(jo);
|
||||
}
|
||||
@@ -205,12 +206,17 @@ namespace AyaNova.Biz
|
||||
return ReportData;
|
||||
}
|
||||
|
||||
//populate viz fields from provided object
|
||||
private async Task PopulateVizFields(CustomerNote o)
|
||||
{
|
||||
o.CustomerViz = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
o.UserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// IMPORT EXPORT
|
||||
//
|
||||
|
||||
|
||||
public async Task<JArray> GetExportData(long[] idList)
|
||||
{
|
||||
//for now just re-use the report data code
|
||||
|
||||
@@ -357,6 +357,7 @@ namespace AyaNova.Biz
|
||||
o.CustomerViz = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
|
||||
//MIGRATE_OUTSTANDING routine to get wo id from the WorkorderItemId
|
||||
o.WorkorderItemViz = "MIGRATE_OUTSTANDING woitem display value";
|
||||
// if (o.WorkorderItemId != null)
|
||||
// o.WorkorderItemViz = await ct.WorkorderItem.AsNoTracking().Where(x=>x.Id==o.WorkorderItemId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
@@ -283,6 +283,7 @@ namespace AyaNova.Biz
|
||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||
foreach (Memo w in orderedList)
|
||||
{
|
||||
await PopulateVizFields(w);
|
||||
var jo = JObject.FromObject(w);
|
||||
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||
@@ -293,11 +294,19 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
|
||||
//populate viz fields from provided object
|
||||
private async Task PopulateVizFields(Memo o)
|
||||
{
|
||||
if (o.ToId != null)
|
||||
o.ToViz = await ct.User.AsNoTracking().Where(x => x.Id == o.ToId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
if (o.FromId != null)
|
||||
o.FromViz = await ct.User.AsNoTracking().Where(x => x.Id == o.FromId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// IMPORT EXPORT
|
||||
//
|
||||
|
||||
|
||||
public async Task<JArray> GetExportData(long[] idList)
|
||||
{
|
||||
//for now just re-use the report data code
|
||||
@@ -305,9 +314,6 @@ namespace AyaNova.Biz
|
||||
return await GetReportData(idList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<List<string>> ImportData(JArray ja)
|
||||
{
|
||||
List<string> ImportResult = new List<string>();
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace AyaNova.Biz
|
||||
var partNames = await PickListFetcher.GetResponseAsync(PickList, null, null, true, partIdList, null, ct, null);
|
||||
foreach (PartAssemblyItem pai in ret.Items)
|
||||
{
|
||||
pai.PartDisplay = partNames.Where(z => z.Id == pai.PartId).First().Name;
|
||||
pai.PartViz = partNames.Where(z => z.Id == pai.PartId).First().Name;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -318,6 +318,7 @@ namespace AyaNova.Biz
|
||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||
foreach (PartAssembly w in orderedList)
|
||||
{
|
||||
await PopulateVizFields(w);
|
||||
var jo = JObject.FromObject(w);
|
||||
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||
@@ -327,12 +328,18 @@ namespace AyaNova.Biz
|
||||
return ReportData;
|
||||
}
|
||||
|
||||
//populate viz fields from provided object
|
||||
private async Task PopulateVizFields(PartAssembly pa)
|
||||
{
|
||||
foreach (PartAssemblyItem o in pa.Items)
|
||||
o.PartViz = await ct.Part.AsNoTracking().Where(x => x.Id == o.PartId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// IMPORT EXPORT
|
||||
//
|
||||
|
||||
|
||||
public async Task<JArray> GetExportData(long[] idList)
|
||||
{
|
||||
//for now just re-use the report data code
|
||||
@@ -340,9 +347,6 @@ namespace AyaNova.Biz
|
||||
return await GetReportData(idList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<List<string>> ImportData(JArray ja)
|
||||
{
|
||||
List<string> ImportResult = new List<string>();
|
||||
|
||||
@@ -275,17 +275,37 @@ namespace AyaNova.Biz
|
||||
var batchResults = await ct.PartInventory.AsNoTracking().Where(z => batch.Contains(z.Id)).ToArrayAsync();
|
||||
//order the results back into original
|
||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||
|
||||
//cache frequent viz data
|
||||
var AyaTypesEnumList = await AyaNova.Api.Controllers.EnumListController.GetEnumList(StringUtil.TrimTypeName(typeof(AyaType).ToString()), UserTranslationId);
|
||||
using (var command = ct.Database.GetDbConnection().CreateCommand())
|
||||
{
|
||||
ct.Database.OpenConnection();
|
||||
|
||||
foreach (PartInventory w in orderedList)
|
||||
{
|
||||
await PopulateVizFields(w, AyaTypesEnumList, command);
|
||||
var jo = JObject.FromObject(w);
|
||||
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||
ReportData.Add(jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ReportData;
|
||||
}
|
||||
|
||||
//populate viz fields from provided object
|
||||
private async Task PopulateVizFields(PartInventory o, List<NameIdItem> ayaTypesEnumList, System.Data.Common.DbCommand cmd)
|
||||
{
|
||||
o.PartViz = await ct.Part.AsNoTracking().Where(x => x.Id == o.PartId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
o.PartWarehouseViz = await ct.PartWarehouse.AsNoTracking().Where(x => x.Id == o.PartWarehouseId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
if (o.SourceType != null)
|
||||
o.SourceTypeViz = ayaTypesEnumList.Where(x => x.Id == (long)o.SourceType).Select(x => x.Name).First();
|
||||
if (o.SourceType != null && o.SourceId != null)
|
||||
o.SourceViz = BizObjectNameFetcherDirect.Name((AyaType)o.SourceType, (long)o.SourceId, cmd);
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// IMPORT EXPORT
|
||||
|
||||
@@ -339,6 +339,7 @@ namespace AyaNova.Biz
|
||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||
foreach (Review w in orderedList)
|
||||
{
|
||||
await PopulateVizFields(w);
|
||||
var jo = JObject.FromObject(w);
|
||||
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||
@@ -348,12 +349,19 @@ namespace AyaNova.Biz
|
||||
return ReportData;
|
||||
}
|
||||
|
||||
//populate viz fields from provided object
|
||||
private async Task PopulateVizFields(Review o)
|
||||
{
|
||||
o.UserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
o.AssignedByUserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.AssignedByUserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// IMPORT EXPORT
|
||||
//
|
||||
|
||||
|
||||
public async Task<JArray> GetExportData(long[] idList)
|
||||
{
|
||||
//for now just re-use the report data code
|
||||
@@ -361,9 +369,6 @@ namespace AyaNova.Biz
|
||||
return await GetReportData(idList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<List<string>> ImportData(JArray ja)
|
||||
{
|
||||
List<string> ImportResult = new List<string>();
|
||||
|
||||
@@ -13,8 +13,12 @@ namespace AyaNova.Models
|
||||
public uint Concurrency { get; set; }
|
||||
[Required]
|
||||
public long CustomerId { get; set; }
|
||||
[NotMapped]
|
||||
public string CustomerViz { get; set; }
|
||||
[Required]
|
||||
public long UserId { get; set; }
|
||||
[NotMapped]
|
||||
public string UserViz { get; set; }
|
||||
[Required]
|
||||
public DateTime NoteDate { get; set; }
|
||||
public string Notes { get; set; }
|
||||
|
||||
@@ -26,7 +26,11 @@ namespace AyaNova.Models
|
||||
public bool Viewed { get; set; }
|
||||
public bool Replied { get; set; }
|
||||
public long? FromId { get; set; }
|
||||
[NotMapped]
|
||||
public string FromViz { get; set; }
|
||||
public long? ToId { get; set; }
|
||||
[NotMapped]
|
||||
public string ToViz { get; set; }
|
||||
public DateTime Sent { get; set; }//redundant but displayed all over the place in the UI so properly redundant
|
||||
|
||||
public Memo()
|
||||
|
||||
@@ -12,17 +12,17 @@ namespace AyaNova.Models
|
||||
|
||||
[Required]
|
||||
public long PartAssemblyId { get; set; }
|
||||
|
||||
[Required]
|
||||
public long PartId { get; set; }
|
||||
[NotMapped]
|
||||
public string PartViz { get; set; }
|
||||
[Required]
|
||||
public decimal Quantity { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public PartAssembly PartAssembly { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string PartDisplay { get; set; }
|
||||
|
||||
}//eoc
|
||||
|
||||
}//eons
|
||||
@@ -23,11 +23,19 @@ namespace AyaNova.Models
|
||||
public DateTime? LastEntryDate { get; set; }
|
||||
[Required]
|
||||
public long PartId { get; set; }
|
||||
[NotMapped]
|
||||
public string PartViz { get; set; }
|
||||
[Required]
|
||||
public long PartWarehouseId { get; set; }
|
||||
[NotMapped]
|
||||
public string PartWarehouseViz { get; set; }
|
||||
|
||||
public long? SourceId { get; set; }
|
||||
[NotMapped]
|
||||
public string SourceViz { get; set; }
|
||||
public AyaType? SourceType { get; set; }
|
||||
[NotMapped]
|
||||
public string SourceTypeViz { get; set; }
|
||||
|
||||
[Required]
|
||||
public decimal Quantity { get; set; }
|
||||
|
||||
@@ -29,8 +29,12 @@ namespace AyaNova.Models
|
||||
public string CompletionNotes { get; set; }
|
||||
[Required]
|
||||
public long UserId { get; set; }
|
||||
[NotMapped]
|
||||
public string UserViz { get; set; }
|
||||
[Required]
|
||||
public long AssignedByUserId { get; set; }
|
||||
[NotMapped]
|
||||
public string AssignedByUserViz { get; set; }
|
||||
|
||||
[Required]
|
||||
public long ObjectId { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user