Update: Job Entity -> Enum Support 2
Support the DistributionType Enum in Device Profiles
This commit is contained in:
@@ -166,7 +166,7 @@
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
|
||||
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_StartDate="2011/7/1" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||
|
||||
@@ -65,7 +65,6 @@ namespace Disco.Data.Repository
|
||||
modelBuilder.Entity<Job>().HasMany(m => m.JobSubTypes).WithMany(m => m.Jobs).Map(m => m.ToTable("Jobs_JobSubTypes"));
|
||||
modelBuilder.Entity<User>().HasMany(m => m.Jobs).WithOptional(m => m.User);
|
||||
modelBuilder.Entity<Device>().HasMany(m => m.Jobs).WithOptional(m => m.Device);
|
||||
modelBuilder.Entity<DeviceProfile>().Property(DeviceProfile.PropertyAccessExpressions.DistributionTypeDb);
|
||||
}
|
||||
|
||||
// Hook for Repository Monitor
|
||||
|
||||
@@ -27,27 +27,12 @@ namespace Disco.Models.Repository
|
||||
|
||||
// Migration from DeviceProfile Configuration
|
||||
// 2012-06-14 G#
|
||||
[Required()]
|
||||
[Required]
|
||||
public string ComputerNameTemplate { get; set; }
|
||||
public enum DistributionTypes : int
|
||||
{
|
||||
OneToMany = 0,
|
||||
OneToOne = 1
|
||||
}
|
||||
[Column("DistributionType"), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public int DistributionTypeDb { get; set; }
|
||||
[NotMapped]
|
||||
public DistributionTypes DistributionType
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DistributionTypes)this.DistributionTypeDb;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.DistributionTypeDb = (int)value;
|
||||
}
|
||||
}
|
||||
|
||||
[Required]
|
||||
public DistributionTypes? DistributionType { get; set; }
|
||||
|
||||
public string OrganisationalUnit { get; set; }
|
||||
// End Migration
|
||||
|
||||
@@ -73,11 +58,11 @@ namespace Disco.Models.Repository
|
||||
// public bool AllocateCertificate { get; set; } // Renamed from 'AllocateWirelessCertificate'
|
||||
[StringLength(64)]
|
||||
public string CertificateProviderId { get; set; }
|
||||
}
|
||||
public partial class DeviceProfile
|
||||
{
|
||||
public class PropertyAccessExpressions {
|
||||
public static readonly Expression<Func<DeviceProfile, int>> DistributionTypeDb = x => x.DistributionTypeDb;
|
||||
|
||||
public enum DistributionTypes : int
|
||||
{
|
||||
OneToMany = 0,
|
||||
OneToOne = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,7 @@ namespace Disco.Models.UI.Config.DeviceProfile
|
||||
int? Address { get; set; }
|
||||
string AddressName { get; set; }
|
||||
string Description { get; set; }
|
||||
int DistributionTypeId { get; set; }
|
||||
|
||||
string DistributionType { get; }
|
||||
Models.Repository.DeviceProfile.DistributionTypes DistributionType { get; set; }
|
||||
|
||||
int DeviceCount { get; set; }
|
||||
int DeviceDecommissionedCount { get; set; }
|
||||
|
||||
@@ -75,7 +75,8 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
DeviceProfile = new DeviceProfile()
|
||||
{
|
||||
ComputerNameTemplate = "DeviceProfile.ShortName + '-' + SerialNumber",
|
||||
ProvisionADAccount = true
|
||||
ProvisionADAccount = true,
|
||||
DistributionType = DeviceProfile.DistributionTypes.OneToMany
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceProfile
|
||||
ShortName = dp.ShortName,
|
||||
Address = dp.DefaultOrganisationAddress,
|
||||
Description = dp.Description,
|
||||
DistributionTypeId = (int)dp.DistributionType,
|
||||
DistributionType = dp.DistributionType.Value,
|
||||
DeviceCount = dp.Devices.Count,
|
||||
DeviceDecommissionedCount = dp.Devices.Count(d => d.DecommissionedDate.HasValue)
|
||||
}).ToArray().Cast<ConfigDeviceProfileIndexModelItem>().ToList();
|
||||
|
||||
@@ -16,15 +16,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceProfile
|
||||
public int? Address { get; set; }
|
||||
public string AddressName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public int DistributionTypeId { get; set; }
|
||||
|
||||
public string DistributionType
|
||||
{
|
||||
get
|
||||
{
|
||||
return Enum.GetName(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes), this.DistributionTypeId);
|
||||
}
|
||||
}
|
||||
public Disco.Models.Repository.DeviceProfile.DistributionTypes DistributionType { get; set; }
|
||||
|
||||
public int DeviceCount { get; set; }
|
||||
public int DeviceDecommissionedCount { get; set; }
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
}
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.ValidationSummary(false)
|
||||
<div class="form" style="width: 450px">
|
||||
<table>
|
||||
<tr>
|
||||
@@ -31,6 +32,7 @@
|
||||
</table>
|
||||
@Html.HiddenFor(model => model.DeviceProfile.ComputerNameTemplate)
|
||||
@Html.HiddenFor(model => model.DeviceProfile.ProvisionADAccount)
|
||||
@Html.HiddenFor(model => model.DeviceProfile.DistributionType)
|
||||
<p class="actions">
|
||||
<input type="submit" class="button" value="Create" />
|
||||
</p>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18033
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -56,6 +56,20 @@ WriteLiteral("\r\n");
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 7 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
Write(Html.ValidationSummary(false));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 7 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <div");
|
||||
@@ -70,7 +84,7 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 14 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
#line 15 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
Write(Html.TextBoxFor(model => model.DeviceProfile.Name));
|
||||
|
||||
|
||||
@@ -79,7 +93,7 @@ WriteLiteral(" ");
|
||||
WriteLiteral("<br />");
|
||||
|
||||
|
||||
#line 14 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
#line 15 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.DeviceProfile.Name));
|
||||
|
||||
|
||||
@@ -89,7 +103,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
||||
">\r\n Short Name:\r\n </th>\r\n <td>");
|
||||
|
||||
|
||||
#line 21 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
#line 22 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
Write(Html.TextBoxFor(model => model.DeviceProfile.ShortName));
|
||||
|
||||
|
||||
@@ -98,7 +112,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
||||
WriteLiteral("<br />");
|
||||
|
||||
|
||||
#line 21 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
#line 22 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.DeviceProfile.ShortName));
|
||||
|
||||
|
||||
@@ -109,7 +123,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
||||
"");
|
||||
|
||||
|
||||
#line 28 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
#line 29 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
Write(Html.TextBoxFor(model => model.DeviceProfile.Description));
|
||||
|
||||
|
||||
@@ -118,7 +132,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
||||
WriteLiteral("<br />");
|
||||
|
||||
|
||||
#line 28 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
#line 29 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.DeviceProfile.Description));
|
||||
|
||||
|
||||
@@ -129,7 +143,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 32 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
#line 33 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
Write(Html.HiddenFor(model => model.DeviceProfile.ComputerNameTemplate));
|
||||
|
||||
|
||||
@@ -140,10 +154,21 @@ WriteLiteral("\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 33 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
#line 34 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
Write(Html.HiddenFor(model => model.DeviceProfile.ProvisionADAccount));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 35 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
Write(Html.HiddenFor(model => model.DeviceProfile.DistributionType));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n <p");
|
||||
@@ -168,7 +193,7 @@ WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().s
|
||||
"\r\n </script>\r\n");
|
||||
|
||||
|
||||
#line 43 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
#line 45 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user