internal List <JAMS.CurJob> GetMonitorData() { List <JAMS.CurJob> curJobList = new List <JAMS.CurJob>(); var newList = CurJob.Find(m_Owner.JobName, m_Owner.StateType, m_Owner.Server); foreach (JAMS.CurJob h in newList) { curJobList.Add(h); } return(curJobList); }
internal List <JAMS.CurJob> GetMonitorData() { ICollection <int> folderDescendantIDList = null; CurJob masterEntry; List <JAMS.CurJob> curJobList = new List <JAMS.CurJob>(); // // If a Folder was specified get its descendant IDs // if (!String.IsNullOrWhiteSpace(m_Owner.SystemName) && m_Owner.SystemName != @"\" && m_Owner.SystemName != "*") { Folder queryFolder; // // Get descendant FolderId's // JAMS.Folder.Load(out queryFolder, m_Owner.SystemName, m_Owner.Server); folderDescendantIDList = queryFolder.GetFolderDescendants(); } // // Get the collection of CurJobs matching Name and State // var newList = CurJob.Find(m_Owner.JobName, m_Owner.StateType, m_Owner.Server); // // Add matching CurJobs to the result list // bool matches; int checkFolderID = 0; foreach (JAMS.CurJob h in newList) { matches = true; // // If a folder was specified check if this CurJob should be included // if (folderDescendantIDList != null) { // By default we check the CurJob's parent Folder checkFolderID = h.ParentFolderID; // // If this is a subjob we need to check the master entry's Folder instead // if (h.MasterRON != 0 && h.MasterRON != h.RON) { // Try to get the master entry masterEntry = newList.FirstOrDefault(c => c.RON == h.MasterRON); if (masterEntry != null) { checkFolderID = masterEntry.ParentFolderID; } } // // The parent FolderID must be a descendant to match // if (!folderDescendantIDList.Contains(checkFolderID)) { matches = false; } } // // Add the entry if it's a match // if (matches) { curJobList.Add(h); } } return(curJobList); }