This commit is contained in:
@@ -47,26 +47,44 @@ namespace AyaNova.Biz
|
||||
/// <summary>
|
||||
/// Get the event log for a specified object
|
||||
/// </summary>
|
||||
internal static async Task<string> GetLogForObject(long ayId, DateTime StartDate, DateTime EndDate, AyContext ct)
|
||||
internal static async Task<AyaNova.Api.Controllers.EventLogController.ObjectEventLogItem[]> GetLogForObject(AyaNova.Api.Controllers.EventLogController.EventLogOptions opt, AyContext ct)
|
||||
{
|
||||
var items = await ct.Event
|
||||
.Where(m => m.AyId == ayId)
|
||||
.OrderBy(m => m.Created)
|
||||
.ToListAsync();
|
||||
//This is also an example of conditional where statements
|
||||
|
||||
if (items.Count == 0)
|
||||
//Set up the query
|
||||
var q = ct.Event.Select(m => m);
|
||||
|
||||
|
||||
q = q.Where(m => m.AyId == opt.AyId);
|
||||
|
||||
if (opt.StartDate != null)
|
||||
q = q.Where(m => m.Created > opt.StartDate);
|
||||
|
||||
if (opt.EndDate != null)
|
||||
q = q.Where(m => m.Created < opt.EndDate);
|
||||
|
||||
q = q.OrderBy(m => m.Created);
|
||||
|
||||
//Execute the query
|
||||
var EventItems = await q.ToArrayAsync();
|
||||
|
||||
//convert the Event array to the correct return type array
|
||||
var ret = EventItems.Select(m => new AyaNova.Api.Controllers.EventLogController.ObjectEventLogItem()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
Date = m.Created,
|
||||
UserId = m.OwnerId,
|
||||
Event = m.AyEvent,
|
||||
Textra = m.Textra
|
||||
}).ToArray();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
internal static Task<string> GetLogForUser(long ayId, long userLocaleId, AyContext ct)
|
||||
|
||||
|
||||
|
||||
internal static Task<string> GetLogForUser(AyaNova.Api.Controllers.EventLogController.EventLogOptions opt, AyContext ct)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@@ -75,7 +93,7 @@ namespace AyaNova.Biz
|
||||
|
||||
internal static string BuildLogEntry(bool userFormat, Event ev, List<KeyValuePair<string, string>> lt)
|
||||
{
|
||||
StringBuilder S=new StringBuilder();
|
||||
StringBuilder S = new StringBuilder();
|
||||
|
||||
//Object format:
|
||||
//DateTime, UserId, ActionNumber, Textra
|
||||
@@ -84,11 +102,13 @@ namespace AyaNova.Biz
|
||||
//DateTime, ObjectType, ObjectId, ActionNumber, Textra
|
||||
|
||||
ev
|
||||
|
||||
switch(ev.AyEvent){
|
||||
|
||||
|
||||
switch (ev.AyEvent)
|
||||
{
|
||||
case AyaEvent.Created:
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return ":";
|
||||
|
||||
Reference in New Issue
Block a user