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" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<VisualStudio>
|
<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>
|
</VisualStudio>
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
<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<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<User>().HasMany(m => m.Jobs).WithOptional(m => m.User);
|
||||||
modelBuilder.Entity<Device>().HasMany(m => m.Jobs).WithOptional(m => m.Device);
|
modelBuilder.Entity<Device>().HasMany(m => m.Jobs).WithOptional(m => m.Device);
|
||||||
modelBuilder.Entity<DeviceProfile>().Property(DeviceProfile.PropertyAccessExpressions.DistributionTypeDb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook for Repository Monitor
|
// Hook for Repository Monitor
|
||||||
|
|||||||
@@ -27,27 +27,12 @@ namespace Disco.Models.Repository
|
|||||||
|
|
||||||
// Migration from DeviceProfile Configuration
|
// Migration from DeviceProfile Configuration
|
||||||
// 2012-06-14 G#
|
// 2012-06-14 G#
|
||||||
[Required()]
|
[Required]
|
||||||
public string ComputerNameTemplate { get; set; }
|
public string ComputerNameTemplate { get; set; }
|
||||||
public enum DistributionTypes : int
|
|
||||||
{
|
[Required]
|
||||||
OneToMany = 0,
|
public DistributionTypes? DistributionType { get; set; }
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public string OrganisationalUnit { get; set; }
|
public string OrganisationalUnit { get; set; }
|
||||||
// End Migration
|
// End Migration
|
||||||
|
|
||||||
@@ -73,11 +58,11 @@ namespace Disco.Models.Repository
|
|||||||
// public bool AllocateCertificate { get; set; } // Renamed from 'AllocateWirelessCertificate'
|
// public bool AllocateCertificate { get; set; } // Renamed from 'AllocateWirelessCertificate'
|
||||||
[StringLength(64)]
|
[StringLength(64)]
|
||||||
public string CertificateProviderId { get; set; }
|
public string CertificateProviderId { get; set; }
|
||||||
}
|
|
||||||
public partial class DeviceProfile
|
public enum DistributionTypes : int
|
||||||
{
|
{
|
||||||
public class PropertyAccessExpressions {
|
OneToMany = 0,
|
||||||
public static readonly Expression<Func<DeviceProfile, int>> DistributionTypeDb = x => x.DistributionTypeDb;
|
OneToOne = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ namespace Disco.Models.UI.Config.DeviceProfile
|
|||||||
int? Address { get; set; }
|
int? Address { get; set; }
|
||||||
string AddressName { get; set; }
|
string AddressName { get; set; }
|
||||||
string Description { get; set; }
|
string Description { get; set; }
|
||||||
int DistributionTypeId { get; set; }
|
Models.Repository.DeviceProfile.DistributionTypes DistributionType { get; set; }
|
||||||
|
|
||||||
string DistributionType { get; }
|
|
||||||
|
|
||||||
int DeviceCount { get; set; }
|
int DeviceCount { get; set; }
|
||||||
int DeviceDecommissionedCount { get; set; }
|
int DeviceDecommissionedCount { get; set; }
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
DeviceProfile = new DeviceProfile()
|
DeviceProfile = new DeviceProfile()
|
||||||
{
|
{
|
||||||
ComputerNameTemplate = "DeviceProfile.ShortName + '-' + SerialNumber",
|
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,
|
ShortName = dp.ShortName,
|
||||||
Address = dp.DefaultOrganisationAddress,
|
Address = dp.DefaultOrganisationAddress,
|
||||||
Description = dp.Description,
|
Description = dp.Description,
|
||||||
DistributionTypeId = (int)dp.DistributionType,
|
DistributionType = dp.DistributionType.Value,
|
||||||
DeviceCount = dp.Devices.Count,
|
DeviceCount = dp.Devices.Count,
|
||||||
DeviceDecommissionedCount = dp.Devices.Count(d => d.DecommissionedDate.HasValue)
|
DeviceDecommissionedCount = dp.Devices.Count(d => d.DecommissionedDate.HasValue)
|
||||||
}).ToArray().Cast<ConfigDeviceProfileIndexModelItem>().ToList();
|
}).ToArray().Cast<ConfigDeviceProfileIndexModelItem>().ToList();
|
||||||
|
|||||||
@@ -16,15 +16,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceProfile
|
|||||||
public int? Address { get; set; }
|
public int? Address { get; set; }
|
||||||
public string AddressName { get; set; }
|
public string AddressName { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public int DistributionTypeId { get; set; }
|
public Disco.Models.Repository.DeviceProfile.DistributionTypes DistributionType { get; set; }
|
||||||
|
|
||||||
public string DistributionType
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Enum.GetName(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes), this.DistributionTypeId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int DeviceCount { get; set; }
|
public int DeviceCount { get; set; }
|
||||||
public int DeviceDecommissionedCount { get; set; }
|
public int DeviceDecommissionedCount { get; set; }
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
}
|
}
|
||||||
@using (Html.BeginForm())
|
@using (Html.BeginForm())
|
||||||
{
|
{
|
||||||
|
@Html.ValidationSummary(false)
|
||||||
<div class="form" style="width: 450px">
|
<div class="form" style="width: 450px">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
</table>
|
</table>
|
||||||
@Html.HiddenFor(model => model.DeviceProfile.ComputerNameTemplate)
|
@Html.HiddenFor(model => model.DeviceProfile.ComputerNameTemplate)
|
||||||
@Html.HiddenFor(model => model.DeviceProfile.ProvisionADAccount)
|
@Html.HiddenFor(model => model.DeviceProfile.ProvisionADAccount)
|
||||||
|
@Html.HiddenFor(model => model.DeviceProfile.DistributionType)
|
||||||
<p class="actions">
|
<p class="actions">
|
||||||
<input type="submit" class="button" value="Create" />
|
<input type="submit" class="button" value="Create" />
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// 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
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
@@ -54,6 +54,20 @@ WriteLiteral("\r\n");
|
|||||||
#line 5 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 5 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
using (Html.BeginForm())
|
using (Html.BeginForm())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#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 default
|
||||||
@@ -70,7 +84,7 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 14 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 15 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
Write(Html.TextBoxFor(model => model.DeviceProfile.Name));
|
Write(Html.TextBoxFor(model => model.DeviceProfile.Name));
|
||||||
|
|
||||||
|
|
||||||
@@ -79,7 +93,7 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral("<br />");
|
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));
|
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>");
|
">\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));
|
Write(Html.TextBoxFor(model => model.DeviceProfile.ShortName));
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +112,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
|||||||
WriteLiteral("<br />");
|
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));
|
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));
|
Write(Html.TextBoxFor(model => model.DeviceProfile.Description));
|
||||||
|
|
||||||
|
|
||||||
@@ -118,7 +132,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
|||||||
WriteLiteral("<br />");
|
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));
|
Write(Html.ValidationMessageFor(model => model.DeviceProfile.Description));
|
||||||
|
|
||||||
|
|
||||||
@@ -129,7 +143,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 32 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 33 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
Write(Html.HiddenFor(model => model.DeviceProfile.ComputerNameTemplate));
|
Write(Html.HiddenFor(model => model.DeviceProfile.ComputerNameTemplate));
|
||||||
|
|
||||||
|
|
||||||
@@ -140,10 +154,21 @@ WriteLiteral("\r\n");
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 33 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 34 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
Write(Html.HiddenFor(model => model.DeviceProfile.ProvisionADAccount));
|
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 default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n <p");
|
WriteLiteral("\r\n <p");
|
||||||
@@ -168,7 +193,7 @@ WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().s
|
|||||||
"\r\n </script>\r\n");
|
"\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