De-Templatization for ALL THE THINGS!!

This commit is contained in:
2021-07-23 19:58:10 +00:00
parent 3565f1a795
commit 48c2c7d8ab
22 changed files with 192 additions and 1966 deletions

View File

@@ -54,15 +54,12 @@ namespace AyaNova.Models
public virtual DbSet<PartAssemblyItem> PartAssemblyItem { get; set; }
public virtual DbSet<PM> PM { get; set; }
public virtual DbSet<PMItem> PMItem { get; set; }
public virtual DbSet<PMTemplate> PMTemplate { get; set; }
public virtual DbSet<PMTemplateItem> PMTemplateItem { get; set; }
public virtual DbSet<Project> Project { get; set; }
public virtual DbSet<PurchaseOrder> PurchaseOrder { get; set; }
public virtual DbSet<PurchaseOrderItem> PurchaseOrderItem { get; set; }
public virtual DbSet<Quote> Quote { get; set; }
public virtual DbSet<QuoteItem> QuoteItem { get; set; }
public virtual DbSet<QuoteTemplate> QuoteTemplate { get; set; }
public virtual DbSet<QuoteTemplateItem> QuoteTemplateItem { get; set; }
public virtual DbSet<Unit> Unit { get; set; }
public virtual DbSet<UnitModel> UnitModel { get; set; }
public virtual DbSet<Vendor> Vendor { get; set; }
@@ -92,9 +89,25 @@ namespace AyaNova.Models
public virtual DbSet<WorkOrderItemPriority> WorkOrderItemPriority { get; set; }
public virtual DbSet<WorkOrderItemStatus> WorkOrderItemStatus { get; set; }
//WorkOrderTemplate
public virtual DbSet<WorkOrderTemplate> WorkOrderTemplate { get; set; }
public virtual DbSet<WorkOrderTemplateItem> WorkOrderTemplateItem { get; set; }
//Quote
public virtual DbSet<Quote> Quote { get; set; }
public virtual DbSet<QuoteItem> QuoteItem { get; set; }
public virtual DbSet<QuoteState> QuoteState { get; set; }
public virtual DbSet<QuoteItemExpense> QuoteItemExpense { get; set; }
public virtual DbSet<QuoteItemLabor> QuoteItemLabor { get; set; }
public virtual DbSet<QuoteItemLoan> QuoteItemLoan { get; set; }
public virtual DbSet<QuoteItemPart> QuoteItemPart { get; set; }
public virtual DbSet<QuoteItemScheduledUser> QuoteItemScheduledUser { get; set; }
public virtual DbSet<QuoteItemTask> QuoteItemTask { get; set; }
public virtual DbSet<QuoteItemTravel> QuoteItemTravel { get; set; }
public virtual DbSet<QuoteItemUnit> QuoteItemUnit { get; set; }
public virtual DbSet<QuoteItemOutsideService> QuoteItemOutsideService { get; set; }
public virtual DbSet<QuoteStatus> QuoteStatus { get; set; }
public virtual DbSet<QuoteItemPriority> QuoteItemPriority { get; set; }
public virtual DbSet<QuoteItemStatus> QuoteItemStatus { get; set; }
public virtual DbSet<Logo> Logo { get; set; }
public virtual DbSet<Report> Report { get; set; }

View File

@@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
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 PMTemplate : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
public PMTemplate()
{
Tags = new List<string>();
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.PMTemplate; }
}//eoc
}//eons

View File

@@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
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 PMTemplateItem : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
public PMTemplateItem()
{
Tags = new List<string>();
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.PMTemplateItem; }
}//eoc
}//eons

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -6,9 +7,7 @@ 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 Quote : ICoreBizObjectModel
{
public long Id { get; set; }
@@ -16,37 +15,148 @@ 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>();
[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 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; }
//workaround for notification
//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 FromCSRViz { 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, JsonIgnore]
public AyaType AyaType { get => AyaType.WorkOrder; }
//workaround for notification
[NotMapped, JsonIgnore]
public string Name { get; set; }
/*
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<QuoteItem> QuoteItems { get; set; }
public Quote()
{
Tags = new List<string>();
QuoteItems = new List<QuoteItem>();
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.Quote; }
}//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
*/

View File

@@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
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 QuoteTemplate : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
public QuoteTemplate()
{
Tags = new List<string>();
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.QuoteTemplate; }
}//eoc
}//eons

View File

@@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
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 QuoteTemplateItem : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
public QuoteTemplateItem()
{
Tags = new List<string>();
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.QuoteTemplateItem; }
}//eoc
}//eons

View File

@@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
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 WorkOrderTemplate : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
public WorkOrderTemplate()
{
Tags = new List<string>();
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.WorkOrderTemplate; }
}//eoc
}//eons

View File

@@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
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 WorkOrderTemplateItem : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
public WorkOrderTemplateItem()
{
Tags = new List<string>();
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.WorkOrderTemplateItem; }
}//eoc
}//eons