public ActionResult Update(int Id)
        {
            var         context     = COREobject.i.Context;
            CrontabTask crontabTask = context.CrontabTask.Find(Id);

            ViewData["apps"] = context.Applications.Select(app => new { app.DisplayName, app.Name, app.Id }).ToList().Select(app => new SelectListItem {
                Text = app.DisplayName ?? app.Name, Value = app.Id.ToString(), Selected = app.Id == crontabTask.ApplicationId
            });
            return(View(crontabTask));
        }
Exemple #2
0
 public virtual void RefreshStartup()
 {
     if (int.TryParse(WebConfigurationManager.AppSettings[$"Persona_{Name}_UserAutoRefreshHours"], out int UserAutoRefreshHours))
     {
         COREobject  core = COREobject.i;
         CrontabTask task = new CrontabTask {
             Application = core.Context.Applications.Single(a => a.IsSystem), BlockName = "FSS.Omnius.Modules.Persona.MasterAuth", Executor = $"RefreshAnyAuth/int:{Id}", IsActive = true, IsDeleted = false, Name = $"Scheduler {Name}", Schedule = $"after {UserAutoRefreshHours}hour", ScheduleStart = CrontabTask.ScheduleStartAt.taskStart
         };
         task.Start();
     }
 }
        public ActionResult Delete(int Id)
        {
            var         context     = COREobject.i.Context;
            CrontabTask crontabTask = context.CrontabTask.Find(Id);

            crontabTask.End();
            crontabTask.IsDeleted = true;
            crontabTask.IsActive  = false;
            context.SaveChanges();

            return(RedirectToRoute("Cortex", new { Controller = "Crontab", Action = "Index" }));
        }
        public ActionResult Create(CrontabTask crontabTask)
        {
            var context = COREobject.i.Context;

            if (!ModelState.IsValid)
            {
                ViewData["apps"] = context.Applications.Select(app => new { app.DisplayName, app.Name, app.Id }).ToList().Select(app => new SelectListItem {
                    Text = app.DisplayName ?? app.Name, Value = app.Id.ToString()
                });
                return(View(crontabTask));
            }

            context.CrontabTask.Add(crontabTask);
            context.SaveChanges();
            crontabTask.Start();

            return(RedirectToRoute("Cortex", new { Controller = "Crontab", Action = "Index" }));
        }
Exemple #5
0
        protected void Application_Start()
        {
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new MyRazorViewEngine());
            //ViewEngines        .Engines.Add(new MyWebFormViewEngine());
            AreaRegistration.RegisterAllAreas();
            UnityConfig.RegisterComponents();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);
            Logger.Log.ConfigureRootDir(Server);
            MvcHandler.DisableMvcResponseHeader = true;
            Entitron.ParseConnectionString("DefaultConnection");
            App_Start.AppStart.AppInitialize();
            CrontabTask.StartAll();
            Persona.RefreshStartup();
            Logger.Log.Info("Omnius starts");

            AntiForgeryConfig.AdditionalDataProvider = new AntiforgeryStrategyOneTime();
        }
        private void RunCommand(CrontabTask item)
        {
            try
            {
                Console.WriteLine("Executing command {0} at {1}",item.CommandLine,DateTime.Now);

                // create the ProcessStartInfo using "cmd" as the program to be run,
                // and "/c " as the parameters.
                // Incidentally, /c tells cmd that we want it to execute the command that follows,
                // and then exit.
                var procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + item.CommandLine)
                    {

                        // The following commands are needed to redirect the standard output.
                        // This means that it will be redirected to the Process.StandardOutput StreamReader.
                        RedirectStandardOutput = true,
                        UseShellExecute = false,
                        // Do not create the black window.
                        CreateNoWindow = true
                    };

                // Now we create a process, assign its ProcessStartInfo and start it
                var proc = new System.Diagnostics.Process
                    {
                        StartInfo = procStartInfo
                    };

                proc.Start();

                // Get the output into a string
                string result = proc.StandardOutput.ReadToEnd();
                // Display the command output.
                Console.WriteLine(result);
            }
            catch (Exception objException)
            {
                Console.WriteLine(objException);
            }
        }
Exemple #7
0
 public static void Task4(DateTime time, CrontabTask task, CrontabTaskExecutor taskExecutor)
 {
     Debug.WriteLine($"Task..............Cron_{time}_{task.Method.Name}_{taskExecutor.Tasks.Count}");
 }
Exemple #8
0
 public static void Task3(DateTime time, CrontabTask task)
 {
     Debug.WriteLine($"Task..............3333_{time}_{task.Method.Name}");
 }