コード例 #1
0
        /// <summary>
        /// Removes the completed element from active list.
        /// </summary>
        private void RemoveCompletedElementFromActiveList()
        {
            for (int index = this.ActiveList.Count - 1; index >= 0; index--)
            {
                SchedulerService service = this.ActiveList[index];

                if (service.Completed.HasValue)
                {
                    if (service.Result != null)
                    {
                        if (service.Result.Error != null)
                        {
                            // Save Error
                            string msg = string.Format("SchedulerService.Push() failed.\r\nURL: {0}\r\nException: {1}",
                                                       service.Url, service.Result.Error);
                            System.Diagnostics.Trace.WriteLine(msg);
                            Log.WriteEntry(msg, EventLogEntryType.Error);
                        }
                        else if (service.Result.Cancelled)
                        {
                            // Save Error
                            string msg = string.Format("SchedulerService.Push() canceled.\r\nURL: {0}",
                                                       service.Url);
                            System.Diagnostics.Trace.WriteLine(msg);
                            Log.WriteEntry(msg, EventLogEntryType.Error);
                        }
                    }

                    // Remove Subcription to event
                    service.PushCompleted -= new PushCompletedEventHandler(SchedulerService_PushCompleted);

                    this.ActiveList.RemoveAt(index);
                }
            }
        }
コード例 #2
0
 public ProgramEngine(HomeGenieService hg)
 {
     homegenie     = hg;
     macroRecorder = new MacroRecorder(this);
     scheduler     = new SchedulerService(this);
     scheduler.Start();
 }
コード例 #3
0
        public void MoveCamperToBlock_UnknownCamper_CamperNotMoved()
        {
            // Arrange - generate a schedule in the service
            string scheduleId = "MySchedule";

            string[] expectedScheduleIds = new[] { scheduleId };
            LoadSchedulesIntoAppData(expectedScheduleIds);
            SchedulerService          service  = new SchedulerService(_applicationName, _logger);
            List <ActivityDefinition> schedule = service.GetSchedule(scheduleId);

            // Act - move a camper
            ActivityDefinition sourceActivity = schedule[0];
            ActivityDefinition targetActivity = schedule[1];
            int               timeSlot        = 0;
            string            camperName      = sourceActivity.ScheduledBlocks[timeSlot].AssignedCampers[0].FullName;
            ArgumentException exception       = Assert.Throws <ArgumentException>(() =>
                                                                                  service.MoveCamperToBlock(scheduleId, "Unknown camper", timeSlot, targetActivity.Name));

            Assert.That(exception.ParamName, Is.EqualTo("camperName"), "Exception parameter");

            // Verify camper is not moved.
            schedule = service.GetSchedule(scheduleId);
            List <string> assignedCampersByName = sourceActivity.ScheduledBlocks[timeSlot]
                                                  .AssignedCampers.Select(c => c.FullName).ToList();

            Assert.That(assignedCampersByName, Has.One.EqualTo(camperName),
                        "Assigned campers on move source");
            assignedCampersByName = targetActivity.ScheduledBlocks[timeSlot]
                                    .AssignedCampers.Select(c => c.FullName).ToList();
            Assert.That(assignedCampersByName, Has.None.EqualTo(camperName),
                        "Assigned campers on move target");
        }
コード例 #4
0
        public async Task <IEnumerable <JobInfoViewModel> > GetJobsDetailsForPlayer(TravianUser player)
        {
            var groupName = SchedulerService.BuildGroupKey(player.UserName, player.BotUserName);
            var matcher   = GroupMatcher <JobKey> .GroupContains(groupName);

            var result = new List <JobInfoViewModel>();

            foreach (var key in await _scheduler.GetJobKeys(matcher))
            {
                var triggers = await _scheduler.GetTriggersOfJob(key);

                var detail = await _scheduler.GetJobDetail(key);

                var nextTime = triggers.FirstOrDefault()?.GetNextFireTimeUtc();
                if (!nextTime.HasValue)
                {
                    var cmd = detail.JobDataMap[AbstractJob.JobExecutionDataKey] as IQueueableCommand;
                    nextTime = cmd.Start;
                }

                result.Add(new JobInfoViewModel
                {
                    Name              = key.Name,
                    Group             = key.Group,
                    NextExecutionTime = nextTime.Value.ToDisplayStringApplyTimeZone(player.PlayerData.TimeZone)
                });
            }

            return(result);
        }
コード例 #5
0
        public PaymentServiceTests()
        {
            _dbSetUserDetails = GetTestUserDetails();
            _dbSetMemberFees  = GetTestMemberFees();

            var userDetailsRepoMock    = new Mock <IRepository <UserDetails> >();
            var membersFeeRepoMock     = new Mock <IRepository <MemberFee> >();
            var paymentHistoryRepoMock = new Mock <IRepository <PaymentHistory> >();

            userDetailsRepoMock.Setup(r => r.GetAll())
            .Returns(_dbSetUserDetails.AsQueryable().BuildMock().Object);
            userDetailsRepoMock.Setup(r => r.UpdateRange(It.IsAny <IEnumerable <UserDetails> >()));

            membersFeeRepoMock.Setup(r => r.GetAll())
            .Returns(_dbSetMemberFees.AsQueryable().BuildMock().Object);

            paymentHistoryRepoMock.Setup(r => r.AddRange(It.IsAny <IEnumerable <PaymentHistory> >()));


            _unitOfWorkMock = new Mock <IUnitOfWork>();
            _unitOfWorkMock.Setup(u => u.Repository <UserDetails>()).Returns(userDetailsRepoMock.Object);
            _unitOfWorkMock.Setup(u => u.Repository <MemberFee>()).Returns(membersFeeRepoMock.Object);
            _unitOfWorkMock.Setup(u => u.Repository <PaymentHistory>()).Returns(paymentHistoryRepoMock.Object);
            _unitOfWorkMock.Setup(u => u.SaveChangesAsync()).Verifiable();

            _paymentService = new SchedulerService(_unitOfWorkMock.Object);
        }
コード例 #6
0
        public ActionResult Index()
        {
            ViewBag.FullName = System.Web.HttpContext.Current.User.Identity.Name;
            List <Job> allJobs = SchedulerService.GetAllJobs();

            return(View(allJobs));
        }
コード例 #7
0
        public async Task WhenUserBuysTicketsShouldNotCrashAsync()
        {
            await using (var context = NewContext())
            {
                var userService        = new UserService(context, CacheClient);
                var transactionService = new TransactionService(userService);
                var schedulerService   = new SchedulerService(
                    new Mock <MikiApp>().Object, CacheClient, null);
                var discordClient  = new Mock <IDiscordClient>();
                var lotteryService = new LotteryService(
                    CacheClient, schedulerService, transactionService, new LotteryEventHandler());

                await lotteryService.PurchaseEntriesAsync(2L, 1);
            }

            await using (var context = NewContext())
            {
                var userService        = new UserService(context, CacheClient);
                var transactionService = new TransactionService(userService);
                var schedulerService   = new SchedulerService(
                    new Mock <MikiApp>().Object, CacheClient, null);
                var lotteryService = new LotteryService(
                    CacheClient, schedulerService, transactionService, new LotteryEventHandler());

                var user = await userService.GetUserAsync(2L);

                var userEntries = await lotteryService.GetEntriesForUserAsync(2L);

                Assert.True(userEntries.IsValid);
                Assert.Equal(0, user.Currency);
                Assert.Equal(1, userEntries.Unwrap().TicketCount);
            }
        }
コード例 #8
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            // smooth merchant thumbnail image resizing
            new BitmapTransform().InterpolationMode = BitmapInterpolationMode.Cubic;

            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.NavigationFailed += OnNavigationFailed;
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                var navigationService = new NavigationService(rootFrame);
                var loginPageViewModel = new LoginPageViewModel();
                var accountPageViewModel = new AccountPageViewModel();
                var schedulerService = new SchedulerService();

                var mondoAuthorizationClient = new MondoAuthorizationClient("YOUR_CLIENT_ID_HERE", "YOUR_CLIENT_SECRET_HERE", "https://production-api.gmon.io");

                var appController = new AppController(navigationService, mondoAuthorizationClient, loginPageViewModel, accountPageViewModel, schedulerService);

                appController.Start();
                rootFrame.Navigate(typeof (LoginPage), e.Arguments);
                rootFrame.DataContext = loginPageViewModel;
            }

            Window.Current.Activate();
        }
コード例 #9
0
        public void CreateTask_AnyState_TaskExecuted()
        {
            string path = @"C:\Users\phantomer\Desktop\Stuff\empty.txt";

            File.WriteAllText(path, string.Empty);

            var timer = new Timer(7000);
            TaskCompletionSource <bool> source = new TaskCompletionSource <bool>();

            timer.Elapsed += (sender, args) =>
            {
                source.TrySetResult(true);
            };

            var scheduler = new SchedulerService();

            scheduler.StartInstagramMonitoring(DateTime.Now + TimeSpan.FromSeconds(3));

            timer.Start();

            source.Task.Wait();
            string result = File.ReadAllText(path);

            Assert.IsFalse(string.IsNullOrEmpty(result));
        }
コード例 #10
0
ファイル: MainService.cs プロジェクト: sergiovision/FinCore
 public void UnsheduleJobs(IEnumerable <JobKey> jobs)
 {
     foreach (var job in jobs)
     {
         SchedulerService.removeJobTriggers(job);
     }
 }
コード例 #11
0
ファイル: Startup.cs プロジェクト: slelas/beeble
        public void ConfigureOAuth(IAppBuilder app)
        {
            OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions()
            {
                AllowInsecureHttp         = true,
                TokenEndpointPath         = new PathString("/token"),
                AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
                Provider = new SimpleAuthorizationServerProvider()
            };

            // Token Generation
            app.UseOAuthAuthorizationServer(OAuthServerOptions);
            app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());

            CreateRoles.Execute();
            Seed.Execute();

            var bookRepo    = new BooksRepository();
            var libraryRepo = new LibrariesRepository();


            bookRepo.GetBookBorrowExpirations();
            SchedulerService.StartAction(24, bookRepo.GetBookBorrowExpirations);

            libraryRepo.GetMembershipExpirations();
            SchedulerService.StartAction(24, libraryRepo.GetMembershipExpirations);

            bookRepo.GetBookReservationExpirations();
            SchedulerService.StartAction(2, bookRepo.GetBookReservationExpirations);
        }
コード例 #12
0
        public void MoveCamperToBlock_ValidMove_CamperMoved()
        {
            // Arrange - generate a schedule in the service
            string scheduleId = "MySchedule";

            string[] expectedScheduleIds = new[] { scheduleId };
            LoadSchedulesIntoAppData(expectedScheduleIds);
            SchedulerService          service  = new SchedulerService(_applicationName, _logger);
            List <ActivityDefinition> schedule = service.GetSchedule(scheduleId);

            // Act - move a camper
            ActivityDefinition sourceActivity = schedule[0];
            ActivityDefinition targetActivity = schedule[1];
            int    timeSlot   = 0;
            string camperName = sourceActivity.ScheduledBlocks[timeSlot].AssignedCampers[0].FullName;

            service.MoveCamperToBlock(scheduleId, camperName, timeSlot, targetActivity.Name);

            // Assert - camper is moved.
            schedule = service.GetSchedule(scheduleId);
            List <string> assignedCampersByName = sourceActivity.ScheduledBlocks[timeSlot]
                                                  .AssignedCampers.Select(c => c.FullName).ToList();

            Assert.That(assignedCampersByName, Has.None.EqualTo(camperName),
                        "Assigned campers on move source");
            assignedCampersByName = targetActivity.ScheduledBlocks[timeSlot]
                                    .AssignedCampers.Select(c => c.FullName).ToList();
            Assert.That(assignedCampersByName, Has.One.EqualTo(camperName),
                        "Assigned campers on move target");
        }
コード例 #13
0
        public static void Main(string[] args)
        {
            Logger.Init();

            var host = BuildWebHost(args);

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                try
                {
                    var context = services.GetRequiredService <SystemContext>();
                    DbInitializer.Initialize(context);

                    DatabaseService.Init();
                    SchedulerService.ScheduleCollect(MMSService.GetComtrades);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error occurred while seeding the database.");
                }
            }
            host.Run();
        }
コード例 #14
0
        public void UpdateSchedule_UpdatedSchedule_ServicePersistsUpdatedSchedule()
        {
            // Arrange - generate a schedule in the service
            string scheduleId = "MySchedule";

            string[] expectedScheduleIds = new[] { scheduleId };
            LoadSchedulesIntoAppData(expectedScheduleIds);
            SchedulerService service = new SchedulerService(_applicationName, _logger);

            // Act - Modify and update the schedule
            List <ActivityDefinition> schedule     = service.GetSchedule(scheduleId);
            List <HashSet <Camper> >  camperGroups = service.GetCamperGroupsForScheduleId(scheduleId);

            schedule.RemoveAt(0);
            service.UpdateSchedule(scheduleId, schedule, camperGroups);

            // Arrange - Create another scheduler service and read the schedule back.
            SchedulerService          freshService      = new SchedulerService(_applicationName, _logger);
            List <ActivityDefinition> retrievedSchedule = freshService.GetSchedule(scheduleId);

            Assert.That(retrievedSchedule, Has.Count.EqualTo(schedule.Count),
                        "Number of activities in retrieved schedule");
            List <HashSet <Camper> > retrievedCamperGroups = freshService.GetCamperGroupsForScheduleId(scheduleId);

            AssertCamperGroupsAreEqual(retrievedCamperGroups, camperGroups);
        }
コード例 #15
0
 public GiveawayService(JsonDatabaseService db, IDiscordClient client, IBotConfigurationService config, SchedulerService scheduler)
 {
     m_db        = db;
     m_client    = client;
     m_config    = config;
     m_scheduler = scheduler;
 }
コード例 #16
0
 public JsonResult EnableDisableJob(string id)
 {
     return(new JsonResult
     {
         Data = SchedulerService.EnableDisableJob(id),
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     });
 }
コード例 #17
0
 /// <summary>
 /// Job Summary
 /// </summary>
 /// <returns>Job summary data</returns>
 public JsonResult GetSummary()
 {
     return(new JsonResult
     {
         Data = SchedulerService.GetAllJobs(),
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     });
 }
コード例 #18
0
 public void Arrange()
 {
     // Arrange.
     eventAggregator = new EventAggregator();
     eventStore = new InMemoryEventStore(eventAggregator);
     repository = new Repository<SchedulerJob>(eventStore);
     scheduler = new SchedulerService(new EventAggregator(), repository);
 }
コード例 #19
0
 private void ChangeToRun()
 {
     Run.Text           = "Stop";
     Run.UseAccentColor = true;
     timerInfo.Text     = $"Next update in: {SchedulerService.ConvertStrInterval()}";
     timerInfo.Visible  = true;
     mainForm?.StartTimer(timerInfo.Text);
 }
コード例 #20
0
 public ProgramEngine(HomeGenieService homegenie)
 {
     _homegenie     = homegenie;
     _scriptinghost = new ScriptingHost(_homegenie);
     _macrorecorder = new MacroRecorder(this);
     _schedulersvc  = new SchedulerService(this);
     _schedulersvc.Start();
 }
コード例 #21
0
        private static List <DateTime> GetOccurrencesForYear(SchedulerService scheduler, DateTime date, string expression)
        {
            date = DateTime.SpecifyKind(date, DateTimeKind.Local);
            var start = new DateTime(date.Year, 1, 1, 0, 0, 0, DateTimeKind.Local);
            var end   = new DateTime(date.Year, 12, 31, 23, 59, 59, DateTimeKind.Local);

            return(scheduler.GetScheduling(start, end, expression));
        }
コード例 #22
0
ファイル: MainService.cs プロジェクト: sergiovision/FinCore
        /*protected void doMigration()
         * {
         *  log.Info("Start Migration: Adviser");
         *  data.MigrateAdvisers();
         *  log.Info("End Migration: Adviser");
         * }*/

        public bool InitScheduler(bool serverMode /*unused*/)
        {
            if (_gSchedulerService == null)
            {
                _gSchedulerService = Container.Resolve <SchedulerService>();
            }
            return(_gSchedulerService.Initialize());
        }
コード例 #23
0
 public void Arrange()
 {
     // Arrange.
     eventAggregator = new EventAggregator();
     eventStore      = new InMemoryEventStore(eventAggregator);
     repository      = new Repository <SchedulerJob>(eventStore);
     scheduler       = new SchedulerService(new EventAggregator(), repository);
 }
コード例 #24
0
 /// <summary>
 /// Job Details
 /// </summary>
 /// <param name="id"></param>
 /// <returns>Job detail data expanded</returns>
 public JsonResult GetDetails(string id)
 {
     return(new JsonResult
     {
         Data = SchedulerService.GetJob(id),
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     });
 }
コード例 #25
0
 public QuartzService(IRabbitMqService rabbitMqService,
                      SchedulerService schedulerService,
                      DailyTaskJob dailyTaskJob)
 {
     this._rabbitMqService  = rabbitMqService;
     this._schedulerService = schedulerService;
     this._dailyTaskJob     = dailyTaskJob;
 }
コード例 #26
0
ファイル: ProgramEngine.cs プロジェクト: macitynet/HomeGenie
 public ProgramEngine(HomeGenieService hg)
 {
     homegenie     = hg;
     scriptingHost = new CSharpAppFactory(homegenie);
     macroRecorder = new MacroRecorder(this);
     scheduler     = new SchedulerService(this);
     scheduler.Start();
 }
コード例 #27
0
        public ScheduledService(SchedulerService schedulerService)
        {
            this.schedulerService = schedulerService;
            // Schedules a repeating task to run every minute.
            schedule = schedulerService.ScheduleRepeating(OncePerMinute, TimeSpan.FromMinutes(1));

            // Schedules a once-off task to run in 20 minutes.
            runLater = schedulerService.Schedule(RunIn20Minutes, TimeSpan.FromMinutes(20));
        }
コード例 #28
0
 void Application_Start(object sender, EventArgs e)
 {
     // Код, выполняемый при запуске приложения
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     SchedulerService.Start();
 }
コード例 #29
0
ファイル: BackupController.cs プロジェクト: asimshah/Services
 public BackupController(IOptionsMonitor <ServiceOptions> options, IHostedService hostedService, ILogger <BackupController> logger, ServiceDb serviceDb, IHostingEnvironment env) : base(env)
 {
     this.serviceOptions = options.CurrentValue;
     options.OnChangeWithDelay((opt) => this.serviceOptions = opt);
     this.log              = logger;
     this.serviceDb        = serviceDb;
     this.schedulerService = hostedService as SchedulerService;
     //this.serviceDb.Database.EnsureCreated();
 }
コード例 #30
0
        public HostService(string fileName, string cronExpression)
        {
            _fileName       = fileName;
            _cronExpression = cronExpression;
            var jobName     = ConfigurationManager.AppSettings["JobName"];
            var groupName   = ConfigurationManager.AppSettings["GroupName"];
            var triggerName = ConfigurationManager.AppSettings["TriggerName"];

            schedulerService = new SchedulerService(jobName, groupName, triggerName, groupName, cronExpression);
        }
コード例 #31
0
        /// <summary>
        /// Called when [push completed].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.ComponentModel.AsyncCompletedEventArgs"/> instance containing the event data.</param>
        protected virtual void OnPushCompleted(object sender, AsyncCompletedEventArgs e)
        {
            SchedulerService service = e.UserState as SchedulerService;

            if (service != null)
            {
                service.Result    = e;
                service.Completed = DateTime.Now;
            }
        }
コード例 #32
0
        public JsonResult GetSchedule(string cron, string startdatetime)
        {
            SchedulerService ss = new SchedulerService();

            return(new JsonResult
            {
                Data = ss.GetNextFive(cron, startdatetime),
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
コード例 #33
0
        public void SetUp()
        {
            bus = new MockBus();
            rawByteBus = new MockRawByteBus();
            scheduleRepository = new MockScheduleRepository();

            schedulerService = new SchedulerService(
                bus,
                rawByteBus,
                new ConsoleLogger(),
                scheduleRepository,
                () => now);
        }
コード例 #34
0
        public void SetUp()
        {
            bus = new MockBus();
            rawByteBus = new MockRawByteBus();
            scheduleRepository = new MockScheduleRepository();

            schedulerService = new SchedulerService(
                bus,
                rawByteBus,
                new ConsoleLogger(),
                scheduleRepository,
                new SchedulerServiceConfiguration
                {
                    PublishIntervalSeconds = 1,
                    PurgeIntervalSeconds = 1
                });
        }
コード例 #35
0
        public void SetUp()
        {
            bus = MockRepository.GenerateStub<IBus>();
            advancedBus = MockRepository.GenerateStub<IAdvancedBus>();

            bus.Stub(x => x.IsConnected).Return(true);
            bus.Stub(x => x.Advanced).Return(advancedBus);

            scheduleRepository = MockRepository.GenerateStub<IScheduleRepository>();

            schedulerService = new SchedulerService(
                bus, 
                MockRepository.GenerateStub<IEasyNetQLogger>(), 
                scheduleRepository,
                new SchedulerServiceConfiguration
                {
                    PublishIntervalSeconds = 1,
                    PurgeIntervalSeconds = 1
                });
        }
        public void Should_be_able_to_query_all_pending_scheduled_payments()
        {
            ISchedulerService schedulerService = new SchedulerService(Session);
            schedulerService.ExecuteUpdates(someDate);
            Session.Flush();

            // check results

            List<Child> results = Session.Query<Child>().ToList();

            results.Count().Should().Be(5);

            results.Single(x => x.Name == "one").Account.PaymentSchedules[0].NextRun.Should().Be(someDate.AddDays(5));
            results.Single(x => x.Name == "two").Account.PaymentSchedules[0].NextRun.Should().Be(someDate.AddDays(6));
            results.Single(x => x.Name == "three").Account.PaymentSchedules[0].NextRun.Should().Be(someDate.AddDays(7));
            results.Single(x => x.Name == "four").Account.PaymentSchedules[0].NextRun.Should().Be(someDate.AddDays(1));
            results.Single(x => x.Name == "five").Account.PaymentSchedules[0].NextRun.Should().Be(someDate.AddDays(2));

            results.Single(x => x.Name == "one").Account.Transactions.Count.Should().Be(1);
            results.Single(x => x.Name == "one").Account.Transactions[0].Amount.Should().Be(1M);
        }
コード例 #37
0
        public void SetUp()
        {
            bus = MockRepository.GenerateStub<IBus>();
            advancedBus = MockRepository.GenerateStub<IAdvancedBus>();
            channel = MockRepository.GenerateStub<IAdvancedPublishChannel>();

            bus.Stub(x => x.IsConnected).Return(true);
            bus.Stub(x => x.Advanced).Return(advancedBus);
            advancedBus.Stub(x => x.OpenPublishChannel()).Return(channel);

            scheduleRepository = MockRepository.GenerateStub<IScheduleRepository>();

            schedulerService = new SchedulerService(
                bus,
                new ConsoleLogger(),
                scheduleRepository,
                new SchedulerServiceConfiguration
                {
                    PublishIntervalSeconds = 1,
                    PurgeIntervalSeconds = 1
                });
        }
コード例 #38
0
ファイル: ScheduleList.aspx.cs プロジェクト: vebin/soa
    protected void grid_OnCustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
    {
        if (e.ButtonID != "btnPauseOrStart") return;

        string operation = grid.GetRowValues(e.VisibleIndex, "TRIGGER_STATE") as string == "PAUSED" ? "启用" : "停用";

        if (!AuthUser.IsSystemAdmin)
        {
            throw new Exception("您不是系统管理员,不能进行" + operation + "操作!");
        }
        else
        {
            try
            {
                SchedulerService schedulerService = new SchedulerService();

                if (operation == "停用")
                    schedulerService.PauseQuartzWebServiceScheduler(grid.GetRowValues(e.VisibleIndex, "SCHD_ID") as string);
                else
                    schedulerService.ResumeQuartzWebServiceScheduler(grid.GetRowValues(e.VisibleIndex, "SCHD_ID") as string);
            }
            catch (Exception ex)
            {
                throw new Exception(operation + "失败!异常信息:" + ex.Message); ;
            }

            grid.DataBind();
        }
    }
コード例 #39
0
ファイル: ScheduleList.aspx.cs プロジェクト: vebin/soa
    protected void grid_CellEditorInitialize(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewEditorEventArgs e)
    {
        if (grid.IsNewRowEditing) return;

        string schedID = grid.GetRowValues(e.VisibleIndex, "SCHD_ID") as string;
        SchedulerService schedulerService = new SchedulerService();
        ESB_SCHD_EsbWS esbWS = schedulerService.GetEsbWebServiceBySchedID(schedID);

        cbEntity.Value = esbWS.EntityID;
        Session["Schedule_ScheduleList_Entity"] = esbWS.EntityID;
        cbService.DataBind();
        cbService.Value = esbWS.ServiceID;
        txtMethodName.Text = esbWS.MethodName;
        txtParam.Text = esbWS.ParamString;
        txtPassWord.Text = esbWS.PassWord;
    }
コード例 #40
0
ファイル: ScheduleList.aspx.cs プロジェクト: vebin/soa
    protected void OdsHostScheduler_OnUpdating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        if (cbEntity.Value == null || cbService.Value == null || string.IsNullOrEmpty(txtMethodName.Text)
                || string.IsNullOrEmpty(txtPassWord.Text) || string.IsNullOrEmpty(txtParam.Text)
            )
        {
            throw new Exception("请详细填写任务信息!");
        }


        ESB_SCHD sched = new ESB_SCHD();
        ESB_SCHD_EsbWS esbWS = new ESB_SCHD_EsbWS();
        SchedulerService schedulerService = new SchedulerService();

        sched.SCHD_ID = e.InputParameters["SCHD_ID"].ToString();
        sched.START_TIME = DateTime.Parse(e.InputParameters["START_TIME"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
        sched.END_TIME = DateTime.Parse(e.InputParameters["END_TIME"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
        sched.SCHD_CRON = e.InputParameters["SCHD_CRON"].ToString();
        sched.SCHD_DESC = e.InputParameters["SCHD_DESC"].ToString();
        sched.SCHD_FREQ = e.InputParameters["SCHD_FREQ"].ToString();
        sched.SCHD_HOST = new Guid(e.InputParameters["SCHD_HOST"].ToString());
        sched.SCHD_NAME = e.InputParameters["SCHD_NAME"].ToString();
        sched.SCHD_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        sched.SCHD_USER = AuthUser.UserName;

        注册服务目录服务 目录服务 = new 注册服务目录服务();
        业务实体 entity = 目录服务.获得服务提供者(sched.SCHD_HOST);
        sched.HOST_NAME = entity.业务名称;

        esbWS.EntityID = new Guid(cbEntity.SelectedItem.Value.ToString());
        esbWS.EntityName = cbEntity.SelectedItem.GetValue("业务名称").ToString();
        esbWS.ServiceID = new Guid(cbService.SelectedItem.Value.ToString());
        esbWS.ServiceName = cbService.SelectedItem.GetValue("服务名称").ToString();
        esbWS.MethodName = txtMethodName.Text;
        esbWS.PassWord = txtPassWord.Text;
        esbWS.ParamString = txtParam.Text;

        e.InputParameters.Clear();
        e.InputParameters["scheduler"] = sched;
        e.InputParameters["esbWS"] = esbWS;
    }