This commit is contained in:
@@ -388,11 +388,11 @@ namespace AyaNova.Biz
|
|||||||
//Fields not sent with the put object
|
//Fields not sent with the put object
|
||||||
//(it's only location is in the db and since this putObject is replacing the dbObject we need to set it again here)
|
//(it's only location is in the db and since this putObject is replacing the dbObject we need to set it again here)
|
||||||
putObject.Salt = dbObject.Salt;
|
putObject.Salt = dbObject.Salt;
|
||||||
putObject.CurrentAuthToken=dbObject.CurrentAuthToken;
|
putObject.CurrentAuthToken = dbObject.CurrentAuthToken;
|
||||||
putObject.DlKey=dbObject.DlKey;
|
putObject.DlKey = dbObject.DlKey;
|
||||||
putObject.DlKeyExpire=dbObject.DlKeyExpire;
|
putObject.DlKeyExpire = dbObject.DlKeyExpire;
|
||||||
putObject.PasswordResetCode=dbObject.PasswordResetCode;
|
putObject.PasswordResetCode = dbObject.PasswordResetCode;
|
||||||
putObject.PasswordResetCodeExpire=dbObject.PasswordResetCodeExpire;
|
putObject.PasswordResetCodeExpire = dbObject.PasswordResetCodeExpire;
|
||||||
|
|
||||||
|
|
||||||
//NOTE: It's valid to call this without intending to change login or password (null values)
|
//NOTE: It's valid to call this without intending to change login or password (null values)
|
||||||
@@ -878,9 +878,15 @@ namespace AyaNova.Biz
|
|||||||
var batchResults = await ct.User.AsNoTracking().Include(z => z.UserOptions).Where(z => batch.Contains(z.Id)).ToArrayAsync();
|
var batchResults = await ct.User.AsNoTracking().Include(z => z.UserOptions).Where(z => batch.Contains(z.Id)).ToArrayAsync();
|
||||||
//order the results back into original
|
//order the results back into original
|
||||||
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;
|
||||||
|
|
||||||
|
//cache frequent viz data
|
||||||
|
//usertypes
|
||||||
|
var UserTypesEnumList = await AyaNova.Api.Controllers.EnumListController.GetEnumList(StringUtil.TrimTypeName(typeof(UserType).ToString()), UserTranslationId);
|
||||||
|
|
||||||
//foreach (User w in orderedList)
|
//foreach (User w in orderedList)
|
||||||
foreach (var w in orderedList)
|
foreach (var w in orderedList)
|
||||||
{
|
{
|
||||||
|
await PopulateVizFields(w, UserTypesEnumList);
|
||||||
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"]);
|
||||||
@@ -894,7 +900,20 @@ namespace AyaNova.Biz
|
|||||||
return ReportData;
|
return ReportData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//populate viz fields from provided object
|
||||||
|
private async Task PopulateVizFields(User o, List<NameIdItem> userTypesEnumList)
|
||||||
|
{
|
||||||
|
if (o.CustomerId != null)
|
||||||
|
o.CustomerViz = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (o.HeadOfficeId != null)
|
||||||
|
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.UserTypeViz = userTypesEnumList.Where(x => x.Id == (long)o.UserType).Select(x => x.Name).First();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// IMPORT EXPORT
|
// IMPORT EXPORT
|
||||||
|
|||||||
@@ -63,12 +63,20 @@ namespace AyaNova.Models
|
|||||||
public AuthorizationRoles Roles { get; set; }
|
public AuthorizationRoles Roles { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public UserType UserType { get; set; }
|
public UserType UserType { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string UserTypeViz { get; set; }
|
||||||
[MaxLength(255)]
|
[MaxLength(255)]
|
||||||
public string EmployeeNumber { get; set; }
|
public string EmployeeNumber { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public long? CustomerId { get; set; }
|
public long? CustomerId { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string CustomerViz { get; set; }
|
||||||
public long? HeadOfficeId { get; set; }
|
public long? HeadOfficeId { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string HeadOfficeViz { get; set; }
|
||||||
public long? VendorId { get; set; }
|
public long? VendorId { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string VendorViz { get; set; }
|
||||||
public string Wiki { get; set; }
|
public string Wiki { get; set; }
|
||||||
public string CustomFields { get; set; }
|
public string CustomFields { get; set; }
|
||||||
public List<string> Tags { get; set; }
|
public List<string> Tags { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user