using AyaNova.Biz; using System.ComponentModel.DataAnnotations; using Newtonsoft.Json; namespace AyaNova.Models { //NOTE: Any non required field (nullable in DB) sb nullable here, i.e. decimal? not decimal, //otherwise the server will call it an invalid record if the field isn't sent from client public class WorkOrderStatus { public long Id { get; set; } public uint Concurrency { get; set; } [Required] public string Name { get; set; } public bool Active { get; set; } public string Notes { get; set; } /* Hexadecimal notation: #RGB[A] R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (0–9, A–F). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388. */ [MaxLength(12)] public string Color { get; set; } public AuthorizationRoles SelectRoles { get; set; } public AuthorizationRoles RemoveRoles { get; set; } public bool Completed { get; set; } public bool Locked { get; set; } public WorkOrderStatus() { Color = "#ffffffff";//white / no color is the default } }//eoc }//eons /* [dbo].[AWORKORDERSTATUS]( [AID] [uniqueidentifier] NOT NULL, [ACREATED] [datetime] NOT NULL, [AMODIFIED] [datetime] NOT NULL, [AACTIVE] [bit] NOT NULL, [ACREATOR] [uniqueidentifier] NOT NULL, [AMODIFIER] [uniqueidentifier] NOT NULL, [ANAME] [nvarchar](255) NOT NULL, [ADESCRIPTION] [nvarchar](255) NULL, [AARGB] [int] NOT NULL V8: add the following properties: SelectRoles - who can select the status (still shows if they can't select but that's the current status, like active does) This is best handled at the client. It prefetches all the status out of the normal picklist process, more like how other things are separately handled now without a picklist client then knows if a status is available or not and can process to only present available ones Server can use a biz rule to ensure that it can't be circumvented UI defaults to any role DeselectRoles - who can unset this status (important for process control) UI defaults to any role CompletedStatus bool - this is a final status indicating all work on the workorder is completed, affects notification etc UI defaults to false but when set to true auto sets lockworkorder to true (but user can just unset lockworkorder) LockWorkorder - this status is considered read only and the workorder is locked Just a read only thing, can just change status to "unlock" it to support states where no one should work on a wo for whatever reason but it's not necessarily completed e.g. "Hold for inspection", "On hold" generally etc */