Feature #33: Enhanced Device Importing

Dynamic device importing. better input parsing and 5 additional import
fields.
This commit is contained in:
Gary Sharp
2014-05-25 16:34:06 +10:00
parent 6a45348bdb
commit e9042f7666
68 changed files with 6775 additions and 3039 deletions
@@ -0,0 +1,25 @@
using Disco.Models.Services.Devices.Importing;
using Disco.Models.UI.Device;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace Disco.Web.Models.Device
{
public class ImportHeadersModel : DeviceImportHeadersModel
{
public IDeviceImportContext Context { get; set; }
public IEnumerable<Tuple<DeviceImportFieldTypes, string>> HeaderTypes { get; set; }
public ImportHeadersModel()
{
HeaderTypes = typeof(DeviceImportFieldTypes)
.GetFields()
.Select(p => Tuple.Create(p, (DisplayAttribute)p.GetCustomAttributes(typeof(DisplayAttribute), false).FirstOrDefault()))
.Where(p => p.Item2 != null)
.Select(p => Tuple.Create((DeviceImportFieldTypes)p.Item1.GetRawConstantValue(), p.Item2.Name)).ToList();
}
}
}