public static bool TryParseCategorizedAppointment(AppointmentItem appointmentItem, out CategorizedAppointment categorizedAppointment) { categorizedAppointment = null; if (!string.IsNullOrWhiteSpace(appointmentItem.Categories) && !appointmentItem.Categories.Contains(CategoryService.CategorySeperator) && TryParseCategory(appointmentItem, out Models.Category category)) { categorizedAppointment = new CategorizedAppointment { Description = appointmentItem.Subject, StartTime = appointmentItem.Start, EndTime = appointmentItem.End, Category = category }; } return(categorizedAppointment != null); }
public static bool IsEqualTo(this Toggl.Api.DataObjects.TimeEntry entry, CategorizedAppointment appointment) => DateTime.ParseExact(entry.Start, TogglResponseDateFormat, null) == appointment.StartTime && DateTime.ParseExact(entry.Stop, TogglResponseDateFormat, null) == appointment.EndTime && entry.ProjectId == appointment.Category.ProjectId && entry.Description == appointment.Description;
public static bool IsConflictingWith(this Toggl.Api.DataObjects.TimeEntry entry, CategorizedAppointment appointment) { if (!entry.IsOverlappingWith(appointment.StartTime, appointment.EndTime)) { return(false); } else { return(!entry.IsEqualTo(appointment)); } }