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 Quote : 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 Tags { get; set; } = new List(); //---- public long? PreparedById { get; set; } [NotMapped] public string PreparedByViz { get; set; } public string Introduction { get; set; } public DateTime? Requested { get; set; } public DateTime? ValidUntil { get; set; } public DateTime? Submitted { get; set; } public DateTime? Approved { 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; } //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 string AddressPostal { get; set; } public decimal? Latitude { get; set; } public decimal? Longitude { get; set; } public List Items { get; set; } = new List(); public List States { get; set; } = new List(); //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 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.Quote; } //workaround for notification [NotMapped, JsonIgnore] public string Name { get { return this.Serial.ToString(); } set => throw new System.NotImplementedException(); } }//eoc }//eons /* QUOTE FIELDS CREATE TABLE [dbo].[AWORKORDERQUOTE]( [AID] [uniqueidentifier] NOT NULL, [AWORKORDERID] [uniqueidentifier] NOT NULL, [ACREATOR] [uniqueidentifier] NOT NULL, [AMODIFIER] [uniqueidentifier] NOT NULL, [ACREATED] [datetime] NOT NULL, [AMODIFIED] [datetime] NOT NULL, [AQUOTENUMBER] [int] IDENTITY(1,1) NOT NULL, [AQUOTESTATUSTYPE] [smallint] NULL, [APREPAREDBYID] [uniqueidentifier] NULL, [AQUOTEREQUESTDATE] [datetime] NULL, [AINTRODUCTION] [nvarchar](255) NULL, [AVALIDUNTILDATE] [datetime] NULL, [ADATESUBMITTED] [datetime] NULL, [ADATEAPPROVED] [datetime] NULL, PRIMARY KEY NONCLUSTERED QUOTE 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 */