Пример #1
0
        //public void GetData(Action<DashboardData, Exception> callback)
        //{
        //    // Use this to create design time data

        //    var item = new DashboardData();
        //    callback(item, null);
        //}

        public void GetJobList(Action<JobList, Exception> callback)
        {
            // Use this to connect to the actual data service

            var item = new JobList();
            callback(item, null);
        }
Пример #2
0
 public JobList(JobList j1)
 {
     jobs = j1.jobs;
 }
Пример #3
0
        private void monitorThreadRun(object o)
        {
            MainViewModel mvm = o as MainViewModel;
            if (mvm == null) return;

            while (true)
            {
                JobList jl = new JobList(mvm.JobList);
                jl.Jobs = GetJobHistories(jl);

                if (jl.Jobs != null)
                    mvm.JobList = jl;

                Thread.Sleep(10000);
            }
        }
Пример #4
0
        public Dictionary<string, Job> GetJobHistories(JobList jobList)
        {
            Object[] o = BrokerConnection.InstanceOf().Request("GetJobsDetail", null) as Object[];

            if (o == null)
                return null;

            var guiJobStatus = new Dictionary<string, StateEnums.Status>();
            var guiJobHistories =
                new Dictionary<string, Dictionary<DateTime, StateEnums.Status>>();
            guiJobStatus = o[0] as Dictionary<string, StateEnums.Status>;
            guiJobHistories = o[1] as Dictionary<string, Dictionary<DateTime, StateEnums.Status>>;

            Dictionary<string, Job> _jobs = new Dictionary<string, Job>();
            foreach (string j in jobList.Jobs.Keys)
            {
                Job jNew = jobList.Jobs[j];

                foreach (string s in guiJobHistories.Keys)
                {
                    string key = s.Replace("ADHOC_", "").Replace("_Job", "");
                    if (j.Equals(key))
                    {

                        jobList.Jobs[j].History = guiJobHistories[s];

                        foreach (DateTime d in guiJobHistories[s].Keys)
                        {
                            jNew = new Job(
                                d, jobList.Jobs[j].JobGroup, jobList.Jobs[j].JobName, guiJobHistories[s][d]);

                        }
                    }
                }
                _jobs.Add(jNew.JobName, jNew);
            }
            return _jobs;
        }
Пример #5
0
        private void GetJobs(ref JobList jobList)
        {
            try
            {
                #region pull data from database

                //get list from central config
                IList<string> jobNames = DataService.Config.Hierarchy.LevelNames(@"app\BITS_JOB_SPEC");
                //for backward-compatibility
                if (jobNames.Count == 0)
                    jobNames = (List<string>)DataService.Config.Hierarchy.LevelNames(@"appgroup\BITS_JOB_SPEC");
                log.InfoFormat("Obtained {0} jobs from Central Config.", jobNames.Count);
                ArrayList arJobNames = SortList(jobNames);

                List<string> categories = GetCategories(arJobNames);
                log.InfoFormat("Obtained {0} categories from Central Config.", categories.Count);

                #endregion

                jobList.Jobs.Clear();
                foreach (
                    string s in from string s in arJobNames
                                where !s.ToUpper().Contains("DEPR_")
                                where DataService.Config.Entitlements.Contains(s) || DataService.Config.UserRole > Role.USER
                                select s)
                {
                    jobList.Jobs.Add(s, new Job(GetCategory(s), s));
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }