This commit is contained in:
@@ -62,7 +62,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
<a href=""/docs"" target=""_blank"">AyaNova manual</a><br/><br/>
|
<a href=""/docs"" target=""_blank"">AyaNova manual</a><br/><br/>
|
||||||
<a href=""/api-docs"" target=""_blank"">API explorer</a><br/><br/>
|
<a href=""/api-docs"" target=""_blank"">API explorer</a><br/><br/>
|
||||||
<a href=""mailto:support@ayanova.com"">Email AyaNova support</a><br/><br/>
|
<a href=""mailto:support@ayanova.com"">Email AyaNova support</a><br/><br/>
|
||||||
<h4>{LocaleBiz.GetDefaultLocalizedText("HelpLicense").Result}</h4>
|
<h4>{LocaleBiz.GetDefaultLocalizedTextAsync("HelpLicense").Result}</h4>
|
||||||
<pre>{AyaNova.Core.License.LicenseInfo}</pre>
|
<pre>{AyaNova.Core.License.LicenseInfo}</pre>
|
||||||
<h4>Schema version</h4>
|
<h4>Schema version</h4>
|
||||||
<pre>{AySchema.currentSchema.ToString()}</pre>
|
<pre>{AySchema.currentSchema.ToString()}</pre>
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
LocaleKeysToFetch.Add("UserTypesClient");
|
LocaleKeysToFetch.Add("UserTypesClient");
|
||||||
LocaleKeysToFetch.Add("UserTypesHeadOffice");
|
LocaleKeysToFetch.Add("UserTypesHeadOffice");
|
||||||
LocaleKeysToFetch.Add("UserTypesSubContractor");
|
LocaleKeysToFetch.Add("UserTypesSubContractor");
|
||||||
var LT = LocaleBiz.GetSubsetStatic(LocaleKeysToFetch, LocaleId).Result;
|
var LT = LocaleBiz.GetSubsetStaticAsync(LocaleKeysToFetch, LocaleId).Result;
|
||||||
|
|
||||||
ReturnList.Add(new NameIdItem() { Name = LT["UserTypesAdministrator"], Id = (long)UserType.Administrator });
|
ReturnList.Add(new NameIdItem() { Name = LT["UserTypesAdministrator"], Id = (long)UserType.Administrator });
|
||||||
ReturnList.Add(new NameIdItem() { Name = LT["UserTypesSchedulable"], Id = (long)UserType.Schedulable });
|
ReturnList.Add(new NameIdItem() { Name = LT["UserTypesSchedulable"], Id = (long)UserType.Schedulable });
|
||||||
@@ -115,7 +115,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
LocaleKeysToFetch.Add("AuthorizationRoleSalesLimited");
|
LocaleKeysToFetch.Add("AuthorizationRoleSalesLimited");
|
||||||
LocaleKeysToFetch.Add("AuthorizationRoleSalesFull");
|
LocaleKeysToFetch.Add("AuthorizationRoleSalesFull");
|
||||||
LocaleKeysToFetch.Add("AuthorizationRoleAll");
|
LocaleKeysToFetch.Add("AuthorizationRoleAll");
|
||||||
var LT = LocaleBiz.GetSubsetStatic(LocaleKeysToFetch, LocaleId).Result;
|
var LT = LocaleBiz.GetSubsetStaticAsync(LocaleKeysToFetch, LocaleId).Result;
|
||||||
|
|
||||||
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleNoRole"], Id = (long)AuthorizationRoles.NoRole });
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleNoRole"], Id = (long)AuthorizationRoles.NoRole });
|
||||||
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleBizAdminLimited"], Id = (long)AuthorizationRoles.BizAdminLimited });
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleBizAdminLimited"], Id = (long)AuthorizationRoles.BizAdminLimited });
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = await EventLogProcessor.GetLogForObject(opt, ct);
|
var result = await EventLogProcessor.GetLogForObjectAsync(opt, ct);
|
||||||
return Ok(ApiOkResponse.Response(result, true));
|
return Ok(ApiOkResponse.Response(result, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = await EventLogProcessor.GetLogForUser(opt, ct);
|
var result = await EventLogProcessor.GetLogForUserAsync(opt, ct);
|
||||||
|
|
||||||
return Ok(ApiOkResponse.Response(result, true));
|
return Ok(ApiOkResponse.Response(result, true));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
//Instantiate the business object handler
|
//Instantiate the business object handler
|
||||||
LocaleBiz biz = LocaleBiz.GetBiz(ct, HttpContext);
|
LocaleBiz biz = LocaleBiz.GetBiz(ct, HttpContext);
|
||||||
|
|
||||||
var l = await biz.GetSubset(inObj);
|
var l = await biz.GetSubsetAsync(inObj);
|
||||||
return Ok(ApiOkResponse.Response(l, true));
|
return Ok(ApiOkResponse.Response(l, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!biz.PutLocaleItemDisplayText(oFromDb, inObj, oDbParent))
|
if (!biz.PutLocaleItemDisplayTextAsync(oFromDb, inObj, oDbParent))
|
||||||
{
|
{
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!biz.PutLocaleName(oFromDb, inObj))
|
if (!biz.PutLocaleNameAsync(oFromDb, inObj))
|
||||||
{
|
{
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace AyaNova.Biz
|
|||||||
/// Get the event log for a specified object
|
/// Get the event log for a specified object
|
||||||
/// Presentation is the client's responsibility (localization internationalization etc)
|
/// Presentation is the client's responsibility (localization internationalization etc)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static async Task<AyaNova.Api.Controllers.EventLogController.ObjectEventLogItem[]> GetLogForObject(AyaNova.Api.Controllers.EventLogController.EventLogOptions opt, AyContext ct)
|
internal static async Task<AyaNova.Api.Controllers.EventLogController.ObjectEventLogItem[]> GetLogForObjectAsync(AyaNova.Api.Controllers.EventLogController.EventLogOptions opt, AyContext ct)
|
||||||
{
|
{
|
||||||
//This is also an example of conditional where statements
|
//This is also an example of conditional where statements
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ namespace AyaNova.Biz
|
|||||||
/// Get the event log for a specified User
|
/// Get the event log for a specified User
|
||||||
/// Presentation is the client's responsibility (localization internationalization etc)
|
/// Presentation is the client's responsibility (localization internationalization etc)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static async Task<AyaNova.Api.Controllers.EventLogController.UserEventLogItem[]> GetLogForUser(AyaNova.Api.Controllers.EventLogController.EventLogOptions opt, AyContext ct)
|
internal static async Task<AyaNova.Api.Controllers.EventLogController.UserEventLogItem[]> GetLogForUserAsync(AyaNova.Api.Controllers.EventLogController.EventLogOptions opt, AyContext ct)
|
||||||
{
|
{
|
||||||
//Set up the query
|
//Set up the query
|
||||||
var q = ct.Event.Select(m => m);
|
var q = ct.Event.Select(m => m);
|
||||||
|
|||||||
@@ -149,16 +149,16 @@ namespace AyaNova.Biz
|
|||||||
//
|
//
|
||||||
|
|
||||||
//USERS
|
//USERS
|
||||||
await DoImport("GZTW.AyaNova.BLL.User", "main", AyaType.User, job.GId, importMap, importFileName, zipEntries, TagLists);
|
await DoImportAsync("GZTW.AyaNova.BLL.User", "main", AyaType.User, job.GId, importMap, importFileName, zipEntries, TagLists);
|
||||||
//Now can do event log entries
|
//Now can do event log entries
|
||||||
await DoImport("GZTW.AyaNova.BLL.User", "eventlog", AyaType.User, job.GId, importMap, importFileName, zipEntries, TagLists);
|
await DoImportAsync("GZTW.AyaNova.BLL.User", "eventlog", AyaType.User, job.GId, importMap, importFileName, zipEntries, TagLists);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//IMPORT LOCALES
|
//IMPORT LOCALES
|
||||||
await DoImport("GZTW.AyaNova.BLL.Locale", "main", AyaType.Locale, job.GId, importMap, importFileName, zipEntries, TagLists);
|
await DoImportAsync("GZTW.AyaNova.BLL.Locale", "main", AyaType.Locale, job.GId, importMap, importFileName, zipEntries, TagLists);
|
||||||
//Now can do user locale settings properly
|
//Now can do user locale settings properly
|
||||||
await DoImport("GZTW.AyaNova.BLL.User", "locale", AyaType.User, job.GId, importMap, importFileName, zipEntries, TagLists);
|
await DoImportAsync("GZTW.AyaNova.BLL.User", "locale", AyaType.User, job.GId, importMap, importFileName, zipEntries, TagLists);
|
||||||
|
|
||||||
//TODO: CLIENT
|
//TODO: CLIENT
|
||||||
//do import for client here
|
//do import for client here
|
||||||
@@ -194,7 +194,7 @@ namespace AyaNova.Biz
|
|||||||
/// <param name="zipEntries"></param>
|
/// <param name="zipEntries"></param>
|
||||||
/// <param name="tagLists"></param>
|
/// <param name="tagLists"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task DoImport(string entryStartsWith, string importTask, AyaType importerType, Guid jobId,
|
private async Task DoImportAsync(string entryStartsWith, string importTask, AyaType importerType, Guid jobId,
|
||||||
List<ImportAyaNova7MapItem> importMap, string importFileName, List<string> zipEntries, Dictionary<string, Dictionary<Guid, string>> tagLists)
|
List<ImportAyaNova7MapItem> importMap, string importFileName, List<string> zipEntries, Dictionary<string, Dictionary<Guid, string>> tagLists)
|
||||||
{
|
{
|
||||||
var zipObjectList = zipEntries.Where(m => m.StartsWith(entryStartsWith)).ToList();
|
var zipObjectList = zipEntries.Where(m => m.StartsWith(entryStartsWith)).ToList();
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ namespace AyaNova.Biz
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Get the keys for a list of keys provided
|
//Get the keys for a list of keys provided
|
||||||
internal async Task<List<KeyValuePair<string, string>>> GetSubset(List<string> param)
|
internal async Task<List<KeyValuePair<string, string>>> GetSubsetAsync(List<string> param)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
@@ -165,7 +165,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Get the keys for a list of keys provided, static format for calling from other internal classes
|
//Get the keys for a list of keys provided, static format for calling from other internal classes
|
||||||
internal static async Task<Dictionary<string, string>> GetSubsetStatic(List<string> param, long localeId)
|
internal static async Task<Dictionary<string, string>> GetSubsetStaticAsync(List<string> param, long localeId)
|
||||||
{
|
{
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
TrackRequestedKey(param);
|
TrackRequestedKey(param);
|
||||||
@@ -179,7 +179,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
//Get the CJKIndex value for the locale specified
|
//Get the CJKIndex value for the locale specified
|
||||||
internal static async Task<bool> GetCJKIndex(long localeId, AyContext ct = null)
|
internal static async Task<bool> GetCJKIndexAsync(long localeId, AyContext ct = null)
|
||||||
{
|
{
|
||||||
if (ct == null)
|
if (ct == null)
|
||||||
ct = ServiceProviderProvider.DBContext;
|
ct = ServiceProviderProvider.DBContext;
|
||||||
@@ -193,7 +193,7 @@ namespace AyaNova.Biz
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static async Task<string> GetDefaultLocalizedText(string key)
|
internal static async Task<string> GetDefaultLocalizedTextAsync(string key)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(key))
|
if (string.IsNullOrWhiteSpace(key))
|
||||||
return "ERROR: GetDefaultLocalizedText NO KEY VALUE SPECIFIED";
|
return "ERROR: GetDefaultLocalizedText NO KEY VALUE SPECIFIED";
|
||||||
@@ -217,7 +217,7 @@ namespace AyaNova.Biz
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
internal bool PutLocaleItemDisplayText(LocaleItem dbObj, NewTextIdConcurrencyTokenItem inObj, Locale dbParent)
|
internal async Task<bool> PutLocaleItemDisplayTextAsync(LocaleItem dbObj, NewTextIdConcurrencyTokenItem inObj, Locale dbParent)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (dbParent.Stock == true)
|
if (dbParent.Stock == true)
|
||||||
@@ -239,16 +239,16 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
if (HasErrors)
|
if (HasErrors)
|
||||||
return false;
|
return false;
|
||||||
ct.SaveChanges();
|
await ct.SaveChangesAsync();
|
||||||
|
|
||||||
//Log
|
//Log
|
||||||
EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbParent.Id, AyaType.Locale, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbParent.Id, AyaType.Locale, AyaEvent.Modified), ct);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal bool PutLocaleName(Locale dbObj, NewTextIdConcurrencyTokenItem inObj)
|
internal async Task<bool> PutLocaleNameAsync(Locale dbObj, NewTextIdConcurrencyTokenItem inObj)
|
||||||
{
|
{
|
||||||
if (dbObj.Stock == true)
|
if (dbObj.Stock == true)
|
||||||
{
|
{
|
||||||
@@ -267,9 +267,9 @@ namespace AyaNova.Biz
|
|||||||
if (HasErrors)
|
if (HasErrors)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ct.SaveChanges();
|
await ct.SaveChangesAsync();
|
||||||
//Log
|
//Log
|
||||||
EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObj.Id, AyaType.Locale, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObj.Id, AyaType.Locale, AyaEvent.Modified), ct);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -587,7 +587,7 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
if (!NewLocaleDict.ContainsKey(s))
|
if (!NewLocaleDict.ContainsKey(s))
|
||||||
{
|
{
|
||||||
NewLocaleDict.Add(s, GetDefaultLocalizedText(s).Result);
|
NewLocaleDict.Add(s, GetDefaultLocalizedTextAsync(s).Result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -722,7 +722,7 @@ cache or provide directly the locale to save time repeatedly fetching it when do
|
|||||||
Param.Add("StopWords5");
|
Param.Add("StopWords5");
|
||||||
Param.Add("StopWords6");
|
Param.Add("StopWords6");
|
||||||
Param.Add("StopWords7");
|
Param.Add("StopWords7");
|
||||||
var Stops = LocaleBiz.GetSubsetStatic(Param, localeId).Result;
|
var Stops = LocaleBiz.GetSubsetStaticAsync(Param, localeId).Result;
|
||||||
|
|
||||||
foreach (KeyValuePair<string, string> kvp in Stops)
|
foreach (KeyValuePair<string, string> kvp in Stops)
|
||||||
{
|
{
|
||||||
@@ -733,7 +733,7 @@ cache or provide directly the locale to save time repeatedly fetching it when do
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LSD.CJKIndex = LocaleBiz.GetCJKIndex(localeId, ct).Result;
|
LSD.CJKIndex = LocaleBiz.GetCJKIndexAsync(localeId, ct).Result;
|
||||||
return LSD;
|
return LSD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace AyaNova.Biz
|
|||||||
await ct.SaveChangesAsync();
|
await ct.SaveChangesAsync();
|
||||||
//Handle child and associated items:
|
//Handle child and associated items:
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndex(outObj, true);
|
await SearchIndexAsync(outObj, true);
|
||||||
await TagUtil.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null);
|
await TagUtil.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null);
|
||||||
|
|
||||||
return outObj;
|
return outObj;
|
||||||
@@ -117,7 +117,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//Handle child and associated items:
|
//Handle child and associated items:
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
||||||
await SearchIndex(outObj, true);
|
await SearchIndexAsync(outObj, true);
|
||||||
await TagUtil.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null);
|
await TagUtil.ProcessUpdateTagsInRepositoryAsync(ct, outObj.Tags, null);
|
||||||
return outObj;
|
return outObj;
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//Log event and save context
|
//Log event and save context
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndex(dbObj, false);
|
await SearchIndexAsync(dbObj, false);
|
||||||
await TagUtil.ProcessUpdateTagsInRepositoryAsync(ct, dbObj.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagUtil.ProcessUpdateTagsInRepositoryAsync(ct, dbObj.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -182,7 +182,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//Log event and save context
|
//Log event and save context
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
||||||
await SearchIndex(dbObj, false);
|
await SearchIndexAsync(dbObj, false);
|
||||||
|
|
||||||
await TagUtil.ProcessUpdateTagsInRepositoryAsync(ct, dbObj.Tags, SnapshotOfOriginalDBObj.Tags);
|
await TagUtil.ProcessUpdateTagsInRepositoryAsync(ct, dbObj.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task SearchIndex(Widget obj, bool isNew)
|
private async Task SearchIndexAsync(Widget obj, bool isNew)
|
||||||
{
|
{
|
||||||
//SEARCH INDEXING
|
//SEARCH INDEXING
|
||||||
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, obj.Id, BizType, obj.Name);
|
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, obj.Id, BizType, obj.Name);
|
||||||
|
|||||||
Reference in New Issue
Block a user