public static IDateProjection CreateDateProjectionImpl(EDateProjectionType type) { switch (type) { case EDateProjectionType.Daily: return(new DailyProjection()); case EDateProjectionType.Weekly: return(new WeeklyProjection()); case EDateProjectionType.Monthly: return(new MonthlyProjection()); case EDateProjectionType.MonthlyRelative: return(new MonthlyRelativeProjection()); case EDateProjectionType.Yearly: return(new YearlyProjection()); case EDateProjectionType.YearlyRelative: return(new YearlyRelativeProjection()); default: throw new InvalidOperationException($"Unrecognized value ({type}) for the Date Projection type enum ({typeof(EDateProjectionType)})."); } }
public DateRecurrence(EDateProjectionType recurType, ERecurFromType recurFrom, int maxRecurrenceCount) : base(recurType) { this.MaxRecurrenceCount = maxRecurrenceCount; this.StartDate = DateTime.MinValue; this.EndDate = DateTime.MaxValue; this.RecurFromType = recurFrom; }
public static IDateProjection CreateDateProjectionImpl(EDateProjectionType newType, IDateProjection oldProjectionObj) { IDateProjection newProjectionObj = CreateDateProjectionImpl(newType); newProjectionObj.GetTranslator().PeriodCount = oldProjectionObj.GetTranslator().PeriodCount; newProjectionObj.GetTranslator().DaysOfWeekFlags = oldProjectionObj.GetTranslator().DaysOfWeekFlags; newProjectionObj.GetTranslator().DayOfMonth = oldProjectionObj.GetTranslator().DayOfMonth; newProjectionObj.GetTranslator().DaysOfWeekExt = oldProjectionObj.GetTranslator().DaysOfWeekExt; newProjectionObj.GetTranslator().WeeksInMonth = oldProjectionObj.GetTranslator().WeeksInMonth; newProjectionObj.GetTranslator().Month = oldProjectionObj.GetTranslator().Month; return(newProjectionObj); }
public DateRecurrence(EDateProjectionType recurType, ERecurFromType recurFrom, DateTime startDate, DateTime endDate) : base(recurType) { this.MaxRecurrenceCount = 0; this.StartDate = startDate; this.EndDate = endDate; if (this.StartDate > this.EndDate) { throw new ArgumentException($"Start date ({startDate}) is after the end date ({endDate})."); } this.RecurFromType = recurFrom; }
public DateProjection(EDateProjectionType recurType) { this.DateProjectionImpl = CreateDateProjectionImpl(recurType); }