//get job data
        public Job OpenJob(int JobId)
        {
            JobsManager JM  = WorkflowModule.GetManager <JobsManager>("");
            var         ret = JM.GetJob(JobId);

            return(ret);
        }
        protected override void Load()
        {
            IsOpenModRocketModBridge = AppDomain.CurrentDomain.GetAssemblies().Any(d => d.FullName.Contains("OpenMod.Core"));

            Instance = this;

            var openmodPath = Path.Combine(ReadWrite.PATH, "Modules", "OpenMod.Unturned");

            if (!System.IO.Directory.Exists(openmodPath))
            {
                System.IO.Directory.CreateDirectory(openmodPath);
            }

            OpenModManager = new OpenModManager(openmodPath);
            JobsManager    = new JobsManager();

            JobsManager.RegisterJob(new OpenModModuleInstallJob());
            JobsManager.RegisterJob(new OpenModCooldownsInstallJob());
            JobsManager.RegisterJob(new OpenModEconomyInstallJob());
            JobsManager.RegisterJob(new OpenModPermissionLinkInstallJob());
            JobsManager.RegisterJob(new OpenModPermissionsExInstallJob());
            JobsManager.RegisterJob(new OpenModRocketModBridgeInstallJob());
            JobsManager.RegisterJob(new OpenModUconomyToOpenModInstallJob());

            base.Load();
        }
Exemple #3
0
        public override void DataBind()
        {
            if (_bound)
            {
                return;
            }
            _bound = true;

            StringBuilder cond = new StringBuilder();

            JobsManager jMgr = new JobsManager();

            category = this.Page.Request.QueryString["category"];

            if (!String.IsNullOrEmpty(category))
            {
                cond.Append(string.Format(" And CategoryId='{0}'", StringUtils.SQLEncode(category)));
            }

            SelectCommand = string.Format("SELECT * FROM JobApplicationsView WHERE status=1 {0}",
                                          cond);
            OrderBy = "ModifiedDate DESC";

            base.DataBind();
        }
Exemple #4
0
        public override void DataBind()
        {
            if (_bound)
            {
                return;
            }
            _bound = true;

            StringBuilder cond = new StringBuilder();

            JobsManager jMgr = new JobsManager();

            category = this.Page.Request.QueryString["category"];

            if (!String.IsNullOrEmpty(category))
            {
                cond.Append(string.Format(" And CategoryId='{0}'", StringUtils.SQLEncode(category)));
            }

            SelectCommand = string.Format("SELECT * FROM JobOffersView WHERE status=1 AND ('{0}' <= ExpiryDate OR ExpiryDate is NULL) {1} ",
                                          DateTime.Now.ToShortDateString(),
                                          cond);
            OrderBy = "ModifiedDate DESC";

            base.DataBind();
        }
Exemple #5
0
        private void ExecuteSave()
        {
            DeleteJob();

            JobsManager.ScheduleJob(_scheduler, Job);
            _preChangeName = Name;
        }
        //get pre-defined query
        public QueryResult GetJobs()
        {
            JobsManager JM  = WorkflowModule.GetManager <JobsManager>("");
            var         ret = JM.ExecuteQuery(QueryName);

            return(ret);
        }
Exemple #7
0
        /// <summary>
        /// clear and re-schedule all jobs, allowing any existing jobs to finish first.
        /// </summary>
        public void ScheduleJobs()
        {
            _scheduler.PauseAll();

            JobsManager.ScheduleJobs(_scheduler, Jobs.Select(x => x.Job).ToList());

            _scheduler.ResumeAll();
        }
Exemple #8
0
        //get pre-defined query
        public async Task <QueryResult> GetJobsAsync()
        {
            var wfCon = await WorkflowModule.ConnectAsync();

            JobsManager JM  = wfCon.GetManager <JobsManager>();
            var         ret = JM.ExecuteQuery(QueryName);

            return(ret);
        }
Exemple #9
0
        //get job data
        public async Task <Job> OpenJobAsync(string JobId)
        {
            var wfCon = await WorkflowModule.ConnectAsync();

            JobsManager JM  = wfCon.GetManager <JobsManager>();
            var         ret = JM.GetJob(JobId);

            return(ret);
        }
        //create a job based off a pre-defined job type
        //then assigned it to the specified owner
        public int CreateJob(OwnerComboBoxItem owner)
        {
            JobsManager JM  = WorkflowModule.GetManager <JobsManager>("");
            var         ret = JM.CreateJob(JobTypeID);
            var         job = JM.GetJob(ret);

            if (owner != null)
            {
                job.AssignedTo   = owner.AssignedTo;
                job.AssignedType = owner.AssignmentType;
            }
            job.Save();
            return(ret);
        }
Exemple #11
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, JobsManager jobsManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
            }

            // it needs for create bot service and setWebhook
            app.UseStaticFiles();
            app.UseSpaStaticFiles();

            app.UseRouting();
            app.UseCors(x => x
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader());

            app.UseAuthentication();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller}/{action=Index}/{id?}");
                endpoints.MapHangfireDashboard();
            });
            app.UseSwagger()
            .UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
            });
            app.UseHangfireDashboard();
            app.UseSpa(spa =>
            {
                spa.Options.SourcePath = "ClientApp";

                if (env.IsDevelopment())
                {
                    spa.UseReactDevelopmentServer(npmScript: "start");
                }
            });

            jobsManager.RefreshJobs().GetAwaiter().GetResult();
        }
Exemple #12
0
        //create a job based off a pre-defined job type
        //then assigned it to the specified owner
        public async Task <string> CreateJobAsync(OwnerComboBoxItem owner)
        {
            var wfCon = await WorkflowModule.ConnectAsync();

            JobsManager JM  = wfCon.GetManager <JobsManager>();
            var         ret = JM.CreateNewJob(JobTypeID.ToString());
            var         job = JM.GetJob(ret);

            if (owner != null && job.CurrentStepInfo?.Count > 0)
            {
                job.CurrentStepInfo[0].AssignedTo   = owner.AssignedTo;
                job.CurrentStepInfo[0].AssignedType = owner.AssignmentType;
            }
            job.Save();
            return(ret);
        }
        private void JobApplicationUpload_Click(object sender, EventArgs e)
        {
            var manager     = new JobsManager();
            var application = manager.CreateJobApplication();

            application.FirstName = this.FirstName;
            application.LastName  = this.LastName;
            application.Phone     = this.Phone;
            application.Referral  = this.HowDidYouHear.SelectedValue;
            application.Text      = this.MotivationalText;

            manager.SaveChanges();

            Message.ShowPositiveMessage("Your application was submitted successfully");

            // Reset form values
            this.FirstName        = "";
            this.LastName         = "";
            this.Phone            = "";
            this.MotivationalText = "";
            this.Container.GetControl <RadComboBox>("HowDidYouHear", true).SelectedIndex = 0;
        }
Exemple #14
0
 public JobsController(JobsManager jobsManager)
 {
     _JobsManager = jobsManager;
 }
 public DashboardController(JobsManager jobsManager, DealsManager dealsManager)
 {
     _JobsManager  = jobsManager;
     _DealsManager = dealsManager;
 }
Exemple #16
0
 public NotificationForStudentController(IRozkladRepository repository, IMapper mapper, JobsManager jobsManager)
 {
     _repository  = repository;
     _mapper      = mapper;
     _jobsManager = jobsManager;
 }
Exemple #17
0
 public EnableNotificationsCommand(IRozkladRepository repository, JobsManager jobsManager)
 {
     _repository  = repository;
     _jobsManager = jobsManager;
 }
Exemple #18
0
        public void Configuration(IAppBuilder app)
        {
            // settings will automatically be used by JsonConvert.SerializeObject/DeserializeObject
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                Formatting       = Formatting.Indented,
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };

            //
            // set database connection strings
            var connString = Settings.Default.ServerConnectionString;

            if (Debugger.IsAttached)
            {
                connString = Settings.Default.LocalConnectionString;
            }

            #region Configure NLog middleware

            app.UseNLog();
            LogProvider.SetCurrentLogProvider(new ColouredConsoleLogProvider());

            #endregion

            #region Configure Web API

            // Configure Web API for self-host.
            var config = new HttpConfiguration();
            config.MapHttpAttributeRoutes();
            app.UseWebApi(config);

            #endregion

            #region Configure Hangfire Background Worker

            // Configure AppDomain parameter to simplify the Configure – http://stackoverflow.com/a/3501950/1317575
            AppDomain.CurrentDomain.SetData("DataDirectory",
                                            Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data"));

            var script = FileManager.ReadResourceFile(Settings.Default.HangfireDbScript);
            var cm     = new ConnectionManager(new Connection(connString));
            cm.CreateDatabaseIfNotExist(script);

            GlobalConfiguration.Configuration.UseSqlServerStorage(connString,
                                                                  new SqlServerStorageOptions {
                QueuePollInterval = TimeSpan.FromSeconds(30)
            })
            .UseFilter(new LogEverythingAttribute());

            app.UseHangfireDashboard("/hangfire");
            app.UseHangfireServer(new BackgroundJobServerOptions
            {
                ServerCheckInterval = TimeSpan.FromSeconds(30),
                HeartbeatInterval   = TimeSpan.FromSeconds(5)
                                      /*ServerName = "Hasin_Hangfire"*/
            }, JobStorage.Current);

            // Read and start jobs
            JobsManager.CheckupSetting(Settings.Default.SettingFileName, 100);

            #endregion


            // Alert all notify receivers to know TaskScheduler restarted
            if (JobsManager.Setting?.Notifications?.Any() == true)
            {
                foreach (var notify in JobsManager.Setting.Notifications)
                {
                    notify.Notify("`Application successful running...`", "Task Scheduler {version}");
                }
            }
        }