This commit is contained in:
2021-07-27 23:09:15 +00:00
parent 1bda0620c6
commit 4aa5ebb6fc
3 changed files with 177 additions and 30 deletions

View File

@@ -1,14 +1,12 @@
using System;
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
{
@@ -17,38 +15,99 @@ namespace AyaNova.Models
[Required]
public long Serial { get; set; }
public bool Active { get; set; }
public string Notes { 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; }
public List<string> Tags { get; set; } = new List<string>();
//----
public DateTime? StopGeneratingDate { get; set; }
public bool[] ExcludeDaysOfWeek { get; set; }//Monday to Sunday (0-6 index)
public bool Active { get; set; }
public DateTime NextServiceDate { get; set; }
public TimeSpan Repeat { get; set; }//was generate span
public TimeSpan GenerateBefore { get; set; }//was threshold span
public DateTime? GenerateDate { get; set; }
//----
[Required]
public long CustomerId { get; set; }
[NotMapped]
public string CustomerViz { get; set; }
[NotMapped]
public string CustomerTechNotesViz { 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; }
//workaround for notification
[NotMapped, JsonIgnore]
public string Name { 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 bool IsLockedAtServer { get; set; } = false;//signal to client that it came from the server in a locked state
[NotMapped]
public string AlertViz { get; set; } = null;
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]
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; set; }
}//eoc
}//eons
@@ -64,7 +123,7 @@ CREATE TABLE [dbo].[AWORKORDERPREVENTIVEMAINTENANCE](
[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.
[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,