#34 Feature: Detailed Device Exporting
Many additional device properties are available to export. The previous export configuration is remembered.
This commit is contained in:
@@ -79,7 +79,7 @@ namespace Disco.BI.Extensions
|
||||
|
||||
return true;
|
||||
}
|
||||
public static void OnDecommission(this Device d, Disco.Models.Repository.Device.DecommissionReasons Reason)
|
||||
public static void OnDecommission(this Device d, Disco.Models.Repository.DecommissionReasons Reason)
|
||||
{
|
||||
if (!d.CanDecommission())
|
||||
throw new InvalidOperationException("Decommission of Device is Denied");
|
||||
|
||||
@@ -10,13 +10,6 @@ namespace Disco.BI.Extensions
|
||||
{
|
||||
public static class DeviceDetailExtensions
|
||||
{
|
||||
|
||||
#region Scope Declaration
|
||||
|
||||
public const string ScopeHardware = "Hardware";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helpers
|
||||
private static string GetDetail(this IEnumerable<DeviceDetail> details, string Scope, string Key)
|
||||
{
|
||||
@@ -77,59 +70,56 @@ namespace Disco.BI.Extensions
|
||||
#endregion
|
||||
|
||||
#region LanMacAddress
|
||||
public const string KeyLanMacAddress = "LanMacAddress";
|
||||
/// <summary>
|
||||
/// Gets the LanMacAddress Device Detail Value
|
||||
/// </summary>
|
||||
/// <returns>The LanMacAddress or null</returns>
|
||||
public static string LanMacAddress(this IEnumerable<DeviceDetail> details)
|
||||
{
|
||||
return details.GetDetail(ScopeHardware, KeyLanMacAddress);
|
||||
return details.GetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyLanMacAddress);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the LanMacAddress Device Detail Value
|
||||
/// </summary>
|
||||
public static void LanMacAddress(this IEnumerable<DeviceDetail> details, Device device, string LanMacAddress)
|
||||
{
|
||||
device.SetDetail(ScopeHardware, KeyLanMacAddress, LanMacAddress);
|
||||
device.SetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyLanMacAddress, LanMacAddress);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region WLanMacAddress
|
||||
public const string KeyWLanMacAddress = "WLanMacAddress";
|
||||
/// <summary>
|
||||
/// Gets the WLanMacAddress Device Detail Value
|
||||
/// </summary>
|
||||
/// <returns>The WLanMacAddress or null</returns>
|
||||
public static string WLanMacAddress(this IEnumerable<DeviceDetail> details)
|
||||
{
|
||||
return details.GetDetail(ScopeHardware, KeyWLanMacAddress);
|
||||
return details.GetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyWLanMacAddress);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the WLanMacAddress Device Detail Value
|
||||
/// </summary>
|
||||
public static void WLanMacAddress(this IEnumerable<DeviceDetail> details, Device device, string WLanMacAddress)
|
||||
{
|
||||
device.SetDetail(ScopeHardware, KeyWLanMacAddress, WLanMacAddress);
|
||||
device.SetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyWLanMacAddress, WLanMacAddress);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ACAdapter
|
||||
public const string KeyACAdapter = "ACAdapter";
|
||||
/// <summary>
|
||||
/// Gets the ACAdapter Device Detail Value
|
||||
/// </summary>
|
||||
/// <returns>The ACAdapter or null</returns>
|
||||
public static string ACAdapter(this IEnumerable<DeviceDetail> details)
|
||||
{
|
||||
return details.GetDetail(ScopeHardware, KeyACAdapter);
|
||||
return details.GetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyACAdapter);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the ACAdapter Device Detail Value
|
||||
/// </summary>
|
||||
public static void ACAdapter(this IEnumerable<DeviceDetail> details, Device device, string ACAdapter)
|
||||
{
|
||||
device.SetDetail(ScopeHardware, KeyACAdapter, ACAdapter);
|
||||
device.SetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyACAdapter, ACAdapter);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -200,28 +200,28 @@ namespace Disco.BI.Extensions
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string ReasonMessage(this Disco.Models.Repository.Device.DecommissionReasons r)
|
||||
public static string ReasonMessage(this Disco.Models.Repository.DecommissionReasons r)
|
||||
{
|
||||
switch (r)
|
||||
{
|
||||
case Device.DecommissionReasons.EndOfLife:
|
||||
case DecommissionReasons.EndOfLife:
|
||||
return "End of Life";
|
||||
case Device.DecommissionReasons.Sold:
|
||||
case DecommissionReasons.Sold:
|
||||
return "Sold";
|
||||
case Device.DecommissionReasons.Stolen:
|
||||
case DecommissionReasons.Stolen:
|
||||
return "Stolen";
|
||||
case Device.DecommissionReasons.Lost:
|
||||
case DecommissionReasons.Lost:
|
||||
return "Lost";
|
||||
case Device.DecommissionReasons.Damaged:
|
||||
case DecommissionReasons.Damaged:
|
||||
return "Damaged";
|
||||
case Device.DecommissionReasons.Donated:
|
||||
case DecommissionReasons.Donated:
|
||||
return "Donated";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
public static string ReasonMessage(this Disco.Models.Repository.Device.DecommissionReasons? r)
|
||||
public static string ReasonMessage(this Disco.Models.Repository.DecommissionReasons? r)
|
||||
{
|
||||
if (!r.HasValue)
|
||||
return "Not Decommissioned";
|
||||
|
||||
Reference in New Issue
Block a user