219 lines
7.8 KiB
C#
219 lines
7.8 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 WorkOrder : 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 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 long? FromQuoteId { get; set; }
|
|
public long? FromPMId { get; set; }
|
|
|
|
public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
|
|
public DateTime? ServiceDate { get; set; }
|
|
public DateTime? CompleteByDate { get; set; }
|
|
public TimeSpan DurationToCompleted { get; set; } = TimeSpan.Zero;
|
|
public string InvoiceNumber { get; set; }
|
|
public string CustomerSignature { get; set; }
|
|
public string CustomerSignatureName { get; set; }
|
|
public DateTime? CustomerSignatureCaptured { get; set; }
|
|
public string TechSignature { get; set; }
|
|
public string TechSignatureName { get; set; }
|
|
public DateTime? TechSignatureCaptured { get; set; }
|
|
public bool Onsite { get; set; }
|
|
public long? ContractId { get; set; }
|
|
[NotMapped]
|
|
public string ContractViz { get; set; }
|
|
|
|
//redundant field to speed up list queries
|
|
//(added after status system already coded)
|
|
public long? LastStatusId { 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<WorkOrderItem> Items { get; set; } = new List<WorkOrderItem>();
|
|
public List<WorkOrderState> States { get; set; } = new List<WorkOrderState>();
|
|
|
|
|
|
//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;
|
|
[NotMapped]
|
|
public string FromQuoteViz { get; set; }
|
|
[NotMapped]
|
|
public string FromPMViz { get; set; }
|
|
|
|
[NotMapped]
|
|
public string LastStateUserViz { get; set; }
|
|
[NotMapped]
|
|
public string LastStateNameViz { get; set; }
|
|
[NotMapped]
|
|
public string LastStateColorViz { get; set; }
|
|
[NotMapped]
|
|
public bool LastStateCompletedViz { get; set; }
|
|
[NotMapped]
|
|
public bool LastStateLockedViz { get; set; }
|
|
|
|
|
|
[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.WorkOrder; }
|
|
|
|
//workaround for notification
|
|
[NotMapped, JsonIgnore]
|
|
public string Name
|
|
{
|
|
get
|
|
{
|
|
return this.Serial.ToString();
|
|
}
|
|
set => throw new System.NotImplementedException();
|
|
}
|
|
|
|
|
|
}//eoc
|
|
|
|
}//eons
|
|
|
|
|
|
/*
|
|
CREATE TABLE [dbo].[AWORKORDER](
|
|
[AID] [uniqueidentifier] NOT NULL,
|
|
[ACREATED] [datetime] NOT NULL,
|
|
[AMODIFIED] [datetime] NOT NULL,
|
|
[ACREATOR] [uniqueidentifier] NOT NULL,
|
|
[AMODIFIER] [uniqueidentifier] NOT NULL,
|
|
[ACLIENTID] [uniqueidentifier] NULL,
|
|
[APROJECTID] [uniqueidentifier] NULL,
|
|
[AINTERNALREFERENCENUMBER] [nvarchar](255) NULL,
|
|
[ACUSTOMERREFERENCENUMBER] [nvarchar](255) NULL,
|
|
[AONSITE] [bit] NOT NULL,
|
|
[ACUSTOMERCONTACTNAME] [nvarchar](255) NULL,
|
|
[AREGIONID] [uniqueidentifier] NULL,
|
|
[AWORKORDERTYPE] [smallint] NULL,
|
|
[AFORMLAYOUTID] [uniqueidentifier] NULL,//### DROP NOT PORTED
|
|
[ASUMMARY] [nvarchar](255) NULL, //### NOW NOTES
|
|
[AWORKORDERCATEGORYID] [uniqueidentifier] NULL,//## DROP NOW TAGS
|
|
[ACLOSED] [bit] NOT NULL,//## DROP now this is via status flagged completed
|
|
[ASERVICECOMPLETED] [bit] NOT NULL,//## DROP now this is via status with LOCKED flagged
|
|
[AFROMQUOTEID] [uniqueidentifier] NULL,
|
|
[AFROMPMID] [uniqueidentifier] NULL,
|
|
[ATEMPLATEDESCRIPTION] [nvarchar](255) NULL,//### FOR TEMPLATE ONLY? SEPARATE OBJECT NOT NEEDED HERE
|
|
[ATEMPLATEFRESHPRICE] [bit] NOT NULL,//### FOR TEMPLATE ONLY? SEPARATE OBJECT NOT NEEDED HERE
|
|
|
|
|
|
|
|
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
|
|
*/
|
|
|
|
|
|
|
|
//STuff that was here before and may potentially be useful in future
|
|
|
|
|
|
// [NotMapped, JsonIgnore]
|
|
// public string Name
|
|
// {
|
|
// //Used by notification processor
|
|
// get
|
|
// {
|
|
// return this.Serial.ToString();
|
|
// }
|
|
// }
|
|
|
|
|