This commit is contained in:
2020-04-10 19:48:35 +00:00
parent 34708e7e2e
commit a868018ecf
3 changed files with 34 additions and 17 deletions

View File

@@ -133,6 +133,7 @@ namespace AyaNova.Api.Controllers
//DateTime, UserId, Event, Textra //DateTime, UserId, Event, Textra
public DateTime Date { get; set; } public DateTime Date { get; set; }
public long UserId { get; set; } public long UserId { get; set; }
public string Name { get; set; }
public AyaEvent Event { get; set; } public AyaEvent Event { get; set; }
public string Textra { get; set; } public string Textra { get; set; }
} }
@@ -143,6 +144,7 @@ namespace AyaNova.Api.Controllers
public DateTime Date { get; set; } public DateTime Date { get; set; }
public AyaType ObjectType { get; set; } public AyaType ObjectType { get; set; }
public long ObjectId { get; set; } public long ObjectId { get; set; }
public string Name { get; set; }
public AyaEvent Event { get; set; } public AyaEvent Event { get; set; }
public string Textra { get; set; } public string Textra { get; set; }
} }

View File

@@ -15,6 +15,10 @@ namespace AyaNova.Biz
//Returns existance status of object type and id specified in database //Returns existance status of object type and id specified in database
internal static string Name(AyaType aytype, long id, System.Data.Common.DbCommand cmd) internal static string Name(AyaType aytype, long id, System.Data.Common.DbCommand cmd)
{ {
if (aytype == AyaType.NoType || id == 0)
{
return "-";
}
string TABLE = string.Empty; string TABLE = string.Empty;
string COLUMN = "name"; string COLUMN = "name";
//CoreBizObject add here //CoreBizObject add here

View File

@@ -61,15 +61,20 @@ namespace AyaNova.Biz
var EventItems = await q.ToArrayAsync(); var EventItems = await q.ToArrayAsync();
//convert the Event array to the correct return type array //convert the Event array to the correct return type array
var ret = EventItems.Select(m => new AyaNova.Api.Controllers.EventLogController.ObjectEventLogItem() using (var command = ct.Database.GetDbConnection().CreateCommand())
{ {
Date = m.Created, ct.Database.OpenConnection();
UserId = m.UserId, var ret = EventItems.Select(m => new AyaNova.Api.Controllers.EventLogController.ObjectEventLogItem()
Event = m.AyEvent, {
Textra = m.Textra Date = m.Created,
}).ToArray(); UserId = m.UserId,
Event = m.AyEvent,
Textra = m.Textra,
Name = BizObjectNameFetcherDirect.Name(AyaType.User, m.UserId, command)
}).ToArray();
return ret; return ret;
}
} }
@@ -91,18 +96,24 @@ namespace AyaNova.Biz
//Execute the query //Execute the query
var EventItems = await q.ToArrayAsync(); var EventItems = await q.ToArrayAsync();
using (var command = ct.Database.GetDbConnection().CreateCommand())
//convert the Event array to the correct return type array
var ret = EventItems.Select(m => new AyaNova.Api.Controllers.EventLogController.UserEventLogItem()
{ {
Date = m.Created, ct.Database.OpenConnection();
ObjectType = m.AyType, //convert the Event array to the correct return type array
ObjectId = m.AyId, var ret = EventItems.Select(m => new AyaNova.Api.Controllers.EventLogController.UserEventLogItem()
Event = m.AyEvent, {
Textra = m.Textra
}).ToArray(); Date = m.Created,
ObjectType = m.AyType,
ObjectId = m.AyId,
Event = m.AyEvent,
Textra = m.Textra,
Name = BizObjectNameFetcherDirect.Name(m.AyType, m.AyId, command)
}).ToArray();
return ret;
}
return ret;
} }