This commit is contained in:
@@ -85,7 +85,7 @@ 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
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
}
|
||||
|
||||
|
||||
@@ -330,8 +330,16 @@ namespace AyaNova.Biz
|
||||
var batchResults = await ct.CustomerServiceRequest.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
|
||||
//usertypes
|
||||
var CustomerServiceRequestStatusEnumList = await AyaNova.Api.Controllers.EnumListController.GetEnumList(StringUtil.TrimTypeName(typeof(CustomerServiceRequestStatus).ToString()), UserTranslationId);
|
||||
var CustomerServiceRequestPriorityEnumList = await AyaNova.Api.Controllers.EnumListController.GetEnumList(StringUtil.TrimTypeName(typeof(CustomerServiceRequestPriority).ToString()), UserTranslationId);
|
||||
|
||||
|
||||
foreach (CustomerServiceRequest w in orderedList)
|
||||
{
|
||||
await PopulateVizFields(w, CustomerServiceRequestStatusEnumList, CustomerServiceRequestPriorityEnumList);
|
||||
var jo = JObject.FromObject(w);
|
||||
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||
@@ -341,12 +349,26 @@ namespace AyaNova.Biz
|
||||
return ReportData;
|
||||
}
|
||||
|
||||
//populate viz fields from provided object
|
||||
private async Task PopulateVizFields(CustomerServiceRequest o, List<NameIdItem> customerServiceRequestStatusEnumList, List<NameIdItem> customerServiceRequestPriorityEnumList)
|
||||
{
|
||||
if (o.UnitId != null)
|
||||
o.UnitViz = await ct.Unit.AsNoTracking().Where(x => x.Id == o.UnitId).Select(x => x.Serial).FirstOrDefaultAsync();
|
||||
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
|
||||
// if (o.WorkorderItemId != null)
|
||||
// o.WorkorderItemViz = await ct.WorkorderItem.AsNoTracking().Where(x=>x.Id==o.WorkorderItemId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
|
||||
o.RequestedByUserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.RequestedByUserId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
o.StatusViz = customerServiceRequestStatusEnumList.Where(x => x.Id == (long)o.Status).Select(x => x.Name).First();
|
||||
o.PriorityViz = customerServiceRequestPriorityEnumList.Where(x => x.Id == (long)o.Priority).Select(x => x.Name).First();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// IMPORT EXPORT
|
||||
//
|
||||
|
||||
|
||||
public async Task<JArray> GetExportData(long[] idList)
|
||||
{
|
||||
//for now just re-use the report data code
|
||||
@@ -354,9 +376,6 @@ namespace AyaNova.Biz
|
||||
return await GetReportData(idList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<List<string>> ImportData(JArray ja)
|
||||
{
|
||||
List<string> ImportResult = new List<string>();
|
||||
|
||||
@@ -149,9 +149,9 @@ namespace AyaNova.Biz
|
||||
|
||||
if (po.DropShipToCustomerId != null)
|
||||
po.DropShipToCustomerViz = await ct.Customer.AsNoTracking().Where(x => x.Id == po.DropShipToCustomerId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
po.VendorViz = await ct.Contract.AsNoTracking().Where(x => x.Id == po.VendorId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
po.VendorViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == po.VendorId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
if (po.ProjectId != null)
|
||||
po.ProjectViz = await ct.Contract.AsNoTracking().Where(x => x.Id == po.ProjectId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
po.ProjectViz = await ct.Project.AsNoTracking().Where(x => x.Id == po.ProjectId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
|
||||
foreach (PurchaseOrderItem item in po.Items)
|
||||
{
|
||||
|
||||
@@ -278,6 +278,7 @@ namespace AyaNova.Biz
|
||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||
foreach (Reminder w in orderedList)
|
||||
{
|
||||
await PopulateVizFields(w);
|
||||
var jo = JObject.FromObject(w);
|
||||
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||
@@ -287,12 +288,16 @@ namespace AyaNova.Biz
|
||||
return ReportData;
|
||||
}
|
||||
|
||||
//populate viz fields from provided object
|
||||
private async Task PopulateVizFields(Reminder o)
|
||||
{
|
||||
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
|
||||
@@ -300,9 +305,6 @@ namespace AyaNova.Biz
|
||||
return await GetReportData(idList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<List<string>> ImportData(JArray ja)
|
||||
{
|
||||
List<string> ImportResult = new List<string>();
|
||||
|
||||
@@ -300,6 +300,7 @@ namespace AyaNova.Biz
|
||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||
foreach (UnitModel w in orderedList)
|
||||
{
|
||||
await PopulateVizFields(w);
|
||||
var jo = JObject.FromObject(w);
|
||||
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||
@@ -309,12 +310,17 @@ namespace AyaNova.Biz
|
||||
return ReportData;
|
||||
}
|
||||
|
||||
//populate viz fields from provided object
|
||||
private async Task PopulateVizFields(UnitModel o)
|
||||
{
|
||||
if (o.VendorId != null)
|
||||
o.VendorViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// IMPORT EXPORT
|
||||
//
|
||||
|
||||
|
||||
public async Task<JArray> GetExportData(long[] idList)
|
||||
{
|
||||
//for now just re-use the report data code
|
||||
@@ -322,9 +328,6 @@ namespace AyaNova.Biz
|
||||
return await GetReportData(idList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<List<string>> ImportData(JArray ja)
|
||||
{
|
||||
List<string> ImportResult = new List<string>();
|
||||
|
||||
@@ -910,7 +910,7 @@ namespace AyaNova.Biz
|
||||
o.HeadOfficeViz = await ct.HeadOffice.AsNoTracking().Where(x => x.Id == o.HeadOfficeId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
|
||||
if (o.VendorId != null)
|
||||
o.VendorViz = await ct.Customer.AsNoTracking().Where(x => x.Id == o.VendorId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
o.VendorViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
|
||||
o.UserTypeViz = userTypesEnumList.Where(x => x.Id == (long)o.UserType).Select(x => x.Name).First();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace AyaNova.Models
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
public string Notes { get; set; }
|
||||
public string Wiki { get; set; }
|
||||
public string CustomFields { get; set; }
|
||||
@@ -26,15 +26,27 @@ namespace AyaNova.Models
|
||||
public DateTime DateRequested { get; set; }
|
||||
[Required]
|
||||
public long CustomerId { get; set; }
|
||||
[NotMapped]
|
||||
public string CustomerViz { get; set; }
|
||||
public long? UnitId { get; set; }
|
||||
[NotMapped]
|
||||
public string UnitViz { get; set; }
|
||||
public long? WorkorderItemId { get; set; }
|
||||
[NotMapped]
|
||||
public string WorkorderItemViz { get; set; }
|
||||
[Required]
|
||||
public long RequestedByUserId { get; set; }
|
||||
[NotMapped]
|
||||
public string RequestedByUserViz { get; set; }
|
||||
public string CustomerReferenceNumber { get; set; }
|
||||
[Required]
|
||||
public CustomerServiceRequestStatus Status { get; set; }
|
||||
[NotMapped]
|
||||
public string StatusViz { get; set; }
|
||||
[Required]
|
||||
public CustomerServiceRequestPriority Priority { get; set; }
|
||||
[NotMapped]
|
||||
public string PriorityViz { get; set; }
|
||||
|
||||
public CustomerServiceRequest()
|
||||
{
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace AyaNova.Models
|
||||
public DateTime StopDate { get; set; }
|
||||
[Required]
|
||||
public long UserId { get; set; }
|
||||
[NotMapped]
|
||||
public string UserViz { get; set; }
|
||||
/*
|
||||
Hexadecimal notation: #RGB[A]
|
||||
R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (0–9, A–F). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388.
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace AyaNova.Models
|
||||
[Required]
|
||||
public string Number { get; set; }
|
||||
public long? VendorId { get; set; }
|
||||
[NotMapped]
|
||||
public string VendorViz { get; set; }
|
||||
public string UPC { get; set; }
|
||||
public bool LifeTimeWarranty { get; set; }
|
||||
public DateTime? IntroducedDate { get; set; }
|
||||
@@ -36,7 +38,7 @@ namespace AyaNova.Models
|
||||
|
||||
public UnitModel()
|
||||
{
|
||||
Tags = new List<string>();
|
||||
Tags = new List<string>();
|
||||
}
|
||||
|
||||
[NotMapped, JsonIgnore]
|
||||
|
||||
Reference in New Issue
Block a user