Example #1
0
        public static string PrepareCronType(CronSelectorModel model)
        {
            switch (model.CronType)
            {
            case CronType.Daily:
                return(Cron.Daily(model.Hour, model.Minute));

            case CronType.Hourly:
                return(Cron.Hourly(model.Minute));

            case CronType.Minutely:
                return(Cron.Minutely());

            case CronType.Monthly:
                return(Cron.Monthly(model.Day, model.Hour, model.Minute));

            case CronType.Weekly:
                return(Cron.Weekly(DayOfWeek.Monday, model.Hour, model.Minute));

            case CronType.Yearly:
                return(Cron.Yearly(model.Month, model.Day, model.Hour, model.Minute));
            }

            return(string.Empty);
        }
Example #2
0
        private CronSelectorModel PrepareCronSelectorModel(SchedulerTaskRequest schedulerTaskRequest)
        {
            CronSelectorModel model = new CronSelectorModel()
            {
                CronType = (CronType)schedulerTaskRequest.CronTypeId,
                Day      = schedulerTaskRequest.Day,
                Hour     = schedulerTaskRequest.Hour,
                Minute   = schedulerTaskRequest.Minute,
                Month    = schedulerTaskRequest.Month
            };

            return(model);
        }