#138 device flag models

This commit is contained in:
Gary Sharp committed 2024-01-13 16:33:03 +11:00
1 parent 8afe4195a9
commit 8c48ab6ecd
9 files changed
+312 -5

No files matched your search

+7
View File
@@ -175,6 +175,10 @@
<Compile Include="Migrations\202304150715559_DBv22.Designer.cs"> <Compile Include="Migrations\202304150715559_DBv22.Designer.cs">
<DependentUpon>202304150715559_DBv22.cs</DependentUpon> <DependentUpon>202304150715559_DBv22.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Migrations\202401130531317_DBv23.cs" />
<Compile Include="Migrations\202401130531317_DBv23.Designer.cs">
<DependentUpon>202401130531317_DBv23.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" /> <Compile Include="Migrations\Configuration.cs" />
<Compile Include="Migrations\DiscoDataMigrator.cs" /> <Compile Include="Migrations\DiscoDataMigrator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
@@ -256,6 +260,9 @@
<EmbeddedResource Include="Migrations\202304150715559_DBv22.resx"> <EmbeddedResource Include="Migrations\202304150715559_DBv22.resx">
<DependentUpon>202304150715559_DBv22.cs</DependentUpon> <DependentUpon>202304150715559_DBv22.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Migrations\202401130531317_DBv23.resx">
<DependentUpon>202401130531317_DBv23.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+27
View File
@@ -0,0 +1,27 @@
// <auto-generated />
namespace Disco.Data.Migrations
{
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
public sealed partial class DBv23 : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv23));
string IMigrationMetadata.Id
{
get { return "202401130531317_DBv23"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,67 @@
namespace Disco.Data.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class DBv23 : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.DeviceFlagAssignments",
c => new
{
Id = c.Int(nullable: false, identity: true),
DeviceFlagId = c.Int(nullable: false),
DeviceSerialNumber = c.String(nullable: false, maxLength: 60),
AddedDate = c.DateTime(nullable: false),
AddedUserId = c.String(nullable: false, maxLength: 50),
RemovedDate = c.DateTime(),
RemovedUserId = c.String(maxLength: 50),
Comments = c.String(),
OnAssignmentExpressionResult = c.String(),
OnUnassignmentExpressionResult = c.String(),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.DeviceFlags", t => t.DeviceFlagId)
.ForeignKey("dbo.Devices", t => t.DeviceSerialNumber)
.ForeignKey("dbo.Users", t => t.AddedUserId)
.ForeignKey("dbo.Users", t => t.RemovedUserId)
.Index(t => t.DeviceFlagId)
.Index(t => t.DeviceSerialNumber)
.Index(t => t.AddedUserId)
.Index(t => t.RemovedUserId);
CreateTable(
"dbo.DeviceFlags",
c => new
{
Id = c.Int(nullable: false, identity: true),
Name = c.String(nullable: false, maxLength: 100),
Description = c.String(maxLength: 500),
Icon = c.String(nullable: false, maxLength: 25),
IconColour = c.String(nullable: false, maxLength: 10),
DevicesLinkedGroup = c.String(),
DeviceUsersLinkedGroup = c.String(),
OnAssignmentExpression = c.String(),
OnUnassignmentExpression = c.String(),
})
.PrimaryKey(t => t.Id);
}
public override void Down()
{
DropIndex("dbo.DeviceFlagAssignments", new[] { "RemovedUserId" });
DropIndex("dbo.DeviceFlagAssignments", new[] { "AddedUserId" });
DropIndex("dbo.DeviceFlagAssignments", new[] { "DeviceSerialNumber" });
DropIndex("dbo.DeviceFlagAssignments", new[] { "DeviceFlagId" });
DropForeignKey("dbo.DeviceFlagAssignments", "RemovedUserId", "dbo.Users");
DropForeignKey("dbo.DeviceFlagAssignments", "AddedUserId", "dbo.Users");
DropForeignKey("dbo.DeviceFlagAssignments", "DeviceSerialNumber", "dbo.Devices");
DropForeignKey("dbo.DeviceFlagAssignments", "DeviceFlagId", "dbo.DeviceFlags");
DropTable("dbo.DeviceFlags");
DropTable("dbo.DeviceFlagAssignments");
}
}
}
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Target" xml:space="preserve">
<value>H4sIAAAAAAAEAO1923LcxpLg+0bsPyj4tDsRI0qyLMsn5JmgKcmmRhJ1SNl+ZEDdRRJz0EAfAC2L59f2YT9pf2GrcK1LZt1QuHS7XyQ2KisrMysrs66Z/+///N9X//ltkzz6SvIiztKfTp4+fnLyiKSrbB2ndz+d7Mrbf3958p//8T//x6s36823R7+3cN8xOFozLX46uS/L7d9OT4vVPdlExeNNvMqzIrstH6+yzWm0zk6fPXny4+nTp6eEojihuB49enW1S8t4Q6of9Od5lq7IttxFyYdsTZKi+U5Lriusjz5GG1JsoxX56eR1XKyyx6+jMnp8RbZZEZdZ/nDy6CyJI0rMNUluTx5tn//tt4Jcl3mW3l1vozKOks8PW0LLb6OkIA3pf9s+t6X+yTNG/WmUpllJ0WWpF/cnHV+UszdUAuUDI6vi7qcTKoTb+G6XV/gvSiKA0wr/RR6ED/TTpzzbkrx8uCK3DZLrFf1y8ujUDEnRyXCvTuU2unoiekY1/VHmVEtOHr2Nv5H1e5LelfedgD9E39ovL6mq/JbGVKdonTLf0dKPuySJviSkAz/VtlqROnGbv0fJzpVT+qem2fo33+qr014JtKrxOlvtNiQtP5PNNolK4qMZF2v37mZ1nCTw3WC5vybFKo+39RhzavvZ94Mb91HvF0MbfRsnJcnffNvmpCjc2XZVOpWAy/QXkhJqd8isRFxstllenpVltLpnyr4AYqgTyd8m0d3VLiHF5FTQlsuSpG+zfNO2/XOWJSRKPUbV13hFivdx+g+y/iXPdtvJuWGynJWAi+LXeL0mq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+F8EiHNcpqQoSMF+Fk2gF+Ic6mW4MH7e5XdJlD98vie3JR3z99n68pbag9xVJgHi7TQ/WWKna0KCZMX6lCXxinzMWIjr4eorYrsu5zEIIhXhpXSeUxRXZMuSQ2SO3D0fzN0VWdGpf35F1rsVEW+gW9LwcjANl+U9yanvIXRUVjP0vIydB2eATBW0Oy9v27jNw98BRfHmbZZvrqk3C/OwiEM40VaNzzLf/TIgML3CbwzaXxKXxGVHL1BNQ70CbeZFrRJi6tjdItyrmeObb2wpHiXBl9hW08ym8ffZ3V0Yu95i7C6rzMYTO5dMiEUayaCj3uVSLTJOwEusQwYGf8N2r8bGRdHZjMpkDJ1MNXlwqB6e3zO5XpF/7uJAQeUx3PMcKMjUWJ01eSNeBo+fongUFhneeThs52GX+ZpOT6M40KNmAO0S+PP0GM+CUhFqpqognUfCF+nXrHpqtSJxoINSCeVcB6bbiFrXfJZZU9t4uFlTi3G+WVNLwUizJp13tH31o8ehfQ6kq4pNw6zrO5/FYi7UVxDYka11PR8R+B/wYv7Vl/2+vhP3bTUf5ru6rrwjrteWdbS6lnOklg3jWNVBfNvsRqBEaPYkjHWcOdbuT+j4BZykLbdgVS2vQA0bTqFqHk+wwz7atKB78LKYcSoG0z6kuxotd0MX33PeJ9z7W5GHcjFxttxul2k/Ot9827KzSmphrkixS6a/H3mZtgEi5yHHmInAJf1ADW9MQcA+gfFYMVifLAqh0yZY0hv4+iTQCjgl18HZkD7enUqgMeRqpR7ShotgFy07ZT4g5328aHnoFy2Z1s6aspQRsIDMqbCDX4xrX4BT90wv5OLfLdMMCXMBL1tdK5x/siHPGOsjJx5aQBD2YxKiKTMrG8JkNtmEsJjnQjES61yECZDf4DBjEM0fd/wYwmjSlmd/hX4MLine truncated
</data>
</root>
+4 -5
View File
@@ -1,9 +1,6 @@
using System; using Disco.Models.Repository;
using System.Collections.Generic; using System;
using System.Linq;
using System.Text;
using System.Data.Entity; using System.Data.Entity;
using Disco.Models.Repository;
using System.Data.Entity.ModelConfiguration.Conventions; using System.Data.Entity.ModelConfiguration.Conventions;
namespace Disco.Data.Repository namespace Disco.Data.Repository
@@ -38,6 +35,8 @@ namespace Disco.Data.Repository
public virtual DbSet<DeviceBatchAttachment> DeviceBatchAttachments { get; set; } public virtual DbSet<DeviceBatchAttachment> DeviceBatchAttachments { get; set; }
public virtual DbSet<DeviceComponent> DeviceComponents { get; set; } public virtual DbSet<DeviceComponent> DeviceComponents { get; set; }
public virtual DbSet<DeviceAttachment> DeviceAttachments { get; set; } public virtual DbSet<DeviceAttachment> DeviceAttachments { get; set; }
public virtual DbSet<DeviceFlag> DeviceFlags { get; set; }
public virtual DbSet<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
public virtual DbSet<DeviceCertificate> DeviceCertificates { get; set; } public virtual DbSet<DeviceCertificate> DeviceCertificates { get; set; }
+2
View File
@@ -52,6 +52,8 @@
<Compile Include="Exporting\ExportFieldMetadata.cs" /> <Compile Include="Exporting\ExportFieldMetadata.cs" />
<Compile Include="Exporting\ExportFormat.cs" /> <Compile Include="Exporting\ExportFormat.cs" />
<Compile Include="Exporting\IExportRecord.cs" /> <Compile Include="Exporting\IExportRecord.cs" />
<Compile Include="Repository\Device\Flag\DeviceFlag.cs" />
<Compile Include="Repository\Device\Flag\DeviceFlagAssignment.cs" />
<Compile Include="Services\Expressions\Extensions\ImageExpressionFormat.cs" /> <Compile Include="Services\Expressions\Extensions\ImageExpressionFormat.cs" />
<Compile Include="ClientServices\EnrolmentInformation\BaseBoard.cs" /> <Compile Include="ClientServices\EnrolmentInformation\BaseBoard.cs" />
<Compile Include="ClientServices\EnrolmentInformation\Battery.cs" /> <Compile Include="ClientServices\EnrolmentInformation\Battery.cs" />
+1
View File
@@ -51,6 +51,7 @@ namespace Disco.Models.Repository
[InverseProperty("DeviceSerialNumber")] [InverseProperty("DeviceSerialNumber")]
public virtual IList<Job> Jobs { get; set; } public virtual IList<Job> Jobs { get; set; }
public virtual IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
public override string ToString() public override string ToString()
{ {
@@ -0,0 +1,37 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Disco.Models.Repository
{
public class DeviceFlag
{
[Key]
public int Id { get; set; }
[Required, StringLength(100)]
public string Name { get; set; }
[StringLength(500), DataType(DataType.MultilineText)]
public string Description { get; set; }
[Required, StringLength(25)]
public string Icon { get; set; }
[Required, StringLength(10)]
public string IconColour { get; set; }
public string DevicesLinkedGroup { get; set; }
public string DeviceUsersLinkedGroup { get; set; }
[DataType(DataType.MultilineText)]
public string OnAssignmentExpression { get; set; }
[DataType(DataType.MultilineText)]
public string OnUnassignmentExpression { get; set; }
public virtual IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
public override string ToString()
{
return Name;
}
}
}
@@ -0,0 +1,44 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Disco.Models.Repository
{
public class DeviceFlagAssignment
{
[Key]
public int Id { get; set; }
[Required]
public int DeviceFlagId { get; set; }
[Required]
public string DeviceSerialNumber { get; set; }
[Required]
public DateTime AddedDate { get; set; }
[Required]
public string AddedUserId { get; set; }
public DateTime? RemovedDate { get; set; }
public string RemovedUserId { get; set; }
public string Comments { get; set; }
public string OnAssignmentExpressionResult { get; set; }
public string OnUnassignmentExpressionResult { get; set; }
[ForeignKey(nameof(DeviceFlagId)), InverseProperty("DeviceFlagAssignments")]
public virtual DeviceFlag DeviceFlag { get; set; }
[ForeignKey(nameof(DeviceSerialNumber)), InverseProperty("DeviceFlagAssignments")]
public virtual Device Device { get; set; }
[ForeignKey("AddedUserId")]
public virtual User AddedUser { get; set; }
[ForeignKey("RemovedUserId")]
public virtual User RemovedUser { get; set; }
public override string ToString()
{
return $"Device Flag Id: {DeviceFlagId}; Device Serial Number: {DeviceSerialNumber}; Added: {AddedDate:s}";
}
}
}