This commit is contained in:
@@ -60,31 +60,11 @@ namespace AyaNova.Api.Controllers
|
||||
{
|
||||
//trying ad-hoc join https://entityframeworkcore.com/querying-data-joining
|
||||
|
||||
var w=await ct.WorkOrderItemScheduledUser.Join(ct.WorkOrderItem,x=>x.WorkOrderItemId==)
|
||||
var wo = await ct.ViewSchedulePersonalWorkOrder.Where(x => x.SchedUserId == UserId)
|
||||
.Select(x => new PersonalScheduleListItem() { Id = x.WoItemSchedUserId, Color = ColorFromWOItem(x, p), Start = x.StartDate, End = x.StopDate, Type = AyaType.WorkOrderItemScheduledUser, })
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
// var w = await ct.WorkOrder.AsSplitQuery().AsNoTracking()
|
||||
// .Include(s => s.States)
|
||||
// .Include(w => w.Items.OrderBy(item => item.Sequence))
|
||||
// .ThenInclude(wi => wi.Expenses)
|
||||
// .Include(w => w.Items)
|
||||
// .ThenInclude(wi => wi.Labors)
|
||||
// .Include(w => w.Items)
|
||||
// .ThenInclude(wi => wi.Loans)
|
||||
// .Include(w => w.Items)
|
||||
// .ThenInclude(wi => wi.Parts)
|
||||
// .Include(w => w.Items)
|
||||
// .ThenInclude(wi => wi.PartRequests)
|
||||
// .Include(w => w.Items)
|
||||
// .ThenInclude(wi => wi.ScheduledUsers)
|
||||
// .Include(w => w.Items)
|
||||
// .ThenInclude(wi => wi.Tasks.OrderBy(t => t.Sequence))
|
||||
// .Include(w => w.Items)
|
||||
// .ThenInclude(wi => wi.Travels)
|
||||
// .Include(w => w.Items)
|
||||
// .ThenInclude(wi => wi.Units)
|
||||
// .Include(w => w.Items)
|
||||
// .ThenInclude(wi => wi.OutsideServices)
|
||||
// .SingleOrDefaultAsync(z => z.Id == UserId);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +72,21 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
}
|
||||
|
||||
private string ColorFromWOItem(ViewSchedulePersonalWorkOrder v, PersonalScheduleParams p)
|
||||
{
|
||||
switch (p.ColorSource)
|
||||
{
|
||||
case PersonalScheduleWorkOrderColorSource.WorkOrderStatus:
|
||||
return v.WorkOrderStatusColor;
|
||||
case PersonalScheduleWorkOrderColorSource.WorkOrderItemStatus:
|
||||
return v.WorkOrderItemStatusColor;
|
||||
case PersonalScheduleWorkOrderColorSource.WorkOrderItemPriority:
|
||||
return v.WorkOrderItemPriorityColor;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
public enum PersonalScheduleWorkOrderColorSource : int
|
||||
{
|
||||
@@ -111,8 +106,8 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
public class PersonalScheduleListItem
|
||||
{
|
||||
public DateTime Start { get; set; }
|
||||
public DateTime End { get; set; }
|
||||
public DateTime? Start { get; set; }
|
||||
public DateTime? End { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Color { get; set; }
|
||||
public AyaType Type { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user