Пример #1
0
        /// <summary>
        /// Start Scheduler; Start handling system time changes
        /// </summary>
        public void Start()
        {
            Log.Debug("Starting Scheduler");

            LoadConfig();

            /*InitConfig();
             *
             * ITask task = new TestTask();
             *
             * AddTask(task);
             *
             *      IJob testJob = new Job();
             *      testJob.Name = "testJob";
             *      testJob.Active = true;
             *      testJob.StopOnError = true;
             * testJob.Tasks.Add(task);
             *
             * AddJob(testJob);
             *
             *      ITrigger trigger = new DailyTrigger("test", DateTime.Now.AddMinutes(3));
             * ITrigger trigger2 = new DailyTrigger("test2", DateTime.Now.AddMinutes(5));
             * trigger.Jobs.Add(testJob);
             *
             * AddTrigger(trigger);
             * AddTrigger(trigger2);*/

            SaveConfig();

            User user;

            try
            {
                if (ServerEnvironment.AuthorizationService.LoginVersionCheck(_ConfigSection.Login, _ConfigSection.Password, out user, ServerEnvironment.ServerVersion) != LoginResult.Successful)
                {
                    Log.Debug("Scheduler login failed");
                    return;
                }
                else
                {
                    Log.Debug("Scheduler login successfull");
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }

            lock (m_Triggers)
            {
                m_Triggers.Sort(comparer);
            }
            //
            SystemEvents.TimeChanged += OnSystemTimeChanged;
            //
            _started = true;

            // Run
            InheritedContextAsyncStarter.Run(OnNextEvent);
        }
Пример #2
0
        public void Import(string fileName, ImportType importType, object[] service)
        {
            /*
             *          Thread thread = new Thread(new ParameterizedThreadStart(import));
             *          thread.Start(new ImportParam(fileName, importType, service));
             */

            InheritedContextAsyncStarter.Run(import, new ImportParam(fileName, importType, service));
        }
Пример #3
0
 public void ImportTime(List <ImportTimeData> list, ImportTimeType importTimeType)
 {
     if (IsRunningEmployeeTimeImport)
     {
         throw new AnotherImportRunning();
     }
     IsRunningEmployeeTimeImport = true;
     InheritedContextAsyncStarter.Run(importTimePlanning, new ImportParam(list, importTimeType));
     //Thread thread = new Thread(new ParameterizedThreadStart(importTimePlanning));
     //thread.Start(new ImportParam(list, importTimeType));
 }
Пример #4
0
        private static void Execute(IEnumerable <IJob> jobs)
        {
            foreach (IJob job in jobs)
            {
                if (job.Active)
                {
                    if (Log.IsDebugEnabled)
                    {
                        Log.Debug(string.Format("Starting job: {0}", job.Name));
                    }

                    InheritedContextAsyncStarter.Run(job.Run);
                }
            }
        }
Пример #5
0
 public void RecalculateInactiveEmployees()
 {
     try
     {
         long[] iids = EmployeeListContractEndOutsideChangedGet();
         if (iids != null)
         {
             InheritedContextAsyncStarter.Run(__RunCalculateEnactiveEmployee, iids);
             //EmployeeBusinessObject.RecalculateAfterModifiedContractEndDate(iids);
         }
     }
     catch (Exception ex)
     {
         throw new LoadException(ex);
     }
 }
Пример #6
0
 public void TestImportServerSide()
 {
     InheritedContextAsyncStarter.Run(testImportServerSide);
 }