private static void ProceedRecurringScheduleToDal(RecurringSchedule item, ArticleScheduleDAL result) { result.ActiveStartDate = ScheduleHelper.GetSqlValuesFromScheduleDate(item.RepetitionStartDate); result.ActiveStartTime = ScheduleHelper.GetSqlValuesFromScheduleTime(item.ShowStartTime); var repetitionEndDate = item.RepetitionNoEnd ? ArticleScheduleConstants.Infinity.Date : item.RepetitionEndDate; var repetitionEndTime = item.ShowLimitationType == ShowLimitationType.Duration ? ArticleScheduleConstants.Infinity.TimeOfDay : item.ShowEndTime; result.ActiveEndDate = ScheduleHelper.GetSqlValuesFromScheduleDate(repetitionEndDate); result.ActiveEndTime = ScheduleHelper.GetSqlValuesFromScheduleTime(repetitionEndTime); result.UseDuration = item.ShowLimitationType == ShowLimitationType.Duration ? 1 : 0; result.Duration = Convert.ToDecimal(item.DurationValue); result.DurationUnits = item.DurationUnit.ToDbValue(); if (item.ScheduleRecurringType == ScheduleRecurringType.Daily) { result.FreqInterval = item.ScheduleRecurringValue; } else if (item.ScheduleRecurringType == ScheduleRecurringType.Weekly) { result.FreqRecurrenceFactor = item.ScheduleRecurringValue; result.FreqInterval = 0; if (item.OnSunday) { result.FreqInterval = result.FreqInterval | 1; } if (item.OnMonday) { result.FreqInterval = result.FreqInterval | 2; } if (item.OnTuesday) { result.FreqInterval = result.FreqInterval | 4; } if (item.OnWednesday) { result.FreqInterval = result.FreqInterval | 8; } if (item.OnThursday) { result.FreqInterval = result.FreqInterval | 16; } if (item.OnFriday) { result.FreqInterval = result.FreqInterval | 32; } if (item.OnSaturday) { result.FreqInterval = result.FreqInterval | 64; } } else if (item.ScheduleRecurringType == ScheduleRecurringType.Monthly || item.ScheduleRecurringType == ScheduleRecurringType.Yearly) { if (item.ScheduleRecurringType == ScheduleRecurringType.Yearly) { result.FreqRecurrenceFactor = item.ScheduleRecurringValue * 12; var dt = new DateTime(item.RepetitionStartDate.Year, item.Month, 1); if (dt < DateTime.Now.Date) { dt = dt.AddYears(1); } result.ActiveStartDate = ScheduleHelper.GetSqlValuesFromScheduleDate(dt); } else if (item.ScheduleRecurringType == ScheduleRecurringType.Monthly) { result.FreqRecurrenceFactor = item.ScheduleRecurringValue; } if (item.DaySpecifyingType == DaySpecifyingType.Date) // Month { result.FreqInterval = item.DayOfMonth; } else if (item.DaySpecifyingType == DaySpecifyingType.DayOfWeek) // MonthRelative { result.FreqRelativeInterval = (int)item.WeekOfMonth; result.FreqInterval = (int)item.DayOfWeek; } } }