예제 #1
0
        private void MasterTemplate_CellDoubleClick(object sender, GridViewCellEventArgs e)
        {
            //btnSave_Click(null, null);
            try
            {
                if (e.RowIndex > -1)
                {
                    if (screen.Equals(1))
                    {
                        JobCard_tt.Text     = Convert.ToString(e.Row.Cells["JobCard"].Value);
                        TempJobCard_tt.Text = Convert.ToString(e.Row.Cells["TempJobCard"].Value);
                        Unit_tt.Text        = Convert.ToString(e.Row.Cells["Unit"].Value);
                        Qty_tt.Text         = Convert.ToString(e.Row.Cells["Qty"].Value);


                        //JobCard_tt.Text = Convert.ToString(e.Row.Cells["JobCard"].Value);
                        //TempJobCard_tt.Text = Convert.ToString(e.Row.Cells["TempJobCard"].Value);
                        this.Close();
                    }
                    else
                    {
                        CreateJob a = new CreateJob(Convert.ToString(e.Row.Cells["JobCard"].Value),
                                                    Convert.ToString(e.Row.Cells["TempJobCard"].Value));
                        a.ShowDialog();
                        //this.Close();
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
예제 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (screen.Equals(1))
                {
                    if (dgvData.Rows.Count > 0)
                    {
                        JobCard_tt.Text     = Convert.ToString(dgvData.CurrentRow.Cells["JobCard"].Value);
                        TempJobCard_tt.Text = Convert.ToString(dgvData.CurrentRow.Cells["TempJobCard"].Value);
                        Unit_tt.Text        = Convert.ToString(dgvData.CurrentRow.Cells["Unit"].Value);
                        Qty_tt.Text         = Convert.ToString(dgvData.CurrentRow.Cells["Qty"].Value);

                        this.Close();
                    }
                }
                else
                {
                    CreateJob a = new CreateJob();
                    a.ShowDialog();
                    //CreateJob a = new CreateJob(Convert.ToString(dgvData.CurrentRow.Cells["JobCard"].Value),
                    //    Convert.ToString(dgvData.CurrentRow.Cells["TempJobCard"].Value));
                    //a.ShowDialog();
                    //this.Close();
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
예제 #3
0
        private void CreateGtdCancelBackup(Order order)
        {
            if (!order.ExpireTime.HasValue)
            {
                // This should "never happen"
                this.Logger.LogError(
                    LogId.Trading,
                    $"Cannot schedule backup CancelOrder (no expire time set for GTD order {order.Id}).");

                return;
            }

            var traderId = this.database.GetTraderId(order.Id);

            if (traderId is null)
            {
                // This should never happen
                this.Logger.LogError(
                    LogId.Database,
                    $"Cannot schedule backup CancelOrder command (cannot find TraderId for {order.Id}).");
                return;
            }

            var accountId = this.database.GetAccountId(order.Id);

            if (accountId is null)
            {
                // This should "never happen"
                this.Logger.LogError(
                    LogId.Database,
                    $"Cannot schedule backup CancelOrder command (cannot find AccountId for {order.Id}).");
                return;
            }

            var cancelOrder = new CancelOrder(
                traderId,
                accountId,
                order.Id,
                this.NewGuid(),
                order.ExpireTime.Value);

            var jobKey  = new JobKey($"{nameof(CancelOrder)}-{order.Id.Value}", "OMS");
            var trigger = TriggerBuilder
                          .Create()
                          .WithIdentity(jobKey.Name, jobKey.Group)
                          .StartAt(order.ExpireTime.Value.ToDateTimeUtc())
                          .Build();

            var createJob = new CreateJob(
                this.Endpoint,
                cancelOrder,
                jobKey,
                trigger,
                this.NewGuid(),
                this.TimeNow());

            this.cancelJobs.Add(order.Id, jobKey);

            this.Send(createJob, ComponentAddress.Scheduler);
        }
예제 #4
0
        public async Task <IActionResult> ConfigureJobProvider(CreateJobProviderModel model)
        {
            CreateJob createJob = HttpContext.Session.GetObject <CreateJob>(JOB_STORAGE_KEY);

            if (createJob == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (ModelState.IsValid)
            {
                createJob.Providers.Add(model);
                HttpContext.Session.SetObject(JOB_STORAGE_KEY, createJob);

                int nextIndex = model.CurrentIndex + 1;
                if (nextIndex >= createJob.ProviderIDs.Length)
                {
                    await SaveJob(createJob);

                    HttpContext.Session.Clear();

                    return(RedirectToAction("Index"));
                }
                else
                {
                    int?nextId = await providerRepository.GetInstanceID(createJob.Base.ID, nextIndex);

                    return(RedirectToAction("ConfigureJobProvider", new { index = nextIndex, id = nextId }));
                }
            }

            return(View(model));
        }
예제 #5
0
 protected virtual void CreateJobCommand(CreateJob createJob)
 {
     ActorTaskScheduler.RunTask(async() =>
     {
         if (createJob.To == null)
         {
             Context.Sender.Tell(new CreateJobFail(null, null, new ArgumentNullException(nameof(createJob.To))));
         }
         if (createJob.Trigger == null)
         {
             Context.Sender.Tell(new CreateJobFail(null, null, new ArgumentNullException(nameof(createJob.Trigger))));
         }
         else
         {
             try
             {
                 var job =
                     QuartzJob.CreateBuilderWithData(createJob.To, createJob.Message)
                     .WithIdentity(createJob.Trigger.JobKey)
                     .Build();
                 await Scheduler.ScheduleJob(job, createJob.Trigger);
                 Context.Sender.Tell(new JobCreated(createJob.Trigger.JobKey, createJob.Trigger.Key));
             }
             catch (Exception ex)
             {
                 Context.Sender.Tell(new CreateJobFail(createJob.Trigger.JobKey, createJob.Trigger.Key, ex));
             }
         }
     });
 }
예제 #6
0
        private static void Jobs(OAuthAuthenticationStrategy auth)
        {
            var jobApiClient = new JobApiClient(auth, projectId);

            foreach (var job in jobApiClient.Get("ApiSample", new List <string>()
            {
                "AWAITING_AUTHORIZATION", "IN_PROGRESS", "IN_PROGRESS"
            }))
            {
                Console.WriteLine(job.jobName);
            }

            var jobRequest = new CreateJob();

            jobRequest.jobName         = "ApiSample_Job_" + Guid.NewGuid();
            jobRequest.description     = "test";
            jobRequest.dueDate         = DateTime.Now.AddMonths(1).ToString("yyyy-MM-ddTHH:mm:ssZ");
            jobRequest.targetLocaleIds = new List <string>()
            {
                "ru-RU"
            };
            jobRequest.callbackUrl     = "https://www.callback.com/smartling/job";
            jobRequest.callbackMethod  = "GET";
            jobRequest.referenceNumber = "test";

            var createdJob = jobApiClient.Create(jobRequest);

            createdJob = jobApiClient.GetById(createdJob.translationJobUid);

            var jobs      = jobApiClient.Get();
            var processes = jobApiClient.GetProcesses(jobs.First().translationJobUid);

            var updateJob = new UpdateJob();

            updateJob.jobName     = jobRequest.jobName;
            updateJob.description = "test2";
            updateJob.dueDate     = DateTime.Now.AddMonths(1).ToString("yyyy-MM-ddTHH:mm:ssZ");
            var updatedJob = jobApiClient.Update(updateJob, jobs.First().translationJobUid);

            jobs = jobApiClient.Get();
            jobApiClient.AddLocale("nl-NL", jobs.First().translationJobUid);

            var batchApiClient = new BatchApiClient(auth, projectId, String.Empty);
            var batch          =
                batchApiClient.Create(new CreateBatch()
            {
                authorize         = true,
                translationJobUid = jobs.First().translationJobUid
            });

            string filePath = "ApiSample_" + Guid.NewGuid();
            string fileUri  = "/master/" + filePath;

            batchApiClient.UploadFile(new BatchUpload.Builder().CreateUpload(@"C:\Sample.xml", fileUri, "xml", new List <string> {
                "ru-RU"
            }, batch.batchUid).WithNameSpace(filePath));
            batchApiClient.Execute(batch.batchUid);

            var batchResult = batchApiClient.Get(batch.batchUid);
        }
예제 #7
0
        private void CreateDisconnectFixJob()
        {
            var schedule = CronScheduleBuilder
                           .WeeklyOnDayAndHourAndMinute(
                this.disconnectWeeklyTime.DayOfWeek.ToDayOfWeek(),
                this.disconnectWeeklyTime.Time.Hour,
                this.disconnectWeeklyTime.Time.Minute)
                           .InTimeZone(TimeZoneInfo.Utc)
                           .WithMisfireHandlingInstructionFireAndProceed();

            var jobKey  = new JobKey("session-disconnect", "service");
            var trigger = TriggerBuilder
                          .Create()
                          .WithIdentity(jobKey.Name, jobKey.Group)
                          .WithSchedule(schedule)
                          .Build();

            var createJob = new CreateJob(
                this.Endpoint,
                new DisconnectSession(this.NewGuid(), this.TimeNow()),
                jobKey,
                trigger,
                this.NewGuid(),
                this.TimeNow());

            this.Send(createJob, new Address(nameof(Scheduler)));
            this.Logger.LogInformation(
                LogId.Component,
                $"Created {nameof(DisconnectSession)} for " +
                $"{this.disconnectWeeklyTime.DayOfWeek.ToDayOfWeek()}s " +
                $"{this.disconnectWeeklyTime.Time.Hour:D2}:" +
                $"{this.disconnectWeeklyTime.Time.Minute:D2} UTC.");
        }
예제 #8
0
        internal void Test_can_create_job_and_send_message_based_on_quartz_trigger()
        {
            // Arrange
            var schedule = SimpleScheduleBuilder
                           .RepeatSecondlyForTotalCount(1)
                           .WithMisfireHandlingInstructionFireNow();

            var jobKey  = new JobKey("unit-test-job", "unit-testing");
            var trigger = TriggerBuilder
                          .Create()
                          .WithIdentity(jobKey.Name, jobKey.Group)
                          .WithSchedule(schedule)
                          .Build();

            var createJob = new CreateJob(
                this.receiver,
                new ConnectSession(Guid.NewGuid(), this.clock.TimeNow()),
                jobKey,
                trigger,
                Guid.NewGuid(),
                this.clock.TimeNow());

            // Act
            this.scheduler.Endpoint.Send(createJob);

            // Assert
            // TODO: Write assertions
        }
예제 #9
0
        static void Main(string[] args)
        {
            CreateJob  cjJob      = new CreateJob();
            UploadFile uploadFile = new UploadFile();
            Verify     verify     = new Verify();

            cjJob.StepEmulate.Add("CreateJob:01 Step");
            cjJob.StepEmulate.Add("CreateJob:02 Step");
            cjJob.StepEmulate.Add("CreateJob:Finished");

            uploadFile.StepEmulate.Add("uploadFile:01 Step");
            uploadFile.StepEmulate.Add("uploadFile:02 Step");
            uploadFile.StepEmulate.Add("uploadFile:Finished");

            verify.StepEmulate.Add("verify:01 Step");
            verify.StepEmulate.Add("verify:02 Step");
            verify.StepEmulate.Add("verify:Finished");

            Workflow_Engine wfEngine = new Workflow_Engine();

            wfEngine.TheWorkFlows.Add(cjJob);
            wfEngine.TheWorkFlows.Add(uploadFile);
            wfEngine.TheWorkFlows.Add(verify);

            wfEngine.Run();
            Console.WriteLine();
        }
예제 #10
0
        public virtual Model.Job Create(CreateJob job)
        {
            var uriBuilder = this.GetRequestStringBuilder(string.Format(CreateJobUrl, projectId));
            var response   = ExecutePostRequest(uriBuilder, job, auth);

            return(JsonConvert.DeserializeObject <Model.Job>(response["response"]["data"].ToString()));
        }
예제 #11
0
        public void CreateJob_Action_Fails()
        {
            // Arrange
            var jobDto = TestHelper.JobDto();

            GenericServiceResponse <bool> fakeResponse = null;

            mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable();
            mockClientServicesProvider.Setup(x => x.JobService.CreateJob(jobDto)).Returns(fakeResponse).Verifiable();

            var viewModel = new GenericViewModel();

            var action = new CreateJob <GenericViewModel>(mockClientServicesProvider.Object)
            {
                OnComplete = model => viewModel = model
            };

            // Act
            var result = action.Invoke(jobDto);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(GenericViewModel));
            Assert.IsNotNull(result.Notifications);
            Assert.IsInstanceOfType(result.Notifications, typeof(NotificationCollection));
            Assert.IsTrue(result.Notifications.Count() == 1);
            Assert.IsTrue(result.HasErrors);
            Assert.IsNotNull(result.Success);
            Assert.IsInstanceOfType(result.Success, typeof(bool));
            Assert.IsFalse(result.Success);
        }
예제 #12
0
        private static void Main(string[] args)
        {
            //WORKS
            CreateJob.Run();
            //CreateS3Job.Run();
            //CreateSprite.Run();
            //CreateFTPJob.Run();
            //CreateHevcJob.Run();
            //CreateAsperaJob.Run();
            //CreateVttMpdked.Run();
            //CreateThumbnail.Run();
            //CreateWidevineDRMJob.Run();
            //CreatePlayreadyDRMJob.Run();
            //CreateCroppedVideoJob.Run();
            //CreateRotationVideoJob.Run();
            //CreateDeinterlacingJob.Run();
            //CreateWatermarkedVideoJob.Run();
            //CreateMultiAudioStreamJob.Run();
            //CreateChangedFrameSampleRateJob.Run();
            //CreateVideoJobWithDifferentSegmentLength.Run();

            //BAD REQUEST
            //CreateAzureJob.Run(); //Create Inpute //might be because the file doesn't exit anymore

            //ERRORS
            //CreateJobWithStartTime.Run(); //Error during transcoding // jobConfig.StartTime = 90;
            //CreateGCSJob.Run(); //Error during transcoding // jobConfig.StartTime = 90;

            Console.ReadLine();
        }
        public ActionResult DeleteConfirmed(int id)
        {
            CreateJob createJob = db.createJobs.Find(id);

            db.createJobs.Remove(createJob);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #14
0
        async Task <IJobSession> IClient.CreateJob(JobCreationDetails details)
        {
            var req  = new CreateJob(details);
            var resp = await _service.Execute(req);

            var jobId = resp.JobId;

            return(new JobSession(_service, jobId));
        }
 public ActionResult Edit([Bind(Include = "ID,TaskName,TaskDescription,TaskHelpers")] CreateJob createJob)
 {
     if (ModelState.IsValid)
     {
         db.Entry(createJob).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(createJob));
 }
        public ActionResult Create([Bind(Include = "ID,TaskName,TaskDescription,TaskHelpers")] CreateJob createJob)
        {
            if (ModelState.IsValid)
            {
                db.createJobs.Add(createJob);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(createJob));
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CreateJob createJob = db.createJobs.Find(id);

            if (createJob == null)
            {
                return(HttpNotFound());
            }
            return(View(createJob));
        }
예제 #18
0
파일: Program.cs 프로젝트: zxxc/api-sdk-net
        private static void Jobs(OAuthAuthenticationStrategy auth)
        {
            var jobApiClient = new JobApiClient(auth, projectId);

            foreach (var job in jobApiClient.Get("ApiSample").items)
            {
                Console.WriteLine(job.jobName);
            }

            var jobRequest = new CreateJob();

            jobRequest.jobName         = "ApiSample_Job_" + Guid.NewGuid();
            jobRequest.description     = "test";
            jobRequest.dueDate         = "2018-11-21T11:51:17Z";
            jobRequest.targetLocaleIds = new List <string>()
            {
                "ru-RU"
            };
            jobRequest.callbackUrl     = "https://www.callback.com/smartling/job";
            jobRequest.callbackMethod  = "GET";
            jobRequest.referenceNumber = "test";

            jobApiClient.Create(jobRequest);
            var jobs      = jobApiClient.GetAll();
            var processes = jobApiClient.GetProcesses(jobs.items.First().translationJobUid);

            var updateJob = new UpdateJob();

            updateJob.jobName     = jobRequest.jobName;
            updateJob.description = "test2";
            updateJob.dueDate     = "2018-11-21T11:51:17Z";
            jobApiClient.Update(updateJob, jobs.items.First().translationJobUid);
            jobs = jobApiClient.GetAll();
            jobApiClient.AddLocale("nl-NL", jobs.items.First().translationJobUid);

            var batchApiClient = new BatchApiClient(auth, projectId, String.Empty);
            var batch          =
                batchApiClient.Create(new CreateBatch()
            {
                authorize         = true,
                translationJobUid = jobs.items.First().translationJobUid
            });

            string fileUri = "ApiSample_" + Guid.NewGuid();

            batchApiClient.UploadFile(@"C:\Sample.xml", fileUri, "xml", "ru-RU", true, batch.batchUid);
            batchApiClient.Execute(batch.batchUid);

            var batchResult = batchApiClient.Get(batch.batchUid);
        }
예제 #19
0
        public async Task <IActionResult> Configure(CreateJobModel model)
        {
            if (ModelState.IsValid)
            {
                CreateJob createJob = new CreateJob {
                    Base = model
                };
                HttpContext.Session.SetObject(JOB_STORAGE_KEY, createJob);

                int?firstProvider = await providerRepository.GetInstanceID(model.ID, 0);

                return(RedirectToAction("ConfigureJobProvider", new { id = firstProvider }));
            }

            return(View(model));
        }
예제 #20
0
        public void WhenICreateTheFollowingJobForCar(string registration, Table table)
        {
            var values = table.Rows.Single();

            _uiViewInfo = new JobUiViewInfo(
                registration,
                values["Description"],
                values.GetDate("Date"),
                values.GetDecimal("Hours"),
                values.GetInt("Mileage"));

            _actor.AttemptsTo(
                CreateJob.WithDescription(_uiViewInfo.Description)
                .OnDate(_uiViewInfo.Date)
                .TakingHours(_uiViewInfo.Hours)
                .AtMileage(_uiViewInfo.Mileage));
        }
예제 #21
0
        private void OnMessage(CreateJob message)
        {
            if (this.quartzScheduler.CheckExists(message.JobKey).Result)
            {
                this.Logger.LogError(LogId.Component, $"Job create failed (JobKey={message.JobKey}, Reason=DuplicateJobKey).");
                return;
            }

            var create = this.quartzScheduler.ScheduleJob(message.JobDetail, message.Trigger);

            if (create.IsCompletedSuccessfully)
            {
                this.Logger.LogInformation(LogId.Component, $"Job created (JobKey={message.JobKey}, TriggerKey={message.Trigger.Key}).");
            }
            else
            {
                this.Logger.LogError(LogId.Component, $"Job create failed (JobKey={message.JobKey}, Reason=Unknown).");
            }
        }
예제 #22
0
        public void TestMethod1()
        {
            IEventAggregator          events     = new EventAggregator();
            EventStore                store      = new EventStore(events);
            Repository <SchedulerJob> repository = new Repository <SchedulerJob>(store);

            //SchedulerService service = new SchedulerServiceBuilder()
            //    .WithEventAggregator(events)
            //    .WithEventStore(store)
            //    .WithJobRepository(repository);

            events.Subscribe(new SchedulerJobCommandHandlers(repository));

            FakeDatabase readModel = new FakeDatabase();

            events.Subscribe(readModel);

            CreateJob cmd1 = new CreateJob(Guid.NewGuid());

            events.Publish <CreateJob>(cmd1);

            AddTaskToJob <FakeTaskInfo> cmd2 = new AddTaskToJob <FakeTaskInfo>(
                1, // HACK: Why do I have to pass version to avoid concurrency exception?
                cmd1.JobId,
                Guid.NewGuid(),
                SchedulerTaskState.Disabled,
                SchedulerTaskState.Disabled,
                DateTime.Now.Add(TimeSpan.FromMinutes(10)),
                new FakeTaskInfo(Guid.NewGuid()));

            events.Publish <AddTaskToJob>(cmd2);

            //UpdateTaskContent<string> cmd3 = new UpdateTaskContent<string>(cmd1.JobId, cmd2.TaskId, "hello");
            //events.Publish<UpdateTaskContent>(cmd3);

            Assert.AreEqual <int>(1, readModel.Jobs.Count);
            Assert.AreEqual <Guid>(cmd1.JobId, readModel.Jobs[0].JobId);
            Assert.AreEqual <int>(1, readModel.TasksAdded.Count);
            Assert.AreEqual <Guid>(cmd2.TaskId, readModel.TasksAdded[0].TaskId);
        }
예제 #23
0
        public async Task <IActionResult> ConfigureJobProvider(int index = 0, int id = 0)
        {
            CreateJob createJob = HttpContext.Session.GetObject <CreateJob>(JOB_STORAGE_KEY);

            if (createJob == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            CreateJobProviderModel model = null;

            Provider provider = await providerRepository.Get(createJob.ProviderIDs[index]);

            Dictionary <int, object> values = new Dictionary <int, object>();

            if (id > 0)
            {
                model    = CreateModel <ModifyJobProviderModel>("Modify Schedule");
                model.ID = id;

                IEnumerable <ProviderInstanceProperty> propertyValues = await providerRepository.GetProviderValues(id);

                foreach (ProviderInstanceProperty propertyValue in propertyValues)
                {
                    object parsedValue = await providerMappingService.GetPresentationValue(propertyValue);

                    values.Add(propertyValue.Property.ID, parsedValue);
                }
            }
            else
            {
                model = CreateModel <CreateJobProviderModel>("Create Schedule");
            }

            model.CurrentIndex = index;
            model.ProviderName = provider.Name;
            model.Properties   = provider.Properties.Select(x => new ProviderPropertyModel(x.Name, x.Description, providerMappingService.GetTemplateFromType(x.Type), values.ContainsKey(x.ID) ? values[x.ID] : null, x.Attributes?.ToDictionary(k => k.Name.ToString(), v => v.Value))).ToList();

            return(View(model));
        }
예제 #24
0
        public void Can_Generate_CreateSql_ForJob()
        {
            const string expectedSql = @"
                INSERT INTO [dbo].[Job]
                (
                    [dbo].[Job].[OrganizationId],
                    [dbo].[Job].[JobStatusId],
                    [dbo].[Job].[Code],
                    [dbo].[Job].[ShortDescription],
                    [dbo].[Job].[LongDescription],
                    [dbo].[Job].[CustomerId],
                    [dbo].[Job].[StartDate],
                    [dbo].[Job].[EndDate],
                    [dbo].[Job].[DueDate]
                VALUES
                (
                    @organizationid,@jobstatusid,@code,@shortdescription,@longdescription,@customerid,@startdate,@enddate,@duedate
                )
                SELECT SCOPE_IDENTITY()";

            var job = new CreateJob
            {
                OrganizationId   = 1000,
                Code             = "testcode",
                CustomerId       = 1000,
                EndDate          = DateTime.UtcNow,
                StartDate        = DateTime.UtcNow,
                JobStatusId      = 3,
                ShortDescription = "short desc"
            };

            var obj = new CreateSqlBuilder <Job>();

            obj.Analyze <CreateJob>();
            obj.AddValueParameters(job);

            var sql = obj.GetSql();

            Assert.Equal(TestUtility.NeutralizeString(sql), TestUtility.NeutralizeString(expectedSql));
        }
예제 #25
0
        private async Task SaveJob(CreateJob createJob)
        {
            try
            {
                List <ProviderInstance> providerInstances = new List <ProviderInstance>(createJob.Providers.Count);
                for (int i = 0; i < createJob.Providers.Count; i++)
                {
                    Provider provider = await providerRepository.Get(createJob.ProviderIDs[i]);

                    ProviderInstance providerInstance = await providerMappingService.CreateProviderInstance(provider, createJob.Providers[i]);

                    providerInstance.Order = i;
                    providerInstances.Add(providerInstance);
                }

                int jobId = await backupJobRepository.AddOrUpdate(createJob.Base.ID, createJob.Base.Name, providerInstances);

                await schedulerService.CreateOrUpdate(jobId, createJob.Base.CronSchedule);
            }
            catch (Exception ex)
            {
                logger.LogError(ex, $"Failed to save job '{createJob.Base.Name}' to database");
            }
        }
예제 #26
0
        private static void AddCreateJobScript(JobConfiguration jobConfiguration, List <SqlScript> output)
        {
            var createJob = new CreateJob(output.Count + 1, jobConfiguration);

            output.Add(new SqlScript(createJob.FullName, createJob.Contents));
        }
예제 #27
0
 public async Task <ActionResult <UseCaseResult <JobModel> > > Post([FromBody] CreateJob request)
 {
     return(Ok(await UseCase.Execute(request)));
 }
예제 #28
0
파일: FmMain.cs 프로젝트: L60008028/csharep
        //启动
        private void toolStripBtnStart_Click(object sender, EventArgs e)
        {
            lp = new LocalParams();
            if (lp == null)
            {
                MessageBox.Show("LocalParams为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(lp.CronExpression1) || string.IsNullOrEmpty(lp.CronExpression2))
            {
                MessageBox.Show("请设置QZ运行表达示。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(lp.SqlConnStr))
            {
                MessageBox.Show("请设置数据库连接字符串。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!SQLbll.IsConn(lp.SqlConnStr))
            {
                MessageBox.Show("数据库连接字符串无效。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            CreateJob cjob = new CreateJob();

            if (!cjob.CheckCronExpression(lp.CronExpression1))
            {
                MessageBox.Show(string.Format("表达试[{0}]无效", lp.CronExpression1), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!cjob.CheckCronExpression(lp.CronExpression2))
            {
                MessageBox.Show(string.Format("表达试[{0}]无效", lp.CronExpression2), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            /*
             * if (!cjob.CheckCronExpression(lp.CronExpressionTaocan))
             * {
             *  MessageBox.Show(string.Format("表达试[{0}]无效", lp.CronExpressionTaocan), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  return;
             * }
             *
             * if (!cjob.CheckCronExpression(lp.CronExpressionTaocanClose))
             * {
             *  MessageBox.Show(string.Format("表达试[{0}]无效", lp.CronExpressionTaocanClose), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  return;
             * }
             * */

            // [秒] [分] [小时] [日] [月] [周] [年],日和周必须互斥,不能都指明特定的数字或*,必须有一个是?; *号就是每的意思;?代表不确定; - 表示区间; ,表示多个值
            // 0 58 9 23 * ?,每年每月23号9点58分0秒执行
            // 0 0/1 * * * ?,第分钟执行一次
            // 0 0 * * * ?,每小时一次
            // 0 15 10 15 * ? 每月15日上午10:15触发
            // 0 15 10 L * ?  每月最后一天的10点15分触发
            string     cron  = "0 28 15 * * ?";
            IScheduler sched = cjob.CreateSched(lp.CronExpression1, "trigger1", "group1", typeof(CreateBillJob));

            if (sched != null)
            {
                schList.Add(sched);
                sched.Start();
            }
            else
            {
                MessageBox.Show(string.Format("表达试[{0}] CreateBillJob初始化失败!", lp.CronExpression1), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            IScheduler sched2 = cjob.CreateSched(lp.CronExpression2, "trigger2", "group2", typeof(CreateEmptyBillJob));

            if (sched2 != null)
            {
                schList.Add(sched2);
                sched2.Start();
            }
            else
            {
                MessageBox.Show("提示", string.Format("表达试[{0}] CreateBillJob初始化失败!", lp.CronExpression2), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            /*
             * IScheduler sched3 = cjob.CreateSched(lp.CronExpressionTaocan, "trigger3", "group3", typeof(CreateTaoCanBillJob));
             * if (sched3 != null)
             * {
             *  schList.Add(sched3);
             *  sched3.Start();
             * }
             * else
             * {
             *  MessageBox.Show("提示", string.Format("表达试[{0}] CreateTaoCanBillJob初始化失败!", lp.CronExpressionTaocan), MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  return;
             * }
             */

            /*
             * IScheduler sched4 = cjob.CreateSched(lp.CronExpressionTaocanClose, "trigger4", "group4", typeof(CreateTaoCanCloseBillJob));
             * if (sched4 != null)
             * {
             *  schList.Add(sched4);
             *  sched4.Start();
             * }
             * else
             * {
             *  MessageBox.Show("提示", string.Format("表达试[{0}] CreateTaoCanCloseBillJob初始化失败!", lp.CronExpressionTaocanClose), MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  return;
             * }
             */

            this.toolStripBtnStart.Enabled  = false;
            this.toolStripStatusLabel2.Text = DateTime.Now.ToString("yyyy/MM/dd H:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo);// string.Format("{0:yyyy\\/MM\\/dd HH:mm:ss}", DateTime.Now);//2005/11/5 14:23:20 这种格式更适合老外的格式;
        }