/// <summary>
        /// Return the human-friendly textual description of the sschedule pattern
        /// </summary>
        /// <returns></returns>
        public string GetTextualDescription()
        {
            StringBuilder sb = new StringBuilder();

            // daily pattern
            if (Times != null && Times.Count() > 0)
            {
                sb.Append("at ");
                bool fst = false;
                Times.ForEach(x => { sb.Append(string.Format("{0}{1}", fst ? ", " : " ", x.ToString())); fst = true; });
            }
            else
            {
                if (StartTime > startTimeDefault)
                {
                    sb.Append(string.Format("from {0} ", StartTime.ToString()));
                }
                if (StopTime < stopTimeDefault)
                {
                    sb.Append(string.Format("to {0} ", StopTime.ToString()));
                }
                if (DailyInterval > 0 && (DailyFrequency == RecurrenceFrequency.Secondly || DailyFrequency == RecurrenceFrequency.Minutely || DailyFrequency == RecurrenceFrequency.Hourly))
                {
                    sb.Append(string.Format(" every {0} {1}", DailyInterval.ToString(), DailyFrequency == RecurrenceFrequency.Hourly ? "hours" : (DailyFrequency == RecurrenceFrequency.Minutely ? "minutes" : "seconds")));
                }
            }

            // day/week/month pattern

            return(sb.ToString());
        }
Exemple #2
0
 public override string ToString()
 {
     return(string.Format("Course: {0}, Class: {1}, Instructors: {2}, Times: {3}, Dates: {4}", Course.CourseCode, Number, Instructors.Count(), Times.Count(), StartDate.ToString("yyyy-MM-dd") + " to " + EndDate.ToString("yyyy-MM-dd")));
 }