Пример #1
0
        public static HfUserRecurringJobModel ToDomainModel(this HfUserRecurringJob data)
        {
            var model = new HfUserRecurringJobModel()
            {
                //JobType = data.HfUserJob.JobType,
                CreatedOn          = data.HfUserJob.CreatedOn,
                Name               = data.HfUserJob.Name,
                Note               = data.HfUserJob.Note,
                Status             = data.HfUserJob.Status,
                TimeZoneId         = data.HfUserJob.TimeZoneId,
                UpdatedOn          = data.HfUserJob.UpdatedOn,
                UserId             = data.HfUserJob.UserId,
                WorkDataId         = data.HfUserJob.WorkDataId,
                WorkerClassName    = data.HfUserJob.WorkerClassName,
                WorkerAssemblyName = data.HfUserJob.WorkerAssemblyName,
                Id      = data.HfUserJob.Id,
                HfJobId = data.HfUserJob.HfJobId
            };

            model.HfUserRecurringJobModelId = data.Id;
            model.CronExpression            = data.CronExpression;
            model.NextRun     = data.NextRun;
            model.LastRun     = data.LastRun;
            model.LastHfJobId = data.LastHfJobId;
            return(model);
        }
        private async Task <HfUserRecurringJobModel> CreateRecurring(HfUserRecurringJobModel data)
        {
            using (var db = _ctxGenerator.GenerateNewContext())
            {
                var dbModel = data.ToDbModel();
                await db.HfUserRecurringJob.AddAsync(dbModel);

                await db.SaveChangesAsync();

                return(dbModel.ToDomainModel());
            }
        }
Пример #3
0
 public static HfUserRecurringJob ToDbModel(this HfUserRecurringJobModel model)
 {
     return(new HfUserRecurringJob()
     {
         Id = model.HfUserRecurringJobModelId,
         HfUserJob = (model as HfUserJobModel).ToDbModel(),
         CronExpression = model.CronExpression,
         LastHfJobId = model.LastHfJobId,
         LastRun = model.LastRun,
         NextRun = model.NextRun
     });
 }
Пример #4
0
        public async Task <ActionResult> CreateRecurring()
        {
            var options2 = new HfUserRecurringJobModel()
            {
                Name               = "Tst recurring",
                Note               = "Test Note",
                UserId             = "1111",
                WorkerClassName    = "Exico.HF.Common.Worker.Test.ITestDownloadWorker",
                WorkerAssemblyName = "Exico.HF.Common",
                TimeZoneId         = "Eastern Standard Time",
                Status             = Exico.HF.Common.Enums.JobStatus.None,
                WorkDataId         = 12,
                CronExpression     = Cron.MinuteInterval(1)
            };

            var data = await _jm.Create(options2);

            return(View("Index"));
        }
 public Task <HfUserRecurringJobModel> UpdateRecurring(HfUserRecurringJobModel data)
 {
     throw new NotImplementedException();
 }