예제 #1
0
        /// <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);
        }
예제 #2
0
        private float GetPassedDays(DayInfo today)
        {
            float result = 0;

            TimeSpan upToNow = DateTime.Today.Subtract(StartDate);

            result = (float)upToNow.Days;

            result += today.GetTodaysPassedHours() / today.GetTodaysTotalHours();

            if (result < 0)
            {
                result = 0;
            }
            if (result > GetTotalDays())
            {
                result = GetTotalDays();
            }

            return(result);
        }