152 lines
5.6 KiB
C#
152 lines
5.6 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
|
|
{
|
|
/*
|
|
|
|
|
|
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
|
|
*/
|
|
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; }
|
|
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 long? FromCSRId { get; set; }
|
|
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 string Contract { 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 IsDirty { get; set; } = false;//never dirty coming from the server
|
|
[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, JsonIgnore]
|
|
public AyaType AyaType { get => AyaType.WorkOrder; }
|
|
}//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();
|
|
// }
|
|
// }
|
|
|
|
|