This commit is contained in:
@@ -65,13 +65,17 @@ namespace AyaNova.Api.Controllers
|
|||||||
if (p.WorkOrders && (UType == UserType.Service || UType == UserType.ServiceContractor))
|
if (p.WorkOrders && (UType == UserType.Service || UType == UserType.ServiceContractor))
|
||||||
{
|
{
|
||||||
r.AddRange(await ct.ViewSchedulePersonalWorkOrder.Where(x => x.SchedUserId == UserId && x.StartDate > dtStart && x.StopDate < dtEnd)
|
r.AddRange(await ct.ViewSchedulePersonalWorkOrder.Where(x => x.SchedUserId == UserId && x.StartDate > dtStart && x.StopDate < dtEnd)
|
||||||
.Select(x => new PersonalScheduleListItem() { Id = x.WoItemSchedUserId, Color = ColorFromWOItem(x, p), Start = x.StartDate, End = x.StopDate, Type = AyaType.WorkOrderItemScheduledUser, Name = NameFromWOItem(x, p) })
|
.Select(x => new PersonalScheduleListItem() { Id = x.WoItemSchedUserId, Color = ColorFromWOItem(x, p), Start = EpochSeconds(x.StartDate), End = EpochSeconds(x.StopDate), Type = AyaType.WorkOrderItemScheduledUser, Name = NameFromWOItem(x, p) })
|
||||||
.ToListAsync());
|
.ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return Ok(ApiOkResponse.Response(r));
|
return Ok(ApiOkResponse.Response(r));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static long? EpochSeconds(DateTime? dt)
|
||||||
|
{
|
||||||
|
if (dt == null) return null;
|
||||||
|
DateTimeOffset dto = new DateTimeOffset((DateTime)dt);
|
||||||
|
return dto.ToUnixTimeSeconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string ColorFromWOItem(ViewSchedulePersonalWorkOrder v, PersonalScheduleParams p)
|
private static string ColorFromWOItem(ViewSchedulePersonalWorkOrder v, PersonalScheduleParams p)
|
||||||
@@ -116,8 +120,8 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
public class PersonalScheduleListItem
|
public class PersonalScheduleListItem
|
||||||
{
|
{
|
||||||
public DateTime? Start { get; set; }
|
public long? Start { get; set; }
|
||||||
public DateTime? End { get; set; }
|
public long? End { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Color { get; set; }
|
public string Color { get; set; }
|
||||||
public AyaType Type { get; set; }
|
public AyaType Type { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user