This commit is contained in:
@@ -60,7 +60,9 @@ namespace AyaNova.Api.Controllers
|
||||
var UType = UserTypeFromContext.Type(HttpContext.Items);
|
||||
|
||||
|
||||
//Adjust query dates to encompass actual view range
|
||||
//Note: query will return records that fall within viewed range even if they start or end outside of it
|
||||
//However in month view (only, rest are as is) we can see up to 6 days before or after the month so in the interest of filling those voids:
|
||||
//Adjust query dates to encompass actual potential view range
|
||||
DateTime ViewStart = p.Start;
|
||||
DateTime ViewEnd = p.End;
|
||||
//this covers the largest possible window that could display due to nearly a week of the last or next month showing
|
||||
@@ -70,7 +72,6 @@ namespace AyaNova.Api.Controllers
|
||||
ViewEnd = p.End.AddDays(6);
|
||||
}
|
||||
|
||||
|
||||
//WORKORDERS
|
||||
if (p.WorkOrders && (UType == UserType.Service || UType == UserType.ServiceContractor))
|
||||
{
|
||||
@@ -88,19 +89,19 @@ namespace AyaNova.Api.Controllers
|
||||
s.Id = v.WoItemSchedUserId;
|
||||
s.Color = ColorFromWOItem(v, p);
|
||||
s.TextColor = TextColor(s.Color);
|
||||
s.Start = EpochSeconds(v.StartDate, p.TZOffset);
|
||||
s.End = EpochSeconds(v.StopDate, p.TZOffset);
|
||||
s.Start = (DateTime)v.StartDate;
|
||||
s.End = (DateTime)v.StopDate;
|
||||
s.Type = AyaType.WorkOrderItemScheduledUser;
|
||||
s.Name = NameFromWOItem(v, p);
|
||||
return s;
|
||||
}
|
||||
|
||||
private static long? EpochSeconds(DateTime? dt, int tzOffset = 0)
|
||||
{
|
||||
if (dt == null) return null;
|
||||
DateTimeOffset dto = new DateTimeOffset((DateTime)dt);
|
||||
return dto.ToUnixTimeMilliseconds() + (tzOffset * 60000);
|
||||
}
|
||||
// private static long? EpochSeconds(DateTime? dt, int tzOffset = 0)
|
||||
// {
|
||||
// if (dt == null) return null;
|
||||
// DateTimeOffset dto = new DateTimeOffset((DateTime)dt);
|
||||
// return dto.ToUnixTimeMilliseconds() + (tzOffset * 60000);
|
||||
// }
|
||||
|
||||
private static string ColorFromWOItem(ViewSchedulePersonalWorkOrder v, PersonalScheduleParams p)
|
||||
{
|
||||
@@ -153,7 +154,6 @@ namespace AyaNova.Api.Controllers
|
||||
public class PersonalScheduleParams
|
||||
{
|
||||
public ScheduleView View { get; set; }
|
||||
public int TZOffset { get; set; }
|
||||
public DateTime Start { get; set; }
|
||||
public DateTime End { get; set; }
|
||||
public PersonalScheduleWorkOrderColorSource ColorSource { get; set; }
|
||||
@@ -164,8 +164,12 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
public class PersonalScheduleListItem
|
||||
{
|
||||
public long? Start { get; set; }
|
||||
public long? End { get; set; }
|
||||
//Never be null dates in here even though source records might be have null dates because they are not queried for and
|
||||
//can't be displayed on a calendar anyway
|
||||
//user can simply filter a data table by null dates to see them
|
||||
//we shouldn't have allowed null dates in the first place in v7 but here we are :)
|
||||
public DateTime Start { get; set; }
|
||||
public DateTime End { get; set; }
|
||||
public bool Timed { get { return true; } }
|
||||
public string Name { get; set; }
|
||||
public string Color { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user