This commit is contained in:
2018-08-28 00:03:06 +00:00
parent 82bd65cf49
commit b60dc75c8e
9 changed files with 85 additions and 17 deletions

View File

@@ -43,12 +43,32 @@ namespace AyaNova.Biz
ct.SaveChanges();
}
internal static Task<string> GetLogForObject(long ayId, AyContext ct)
/// <summary>
/// Get the event log for a specified object
/// </summary>
/// <param name="ayId"></param>
/// <param name="userLocaleId"></param>
/// <param name="ct"></param>
/// <returns></returns>
internal static async Task<string> GetLogForObject(long ayId, long userLocaleId, AyContext ct)
{
throw new NotImplementedException();
var items = await ct.Event
.Where(m => m.AyId == ayId)
.OrderBy(m => m.Created)
.ToListAsync();
AyaNova.Api.Controllers.LocaleController.LocaleSubsetParam param = new Api.Controllers.LocaleController.LocaleSubsetParam();
param.LocaleId = userLocaleId;
param.Keys.AddRange(new string[] { "CommonCreated", "Delete","Modified","Retrieved" });
var LT = LocaleBiz.GetSubsetStatic(param);
//Have list of locales
return null;
}
internal static Task<string> GetLogForUser(long ayId, AyContext ct)
internal static Task<string> GetLogForUser(long ayId, long userLocaleId, AyContext ct)
{
throw new NotImplementedException();
}

View File

@@ -103,6 +103,16 @@ namespace AyaNova.Biz
return ret.ToList();
}
//Get the keys for a list of keys provided, static format for calling from other internal classes
internal static async Task<List<KeyValuePair<string, string>>> GetSubsetStatic(AyaNova.Api.Controllers.LocaleController.LocaleSubsetParam param)
{
AyContext ct = ServiceProviderProvider.DBContext;
if (!LocaleExistsStatic(param.LocaleId, ct))
param.LocaleId = ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID;
var ret = await ct.LocaleItem.Where(x => x.LocaleId == param.LocaleId && param.Keys.Contains(x.Key)).ToDictionaryAsync(x => x.Key, x => x.Display);
return ret.ToList();
}
/// <summary>
/// Get the value of the key provided in the default locale chosen
@@ -133,7 +143,7 @@ namespace AyaNova.Biz
internal bool PutLocaleItemDisplayText(LocaleItem dbObj, NewTextIdConcurrencyTokenItem inObj, Locale dbParent)
{
if (dbParent.Stock == true)
if (dbParent.Stock == true)
{
AddError(ValidationErrorType.InvalidOperation, "object", "LocaleItem is from a Stock locale and cannot be modified");
return false;
@@ -271,6 +281,11 @@ namespace AyaNova.Biz
return ct.Locale.Any(e => e.Id == id);
}
public static bool LocaleExistsStatic(long id, AyContext ct)
{
return ct.Locale.Any(e => e.Id == id);
}
public bool LocaleItemExists(long id)
{
return ct.LocaleItem.Any(e => e.Id == id);