public MunkiUpdateConfirm GetUpdateStats(int templateId) { var includedTemplates = new List <Models.MunkiManifestTemplate>(); var groups = BLL.GroupMunki.GetGroupsForManifestTemplate(templateId); //get list of all templates that are used in these groups int totalComputerCount = 0; foreach (var munkiGroup in groups) { totalComputerCount += Convert.ToInt32(BLL.GroupMembership.GetGroupMemberCount(munkiGroup.GroupId)); foreach (var template in BLL.GroupMunki.Get(munkiGroup.GroupId)) { includedTemplates.Add(BLL.MunkiManifestTemplate.GetManifest(template.MunkiTemplateId)); } } var computers = BLL.ComputerMunki.GetComputersForManifestTemplate(templateId); foreach (var computer in computers) { foreach (var template in BLL.ComputerMunki.Get(computer.ComputerId)) { includedTemplates.Add(BLL.MunkiManifestTemplate.GetManifest(template.MunkiTemplateId)); } } totalComputerCount += computers.Count; var distinctList = includedTemplates.GroupBy(x => x.Name).Select(s => s.First()).ToList(); var munkiConfirm = new MunkiUpdateConfirm(); munkiConfirm.manifestTemplates = distinctList; munkiConfirm.groupCount = groups.Count; munkiConfirm.computerCount = totalComputerCount; return(munkiConfirm); }
public MunkiUpdateConfirm GetUpdateStats(int templateId) { var includedTemplates = new List<Models.MunkiManifestTemplate>(); var groups = BLL.GroupMunki.GetGroupsForManifestTemplate(templateId); //get list of all templates that are used in these groups int totalComputerCount = 0; foreach (var munkiGroup in groups) { totalComputerCount += Convert.ToInt32(BLL.GroupMembership.GetGroupMemberCount(munkiGroup.GroupId)); foreach (var template in BLL.GroupMunki.Get(munkiGroup.GroupId)) { includedTemplates.Add(BLL.MunkiManifestTemplate.GetManifest(template.MunkiTemplateId)); } } var computers = BLL.ComputerMunki.GetComputersForManifestTemplate(templateId); foreach (var computer in computers) { foreach (var template in BLL.ComputerMunki.Get(computer.ComputerId)) { includedTemplates.Add(BLL.MunkiManifestTemplate.GetManifest(template.MunkiTemplateId)); } } totalComputerCount += computers.Count; var distinctList = includedTemplates.GroupBy(x => x.Name).Select(s => s.First()).ToList(); var munkiConfirm = new MunkiUpdateConfirm(); munkiConfirm.manifestTemplates = distinctList; munkiConfirm.groupCount = groups.Count; munkiConfirm.computerCount = totalComputerCount; return munkiConfirm; }