public int GetNumberOfDaysLeft() { if (IsCompletable) { TimeSpan ts = DueDate.Subtract(DateTime.Today); return((int)ts.TotalDays); } else { return(int.MaxValue); } }
public Item(int id, string title, string description, DateTime createdate) { Id = id; Title = title; Description = description; CreateDate = createdate; ModifyDate = DateTime.Now; DueDate = DateTime.Now; Range = DueDate.Subtract(CreateDate); Priority = 1; StatusId = Status.Draft; IsArchived = false; }
private float GetTotalDays() { float result = 0; TimeSpan allSpan = DueDate.Subtract(StartDate); result = (float)allSpan.TotalDays + 1; if (result < 0) { result = 0; } return(result); }
/// <summary> /// Number of days remaining to "due date". /// </summary> /// <returns>Number of days</returns> public float GetRemainingDays(DayInfo today) { float result = 0; TimeSpan leftDays = DueDate.Subtract(DateTime.Today); result = (float)leftDays.Days; result += (today.GetTodaysTotalHours() - today.GetTodaysPassedHours()) / today.GetTodaysTotalHours(); if (result < 0) { result = 0; } if (result > GetTotalDays()) { result = GetTotalDays(); } return(result); }
public int GetTotalDays() { TimeSpan ts = DueDate.Subtract(StartDate); return((int)ts.TotalDays); }
public int getDaysRemaining(DateTime?tester = null) { DateTime dateTime = tester == null ? DateTime.Today : tester.Value; return((int)(DueDate.Subtract(dateTime)).TotalDays); }