Files
raven/server/AyaNova/models/PM.cs
2021-11-05 15:27:14 +00:00

190 lines
6.7 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using AyaNova.Biz;
namespace AyaNova.Models
{
public class PM : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public long Serial { get; set; }
public string Notes { get; set; }//WAS "SUMMARY"
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; } = new List<string>();
//----
[Required]
public bool CopyWiki { get; set; }
[Required]
public bool CopyAttachments { get; set; }
public DateTime? StopGeneratingDate { get; set; }
[Required]
public AyaDaysOfWeek ExcludeDaysOfWeek { get; set; }//bit field flags set
[Required]
public bool Active { get; set; }
[Required]
public DateTime NextServiceDate { get; set; }
[Required]
public PMTimeUnit RepeatUnit { get; set; }
[Required]
public PMTimeUnit GenerateBeforeUnit { get; set; }
[Required]
public int RepeatInterval { get; set; }
[Required]
public int GenerateBeforeInterval { get; set; }
//This property is calculated by biz object and set internally
public DateTime? GenerateDate { get; set; }
//----
[Required]
public long CustomerId { get; set; }
[NotMapped]
public string CustomerViz { get; set; }
[NotMapped]
public string CustomerTechNotesViz { get; set; }
[NotMapped]
public string CustomerPhone1Viz { get; set; }
[NotMapped]
public string CustomerPhone2Viz { get; set; }
[NotMapped]
public string CustomerPhone3Viz { get; set; }
[NotMapped]
public string CustomerPhone4Viz { get; set; }
[NotMapped]
public string CustomerPhone5Viz { get; set; }
[NotMapped]
public string CustomerEmailAddressViz { get; set; }
public long? ProjectId { get; set; }
[NotMapped]
public string ProjectViz { get; set; }
public string InternalReferenceNumber { get; set; }
public string CustomerReferenceNumber { get; set; }
public string CustomerContactName { get; set; }
public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
public bool Onsite { get; set; }
public long? ContractId { get; set; }
[NotMapped]
public string ContractViz { get; set; }
//POSTAL ADDRESS / "BILLING ADDRESS"
public string PostAddress { get; set; }
public string PostCity { get; set; }
public string PostRegion { get; set; }
public string PostCountry { get; set; }
public string PostCode { get; set; }
//PHYSICAL ADDRESS / "SERVICE ADDRESS"
public string Address { get; set; }
public string City { get; set; }
public string Region { get; set; }
public string Country { get; set; }
public decimal? Latitude { get; set; }
public decimal? Longitude { get; set; }
public List<PMItem> Items { get; set; } = new List<PMItem>();
//UTILITY FIELDS
[NotMapped]
public string AlertViz { get; set; } = null;
[NotMapped]
public bool IsCompleteRecord { get; set; } = true;//indicates if some items were removed due to user role / type restrictions (i.e. woitems they are not scheduled on)
[NotMapped]
public bool UserIsRestrictedType { get; set; }
[NotMapped]
public bool UserIsTechRestricted { get; set; }
[NotMapped]
public bool UserIsSubContractorFull { get; set; }
[NotMapped]
public bool UserIsSubContractorRestricted { get; set; }
[NotMapped]
public bool UserCanViewPartCosts { get; set; }
[NotMapped]
public bool UserCanViewLaborOrTravelRateCosts { get; set; }
[NotMapped]
public bool UserCanViewLoanerCosts { get; set; }
[NotMapped, JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public AyaTypeId GenCopyAttachmentsFrom { get; set; }//INTERNAL, USED TO SIGNIFY ATTACHMENTS NEED TO BE COPIED ON SAVE
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.PM; }
//workaround for notification
[NotMapped, JsonIgnore]
public string Name
{
get
{
return this.Serial.ToString();
}
set => throw new System.NotImplementedException();
}
}//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. make it an array of bools 7 wide for Monday to 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
*/