Beispiel #1
0
        public void Save(ScheduledJob job, RepeatInfo info = null)
        {
            var db = _connectionBuilder();

            if (job.Id == 0)
            {
                Queries.InsertJob(db, _dialect, job);
            }
            else
            {
                job.UpdatedAt = DateTime.Now;
                Queries.UpdateJob(db, job);
            }

            var existing = Queries.GetRepeatInfo(db, job);

            if (existing == null)
            {
                Queries.InsertRepeatInfo(db, _dialect, job, info);
            }
            else
            {
                Queries.UpdateRepeatInfo(db, _dialect, job, info);
            }
        }
Beispiel #2
0
        public static RepeatInfo GetRepeatInfo(IDbConnection db, ScheduledJob job)
        {
            var result = db.Query("SELECT * FROM RepeatInfo WHERE ScheduledJobId = @Id", job).SingleOrDefault();

            if (result == null)
            {
                return(null);
            }
            var repeatInfo = new RepeatInfo(result.Start, new DatePeriod(result.PeriodFrequency, result.PeriodQuantifier));

            return(repeatInfo);
        }
        public void Save(ScheduledJob job, RepeatInfo info = null)
        {
            var db = _connectionBuilder();
            if(job.Id == 0)
            {
                Queries.InsertJob(db, _dialect, job);
            }
            else
            {
                job.UpdatedAt = DateTime.Now;
                Queries.UpdateJob(db, job);
            }

            var existing = Queries.GetRepeatInfo(db, job);
            if(existing == null)
            {
                Queries.InsertRepeatInfo(db, _dialect, job, info);
            }
            else
            {
                Queries.UpdateRepeatInfo(db, _dialect, job, info);
            }
        }
Beispiel #4
0
        public static void UpdateRepeatInfo(IDbConnection db, DatabaseDialect dialect, ScheduledJob job, RepeatInfo info)
        {
            const string sql = "UPDATE RepeatInfo SET " +
                               "PeriodFrequency = @PeriodFrequency, " +
                               "PeriodQuantifier = @PeriodQuantifier, " +
                               "Start = @Start, " +
                               "IncludeWeekends = @IncludeWeekends " +
                               "WHERE ScheduledJobId = @ScheduledJobId;";

            db.Execute(sql, new
            {
                ScheduledJobId = job.Id,
                info.PeriodFrequency,
                info.PeriodQuantifier,
                info.Start,
                info.IncludeWeekends
            });
        }
Beispiel #5
0
        public static void InsertRepeatInfo(IDbConnection db, DatabaseDialect dialect, ScheduledJob job, RepeatInfo info)
        {
            const string sql = "INSERT INTO RepeatInfo " +
                               "(ScheduledJobId, PeriodFrequency, PeriodQuantifier, Start, IncludeWeekends) " +
                               "VALUES (@ScheduledJobId, @PeriodFrequency, @PeriodQuantifier, @Start, @IncludeWeekends);";

            db.Execute(sql, new
            {
                ScheduledJobId = job.Id,
                info.PeriodFrequency,
                info.PeriodQuantifier,
                info.Start,
                info.IncludeWeekends
            });
        }
Beispiel #6
0
 public static RepeatInfo GetRepeatInfo(IDbConnection db, ScheduledJob job)
 {
     var result = db.Query("SELECT * FROM RepeatInfo WHERE ScheduledJobId = @Id", job).SingleOrDefault();
     if (result == null) return null;
     var repeatInfo = new RepeatInfo(result.Start, new DatePeriod(result.PeriodFrequency, result.PeriodQuantifier));
     return repeatInfo;
 }
Beispiel #7
0
        public static void UpdateRepeatInfo(IDbConnection db, DatabaseDialect dialect, ScheduledJob job, RepeatInfo info)
        {
            const string sql = "UPDATE RepeatInfo SET " +
                               "PeriodFrequency = @PeriodFrequency, " +
                               "PeriodQuantifier = @PeriodQuantifier, " +
                               "Start = @Start, " +
                               "IncludeWeekends = @IncludeWeekends " +
                               "WHERE ScheduledJobId = @ScheduledJobId;";

            db.Execute(sql, new
            {
                ScheduledJobId = job.Id,
                info.PeriodFrequency,
                info.PeriodQuantifier,
                info.Start,
                info.IncludeWeekends
            });
        }
Beispiel #8
0
        public static void InsertRepeatInfo(IDbConnection db, DatabaseDialect dialect, ScheduledJob job, RepeatInfo info)
        {
            const string sql = "INSERT INTO RepeatInfo " +
                               "(ScheduledJobId, PeriodFrequency, PeriodQuantifier, Start, IncludeWeekends) " +
                               "VALUES (@ScheduledJobId, @PeriodFrequency, @PeriodQuantifier, @Start, @IncludeWeekends);";

            db.Execute(sql, new
            {
                ScheduledJobId = job.Id,
                info.PeriodFrequency,
                info.PeriodQuantifier,
                info.Start,
                info.IncludeWeekends
            });
        }
Beispiel #9
0
 public For(RepeatInfo info, int count)
 {
     _info  = info;
     _count = count;
 }
Beispiel #10
0
 public For(RepeatInfo info, int count)
 {
     _info = info;
     _count = count;
 }