Files
raven/server/AyaNova/models/PM.cs
2021-07-27 22:44:46 +00:00

100 lines
3.4 KiB
C#

using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using AyaNova.Biz;
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 PM : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public long Serial { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
//workaround for notification
[NotMapped, JsonIgnore]
public string Name { get; set; }
/*
todo: Consider adding latitude / longitude to wo, quote, pm objects
can copy over from the unit or customer or set themselves
and can always hide
means wo could be scheduled for ad-hoc locations and serviced that way, i.e. a truck parked on the side of the highway etc
*/
//dependents
public List<PMItem> PMItems { get; set; }
public PM()
{
Tags = new List<string>();
PMItems = new List<PMItem>();
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.PM; }
}//eoc
}//eons
/*
CREATE TABLE [dbo].[AWORKORDERPREVENTIVEMAINTENANCE](
[AID] [uniqueidentifier] NOT NULL,
[AWORKORDERID] [uniqueidentifier] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[AWORKORDERSTATUSID] [uniqueidentifier] NULL,
[ASTOPGENERATINGDATE] [datetime] NULL,
[ADAYOFTHEWEEK] [smallint] NULL, <---- NO LONGER, now a collection of days of the week to NOT generate on, ISO8601 standard weekday number, from 1 through 7, beginning with Monday and ending with Sunday.
[AACTIVE] [bit] NOT NULL,
[APREVENTIVEMAINTENANCENUMBER] [int] IDENTITY(1,1) NOT NULL,
[ANEXTSERVICEDATE] [datetime] NOT NULL,
[AGENERATESPANUNIT] [smallint] NOT NULL,
[ATHRESHOLDSPANUNIT] [smallint] NOT NULL,
[AGENERATESPAN] [int] NOT NULL,
[ATHRESHOLDSPAN] [int] NOT NULL,
[AGENERATEDATE] [datetime] NULL,
DOESN'T NEED THESE FIELDS
CREATE TABLE [dbo].[AWORKORDERSERVICE](
[AID] [uniqueidentifier] NOT NULL,
[AWORKORDERID] [uniqueidentifier] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[AWORKORDERSTATUSID] [uniqueidentifier] NULL,//## Replaced by workorderstate collection
[ASERVICEDATE] [datetime] NULL,
[AINVOICENUMBER] [nvarchar](255) NULL,
[ASERVICENUMBER] [int] IDENTITY(1,1) NOT NULL,//## replaced by Serial field
[AQUOTEWORKORDERID] [uniqueidentifier] NULL,
[ACLIENTREQUESTID] [uniqueidentifier] NULL,//# now FromCSRId
[APREVENTIVEMAINTENANCEID] [uniqueidentifier] NULL,
[ACLOSEBYDATE] [datetime] NULL,//## Now CompleteByDate
[ASIGNATURE] [ntext] NULL,//# now customersignature (more sig types coming)
[ASIGNED] [datetime] NULL,//# now CustomerSignatureCaptured
*/