コード例 #1
0
 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);
 }
コード例 #2
0
 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;
コード例 #3
0
 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));
     }
 }