27c21175d7
Migrate much of BI to Services. Added Wireless Profile Provider plugin feature. Added Certificate Authority Provider plugin feature. Modified Certificate Provider plugin feature. Database migration v17, for Device Profiles. Enrolment Client Updated to support CA Certificates, Wireless Profiles and Hardware Info. New Client Enrolment Protocol to support new features. Plugin Manifest Generator added to main solution. Improved AD search performance.
38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
using Disco.Data.Repository;
|
|
using Disco.Models.UI.Config.DeviceProfile;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace Disco.Web.Areas.Config.Models.DeviceProfile
|
|
{
|
|
public class IndexModel : ConfigDeviceProfileIndexModel
|
|
{
|
|
public List<ConfigDeviceProfileIndexModelItem> DeviceProfiles { get; set; }
|
|
|
|
public static IndexModel Build(DiscoDataContext Database)
|
|
{
|
|
var m = new IndexModel();
|
|
m.DeviceProfiles = Database.DeviceProfiles.OrderBy(dp => dp.Name).Select(dp => new _IndexModelItem()
|
|
{
|
|
Id = dp.Id,
|
|
Name = dp.Name,
|
|
ShortName = dp.ShortName,
|
|
Address = dp.DefaultOrganisationAddress,
|
|
Description = dp.Description,
|
|
DistributionType = dp.DistributionType.Value,
|
|
DeviceCount = dp.Devices.Count,
|
|
DeviceDecommissionedCount = dp.Devices.Count(d => d.DecommissionedDate.HasValue)
|
|
}).ToArray().Cast<ConfigDeviceProfileIndexModelItem>().ToList();
|
|
|
|
if (DiscoApplication.MultiSiteMode)
|
|
{
|
|
foreach (var dp in m.DeviceProfiles)
|
|
if (dp.Address.HasValue)
|
|
dp.AddressName = Database.DiscoConfiguration.OrganisationAddresses.GetAddress(dp.Address.Value).Name;
|
|
}
|
|
|
|
return m;
|
|
}
|
|
|
|
}
|
|
} |