From f5f0cffde618356b336f8907c6dc1ee32a8ddd1d Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 6 Jan 2021 23:49:19 +0000 Subject: [PATCH] --- .../AyaNova/biz/BizObjectExistsInDatabase.cs | 2 + server/AyaNova/biz/BizObjectFactory.cs | 2 + .../biz/CustomerServiceRequestPriority.cs | 19 ++++++ .../biz/CustomerServiceRequestStatus.cs | 22 +++++++ .../AyaNova/models/CustomerServiceRequest.cs | 61 +++++++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 server/AyaNova/biz/CustomerServiceRequestPriority.cs create mode 100644 server/AyaNova/biz/CustomerServiceRequestStatus.cs create mode 100644 server/AyaNova/models/CustomerServiceRequest.cs diff --git a/server/AyaNova/biz/BizObjectExistsInDatabase.cs b/server/AyaNova/biz/BizObjectExistsInDatabase.cs index cf0ac82f..1f0f6aaa 100644 --- a/server/AyaNova/biz/BizObjectExistsInDatabase.cs +++ b/server/AyaNova/biz/BizObjectExistsInDatabase.cs @@ -116,6 +116,8 @@ namespace AyaNova.Biz return await ct.TaxCode.AnyAsync(z => z.Id == id); case AyaType.ServiceBank: return await ct.ServiceBank.AnyAsync(z => z.Id == id); + case AyaType.CustomerServiceRequest: + return await ct.CustomerServiceRequest.AnyAsync(z => z.Id == id); default: throw new System.NotSupportedException($"AyaNova.Biz.BizObjectExistsInDatabase::ExistsAsync type {objectType.ToString()} is not supported"); } diff --git a/server/AyaNova/biz/BizObjectFactory.cs b/server/AyaNova/biz/BizObjectFactory.cs index d5be9c6b..020f7272 100644 --- a/server/AyaNova/biz/BizObjectFactory.cs +++ b/server/AyaNova/biz/BizObjectFactory.cs @@ -100,6 +100,8 @@ namespace AyaNova.Biz return new TaxCodeBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles); case AyaType.ServiceBank: return new ServiceBankBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles); + case AyaType.CustomerServiceRequest: + return new CustomerServiceRequestBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles); diff --git a/server/AyaNova/biz/CustomerServiceRequestPriority.cs b/server/AyaNova/biz/CustomerServiceRequestPriority.cs new file mode 100644 index 00000000..4ced7d9f --- /dev/null +++ b/server/AyaNova/biz/CustomerServiceRequestPriority.cs @@ -0,0 +1,19 @@ +namespace AyaNova.Biz +{ + + public enum CustomerServiceRequestPriority : int + { + /// + /// Not urgent, service at time of choosing of service company + /// + NotUrgent = 0, + /// + /// Not an emergency but quite urgent, service as soon as possible + /// + ASAP = 1, + /// + /// Issue is an emergency, client expects service company to make it their first priority + /// + Emergency = 2 + } +}//eons \ No newline at end of file diff --git a/server/AyaNova/biz/CustomerServiceRequestStatus.cs b/server/AyaNova/biz/CustomerServiceRequestStatus.cs new file mode 100644 index 00000000..a7bab286 --- /dev/null +++ b/server/AyaNova/biz/CustomerServiceRequestStatus.cs @@ -0,0 +1,22 @@ +namespace AyaNova.Biz +{ + + public enum CustomerServiceRequestStatus : int + { + /// + /// No status set + /// (editable) + /// + Open = 0, + /// + /// Accepted for service + /// (Not editable / locked and closed) + /// + Accepted = 1, + /// + /// Declined for service + /// (editable) + /// + Declined = 2 + } +}//eons \ No newline at end of file diff --git a/server/AyaNova/models/CustomerServiceRequest.cs b/server/AyaNova/models/CustomerServiceRequest.cs new file mode 100644 index 00000000..dbf7ffe7 --- /dev/null +++ b/server/AyaNova/models/CustomerServiceRequest.cs @@ -0,0 +1,61 @@ +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 CustomerServiceRequest : 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 Tags { get; set; } + + public DateTime? DateRequested { get; set; } + [Required] + public long? CustomerId { get; set; } + public long? UnitId { get; set; } + public long? WorkorderItemId { get; set; } + + + public CustomerServiceRequest() + { + Tags = new List(); + DateRequested = DateTime.UtcNow; + } + + [NotMapped, JsonIgnore] + public AyaType AyaType { get => AyaType.CustomerServiceRequest; } + + }//eoc + +}//eons +/* + CREATE TABLE [dbo].[ACLIENTSERVICEREQUEST]( + [AID] [uniqueidentifier] NOT NULL, + [ACREATED] [datetime] NULL, + [AMODIFIED] [datetime] NULL, + [ACREATOR] [uniqueidentifier] NULL, + [AMODIFIER] [uniqueidentifier] NULL, + [ATITLE] [nvarchar](255) NOT NULL, + [ADETAILS] [ntext] NULL, + [ACLIENTID] [uniqueidentifier] NULL, + [AUNITID] [uniqueidentifier] NULL, + [AWORKORDERITEMID] [uniqueidentifier] NULL, + [ASTATUS] [smallint] NOT NULL, + [APRIORITY] [smallint] NOT NULL, + [ACLIENTREF] [nvarchar](255) NOT NULL, + [AREQUESTEDBY] [nvarchar](255) NULL, +*/ \ No newline at end of file