Exemple #1
0
        public void SaveScheduleSettings(long templateNodeId, Job job)
        {
            ScheduleSettingsRow row = this.CreateRow(templateNodeId, job);

            this._currentStorage.ScheduleSettingsTable.InsertOrUpdateRowForSure(row);

            Cache.Remove(GetCacheKey(templateNodeId));
        }
Exemple #2
0
        private TemplateNodeUpdateJob CreateJob(ScheduleSettingsRow row, TemplateNodeInfo node)
        {
            var scheduleSettings = new ScheduleSettings
            {
                ActiveWeekDays = row.ActiveWeekDays
                                 .Split(',')
                                 .Select(
                    s =>
                {
                    DayOfWeek result;

                    if (Enum.TryParse(s, out result))
                    {
                        return(result as DayOfWeek?);
                    }

                    return(null);
                })
                                 .Where(d => d != null)
                                 .Select(d => d.Value).ToList(),
                Enabled                   = row.Enabled,
                Id                        = row.TemplateNodesScheduleUserId,
                Name                      = row.TemplateNodesScheduleUserName,
                IsSendMessage             = row.IsSendMessage,
                EndDate                   = row.EndDate.GetValueOrDefault(),
                OccursOnceDateTime        = row.OccursOnceDateTime,
                OccursOnceDateTimeEnabled = row.OccursOnceDateTimeEnabled,
                StartDate                 = row.StartDate,
                DayOfMonth                = new DayOfMonthSettings
                {
                    DayNumber = (int)row.DayNumber
                },
                ReccurPeriod = new TimeUnitBasedPeriod(
                    (ReccurPeriodTimeUnit)row.TimeUnit,
                    (int)row.TimeUnitCount),
                DailyFrequency =
                    new DailyFrequency
                {
                    EndingAt       = row.EndingAt.FromTicks(),
                    OccursOnceTime = row.OccursOnceTime.FromTicks(),
                    PeriodTimeUnit = row.PeriodTimeUnit.HasValue
                                                                ? (DailyFrequency.TimeUnit?)row.PeriodTimeUnit.Value
                                     : null,
                    PeriodTimeUnitCount = (int?)row.PeriodTimeUnitCount,
                    StartingAt          = row.StartingAt.FromTicks(),
                    OccursOnce          = row.OccursOnce
                },
                HasEndDate = row.EndDate.HasValue
            };

            return(new TemplateNodeUpdateJob
            {
                LastRan = row.LastRan,
                Settings = scheduleSettings,
                NodeInfo = node,
                SettingsId = row.Identity
            });
        }