diff --git a/server/AyaNova/DataList/AyaDataList.cs b/server/AyaNova/DataList/AyaDataList.cs index 47eed3f7..a41682ed 100644 --- a/server/AyaNova/DataList/AyaDataList.cs +++ b/server/AyaNova/DataList/AyaDataList.cs @@ -13,7 +13,8 @@ namespace AyaNova.DataList /// internal abstract class AyaDataList : IAyaDataList { - + //CoreBizObject add here + //well, not here exactly but add a new DATALIST class if it will be displayed as a list anywhere in the UI or reported on public AyaDataList() { diff --git a/server/AyaNova/PickList/PickListFactory.cs b/server/AyaNova/PickList/PickListFactory.cs index d237b6ed..a55e0cee 100644 --- a/server/AyaNova/PickList/PickListFactory.cs +++ b/server/AyaNova/PickList/PickListFactory.cs @@ -13,7 +13,7 @@ namespace AyaNova.PickList { switch (ayaType) { - //CoreBizObject add here + //CoreBizObject add here if it will be "picked" on any other form case AyaType.Contract: return new ContractPickList() as IAyaPickList; case AyaType.Customer: diff --git a/server/AyaNova/biz/AuthorizationRoles.cs b/server/AyaNova/biz/AuthorizationRoles.cs index 66b23cc1..5d3e5328 100644 --- a/server/AyaNova/biz/AuthorizationRoles.cs +++ b/server/AyaNova/biz/AuthorizationRoles.cs @@ -55,11 +55,11 @@ namespace AyaNova.Biz InventoryFull | AccountingFull | TechLimited | TechFull | SubContractorLimited | SubContractorFull | CustomerLimited | CustomerFull | OpsAdminLimited | OpsAdminFull | SalesFull | SalesLimited, - AllInternalRoles = BizAdminLimited | BizAdminFull | DispatchLimited | DispatchFull | InventoryLimited | + AllInsideUserRoles = BizAdminLimited | BizAdminFull | DispatchLimited | DispatchFull | InventoryLimited | InventoryFull | AccountingFull | TechLimited | TechFull | SubContractorLimited | - SubContractorFull | SalesFull | SalesLimited + SubContractorFull | SalesFull | SalesLimited | OpsAdminLimited | OpsAdminFull + - }//end AuthorizationRoles //, 65536, 131072, 262144, 524288, 1,048,576 diff --git a/server/AyaNova/biz/AyaType.cs b/server/AyaNova/biz/AyaType.cs index 97a063d6..b96d07a4 100644 --- a/server/AyaNova/biz/AyaType.cs +++ b/server/AyaNova/biz/AyaType.cs @@ -114,9 +114,11 @@ namespace AyaNova.Biz ServiceBank = 55, OpsNotificationSettings = 56, Report = 57, - DashboardView=58, - [CoreBizObject] - CustomerNote = 59 + DashboardView = 58, + [CoreBizObject] + CustomerNote = 59, + [CoreBizObject] + Memo = 60 @@ -135,125 +137,3 @@ namespace AyaNova.Biz }//eons -/* - -/////////////////////////////////////////////////////////// -// RootObjectTypes.cs -// Implementation of Class RootObjectTypes -// CSLA type: enumeration -// Created on: 07-Jun-2004 8:41:36 AM -// Object design: Class Incomplete -/////////////////////////////////////////////////////////// - -using System.ComponentModel; - - -namespace GZTW.AyaNova.BLL -{ - - /// - /// RootObject types. - /// Note that some items here are not strictly root - /// objects, but are included because they need to be identified - /// for other purposes such as indexed keywords etc. - /// - public enum RootObjectTypes : int { - - [Description("LT:O.Nothing")] Nothing = 0, - [Description("LT:O.Global")] Global = 1, - [Description("LT:O.Region")] Region = 2, - [Description("LT:O.Client")] Client = 3, - [Description("LT:O.Vendor")] Vendor = 4, - [Description("LT:O.HeadOffice")] HeadOffice = 5, - [Description("LT:O.RentalUnit")] RentalUnit = 6, - [Description("LT:O.Unit")] Unit = 7, - [Description("LT:O.UnitModel")] UnitModel = 8, - [Description("LT:O.Workorder")] Workorder = 9, - [Description("LT:O.WorkorderItem")] WorkorderItem = 10, - [Description("LT:O.UserSkillAssigned")] UserSkillAssigned = 11, - [Description("LT:O.UserCertificationAssigned")] UserCertificationAssigned = 12, - [Description("LT:O.User")] User = 13, - [Description("LT:O.Part")] Part = 14, - [Description("LT:O.LoanItem")] LoanItem = 15, - [Description("LT:O.DispatchZone")] DispatchZone = 16, - [Description("LT:O.Rate")] Rate = 17, - [Description("LT:O.Contract")] Contract = 18, - [Description("LT:O.Project")] Project = 19, - [Description("LT:O.PurchaseOrder")] PurchaseOrder = 20, - [Description("LT:O.ClientGroup")] ClientGroup = 21, - [Description("LT:O.WorkorderCategory")] WorkorderCategory = 22, - [Description("LT:O.WorkorderItemScheduledUser")] WorkorderItemScheduledUser = 23, - [Description("LT:O.WorkorderItemOutsideService")] WorkorderItemOutsideService = 24, - [Description("LT:O.WorkorderItemPart")] WorkorderItemPart = 25, - [Description("LT:O.WorkorderItemLabor")] WorkorderItemLabor = 26, - [Description("LT:O.WorkorderItemTravel")] WorkorderItemTravel = 27, - [Description("LT:O.WorkorderItemMiscExpense")] WorkorderItemMiscExpense = 28, - [Description("LT:O.WorkorderItemPartRequest")] WorkorderItemPartRequest = 29, - [Description("LT:O.WorkorderItemLoan")] WorkorderItemLoan = 30, - [Description("LT:O.ClientNote")] ClientNote = 31, - [Description("LT:O.ServiceBank")] ServiceBank = 32, - [Description("LT:O.WorkorderQuote")] WorkorderQuote = 33, - [Description("LT:O.WorkorderService")] WorkorderService = 34, - [Description("LT:O.AssignedDoc")] AssignedDocument = 35, - [Description("LT:O.PartWarehouse")] PartWarehouse = 36, - [Description("LT:O.UnitMeterReading")] UnitMeterReading = 37, - [Description("LT:O.UnitModelCategory")] UnitModelCategory = 38, - [Description("LT:O.Locale")] Locale = 39, - [Description("LT:O.SearchResult")] SearchResult = 40, - [Description("LT:O.WorkorderItemType")] WorkorderItemType = 41, - [Description("LT:O.UnitServiceType")] UnitServiceType = 42, - [Description("LT:O.PartAssembly")] PartAssembly = 43, - [Description("LT:O.AyaFile")] AyaFile = 44,//case 73 - [Description("LT:O.Contact")] Contact = 45, - [Description("LT:O.ContactPhone")] ContactPhone = 46, - [Description("LT:O.WorkorderPreventiveMaintenance")] WorkorderPreventiveMaintenance = 47, - [Description("LT:O.TaskGroup")] TaskGroup = 48, - [Description("LT:O.ScheduleMarker")] ScheduleMarker = 49, - [Description("LT:O.ClientServiceRequest")] ClientServiceRequest = 50, - [Description("LT:O.ScheduleableUserGroup")] ScheduleableUserGroup = 51, - [Description("LT:O.Task")] Task = 52, - [Description("LT:O.Memo")] Memo = 53, - [Description("LT:O.PartCategory")] PartCategory=54, - [Description("LT:O.UnitOfMeasure")] UnitOfMeasure=55, - [Description("LT:O.TaxCode")] TaxCode=56, - [Description("LT:O.PartSerial")] PartSerial = 57, - [Description("LT:O.PartInventoryAdjustment")] PartInventoryAdjustment = 58, - [Description("LT:O.PartInventoryAdjustmentItem")] PartInventoryAdjustmentItem = 59, - [Description("LT:O.Priority")] Priority=60, - [Description("LT:O.UserSkill")] UserSkill=61, - [Description("LT:O.WorkorderStatus")] WorkorderStatus=62, - [Description("LT:O.UserCertification")] UserCertification=63, - [Description("LT:O.ClientNoteType")] ClientNoteType=64, - [Description("LT:O.SecurityGroup")] SecurityGroup=65, - [Description("LT:O.PurchaseOrderReceiptItem")] PurchaseOrderReceiptItem=66, - [Description("LT:O.PartByWarehouseInventory")] PartByWarehouseInventory=67, - [Description("LT:O.Report")] Report=68, - [Description("LT:O.WorkorderQuoteTemplate")] - WorkorderQuoteTemplate = 69, - [Description("LT:O.WorkorderServiceTemplate")] - WorkorderServiceTemplate = 70, - [Description("LT:O.WorkorderPreventiveMaintenanceTemplate")] - WorkorderPreventiveMaintenanceTemplate = 71, - [Description("LT:O.WikiPage")]//case 73 - WikiPage = 72, - [Description("LT:O.GridFilter")]//case 941 - GridFilter = 73, - [Description("LT:O.NotifySubscription")]//case 941 - NotifySubscription = 74, - [Description("LT:O.PurchaseOrderReceipt")]//case 941 - PurchaseOrderReceipt = 75, - [Description("LT:O.Notification")]//case 1172 - Notification = 76, - [Description("LT:UI.Go.Schedule")]//case 812 - Schedule = 77, - [Description("LT:O.WorkorderItemTask")]//case 1317 - WorkorderItemTask = 78, - [Description("LT:O.WorkorderItemUnit")]//case 1317 - WorkorderItemUnit = 79, - [Description("LT:ScheduleMarker.Label.FollowUp")]//case 1975 - FollowUp = 80 - - }//end RootObjectTypes - -}//end namespace GZTW.AyaNova.BLL - */ diff --git a/server/AyaNova/biz/BizObjectExistsInDatabase.cs b/server/AyaNova/biz/BizObjectExistsInDatabase.cs index b2f81f6c..08b3f975 100644 --- a/server/AyaNova/biz/BizObjectExistsInDatabase.cs +++ b/server/AyaNova/biz/BizObjectExistsInDatabase.cs @@ -36,12 +36,16 @@ namespace AyaNova.Biz return await ct.Widget.AnyAsync(z => z.Id == id); case AyaType.Customer: return await ct.Customer.AnyAsync(z => z.Id == id); + case AyaType.CustomerNote: + return await ct.CustomerNote.AnyAsync(z => z.Id == id); case AyaType.Contract: return await ct.Contract.AnyAsync(z => z.Id == id); case AyaType.HeadOffice: return await ct.HeadOffice.AnyAsync(z => z.Id == id); case AyaType.LoanUnit: return await ct.LoanUnit.AnyAsync(z => z.Id == id); + case AyaType.Memo: + return await ct.Memo.AnyAsync(z => z.Id == id); case AyaType.Part: return await ct.Part.AnyAsync(z => z.Id == id); case AyaType.PM: diff --git a/server/AyaNova/biz/BizObjectFactory.cs b/server/AyaNova/biz/BizObjectFactory.cs index 01450694..1ec26d11 100644 --- a/server/AyaNova/biz/BizObjectFactory.cs +++ b/server/AyaNova/biz/BizObjectFactory.cs @@ -38,7 +38,8 @@ namespace AyaNova.Biz return new CustomerNoteBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles); case AyaType.User: return new UserBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles); - + case AyaType.Memo: + return new MemoBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles); case AyaType.Contract: return new ContractBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles); diff --git a/server/AyaNova/biz/BizRoles.cs b/server/AyaNova/biz/BizRoles.cs index 3d8e658e..ef33caf8 100644 --- a/server/AyaNova/biz/BizRoles.cs +++ b/server/AyaNova/biz/BizRoles.cs @@ -593,6 +593,18 @@ namespace AyaNova.Biz Select = AuthorizationRoles.All }); + + + //////////////////////////////////////////////////////////// + //MEMO + // (everyone but outside users Customer and HO can send and receive memos) + roles.Add(AyaType.Widget, new BizRoleSet() + { + Change = AuthorizationRoles.AllInsideUserRoles, + ReadFullRecord = AuthorizationRoles.AllInsideUserRoles,, + Select = AuthorizationRoles.AllInsideUserRoles, + }); + //////////////////////////////////////////////////////////////////// #endregion all roles init diff --git a/server/AyaNova/models/Memo.cs b/server/AyaNova/models/Memo.cs new file mode 100644 index 00000000..aa331cd8 --- /dev/null +++ b/server/AyaNova/models/Memo.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Newtonsoft.Json; +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 Memo : ICoreBizObjectModel + { + public long Id { get; set; } + public uint Concurrency { get; set; } + + [Required] + public string Name { get; set; }//"subject" + // public bool Active { get; set; } + public string Notes { get; set; }//"message" + public string Wiki { get; set; } + public string CustomFields { get; set; } + public List Tags { get; set; } + + + public bool Viewed { get; set; } + public bool Replied { get; set; } + public long? FromId { get; set; } + public long? ToId { get; set; } + + public Memo() + { + Tags = new List(); + } + + [NotMapped, JsonIgnore] + public AyaType AyaType { get => AyaType.Memo; } + + }//eoc + +}//eons +/* +CREATE TABLE [dbo].[AMEMO]( + [AID] [uniqueidentifier] NOT NULL, + [ACREATED] [datetime] NULL, + [AMODIFIED] [datetime] NULL, + [ACREATOR] [uniqueidentifier] NULL, + [AMODIFIER] [uniqueidentifier] NULL, + [ASUBJECT] [nvarchar](255) NULL, + [AMESSAGE] [ntext] NULL, + [AFROMID] [uniqueidentifier] NOT NULL, + [ATOID] [uniqueidentifier] NOT NULL, + [AVIEWED] [bit] NOT NULL, + [AREPLIED] [bit] NOT NULL, +*/ \ No newline at end of file diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 6e36816e..f094409c 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -481,6 +481,13 @@ $BODY$; { LogUpdateMessage(log); + //MEMO + await ExecQueryAsync("CREATE TABLE amemo (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null, " + + "notes text, wiki text, customfields text, tags varchar(255) ARRAY, " + + "viewed bool default false, replied bool default false, fromid bigint not null REFERENCES auser(id), toid bigint not null REFERENCES auser(id) )"); + + await ExecQueryAsync("CREATE INDEX aproject_tags ON aproject using GIN(tags)"); + //CUSTOMER await ExecQueryAsync("CREATE TABLE acustomer (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " + "notes text, wiki text, customfields text, tags varchar(255) ARRAY, " + @@ -508,7 +515,7 @@ $BODY$; //HEADOFFICE await ExecQueryAsync("CREATE TABLE aheadoffice (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " + - "notes text, wiki text, customfields text, tags varchar(255) ARRAY," + + "notes text, wiki text, customfields text, tags varchar(255) ARRAY," + "webaddress text, accountnumber text, usesbanking bool, contractexpires timestamp null, contractid bigint null references acontract(id), " + "phone1 text, phone2 text, phone3 text, phone4 text, phone5 text, emailaddress text, " + "postaddress text, postcity text, postregion text, postcountry text, postcode text, address text, city text, region text, country text, latitude decimal(8,6), longitude decimal(9,6)" +