Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="type"></param>
        /// <param name="repeatType"></param>
        /// <param name="status"></param>
        /// <param name="enabled"></param>
        /// <param name="scope"></param>
        /// <param name="fromTime"></param>
        /// <param name="toTime"></param>
        /// <param name="order"></param>
        /// <param name="limit"></param>
        /// <returns></returns>
        public static List <SchedulerModel> GetAll(string keyword, int?type, SchedulerRepeatType?repeatType, SchedulerStatus?status, bool?enabled,
                                                   SchedulerScope?scope, DateTime?fromTime, DateTime?toTime, string order, int limit)
        {
            var entities = SchedulerServices.GetAll(keyword, type, repeatType, status, enabled, scope, fromTime, toTime, order, limit);

            return(entities.Select(e => new SchedulerModel(e)).ToList());
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>

        public async Task Execute(IJobExecutionContext context)
        {
            try
            {
                // init time
                var time = DateTime.Now.AddMinutes(1);

                // init to time
                var toTime = new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute, 0);

                // get ready scheduler
                var scheduler = SchedulerServices.GetAll(null, null, null, SchedulerStatus.Ready, true, SchedulerScope.Internal, null, toTime, null, 1).FirstOrDefault();
                if (scheduler != null)
                {
                    // run scheduler
                    await RunScheduler(scheduler);
                }
            }
            catch (Exception ex)
            {
                // create log
                var systemLog = new SystemLogModel
                {
                    Username         = "******",
                    Thread           = "JobScheduler",
                    Action           = SystemAction.TrackError,
                    ShortDescription = ex.Message,
                    LongDescription  = ex.ToString(),
                    IsException      = true,
                    CreatedDate      = DateTime.Now
                };

                // log exception
                SystemLogController.Create(systemLog);
            }
        }
Exemple #3
0
 protected void storeScheduler_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
 {
     storeScheduler.DataSource = SchedulerServices.GetAll();
     storeScheduler.DataBind();
 }