This commit is contained in:
2021-07-02 09:28:37 +01:00
parent 03873bbdf4
commit 03ea1058be
64 changed files with 3038 additions and 250 deletions
+6 -1
View File
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
//-------------------------------------------------------------------
public static class Version
{
private static String version { get; } = "1.1.0.0";
private static String version { get; } = "1.1.1.0";
// Retrieve version.
public static String GetFullVersion () { return version; }
public static String GetAppVersion ()
@@ -40,6 +40,11 @@ namespace Saxonite.Net.Standard.Base.App
//-------------------------------------------------------------------
// Version history.
//-------------------------------------------------------------------
// 1.1.2 ??-Jul-2021 Organisation Request.
// - Online Organisation Request.
// 1.1.1 2-Jul-2021 Add User fix.
// - Admin fix Internals Region cache issue on null value.
// - Optional user title.
// 1.1.0 25-Jun-2021 Article publication. Admin Regions.
// - Online Articles publication date and paging.
// - Admin Region paging and parent selection.
+13
View File
@@ -98,6 +98,7 @@ namespace Saxonite.Net.Standard.Base.App
OrganisationType,
OrganisationCategory,
OrganisationRole,
AddressType,
OpportunityType,
ActivityReaction,
};
@@ -149,6 +150,7 @@ namespace Saxonite.Net.Standard.Base.App
OrganisationEvent = 225,
// Item link components.
ItemImage = 400,
ItemAddress = 405,
ItemSport = 420,
}
@@ -279,6 +281,17 @@ namespace Saxonite.Net.Standard.Base.App
OpportunityAdmin,
}
//-------------------------------------------------------------------
public enum AddressType
{
Unknown = 0,
/* Do not change the numeric values - tied to database. */
Location = 10,
Home = 20,
Office = 50,
Delivery = 60,
}
//-------------------------------------------------------------------
/// <summary>Opportunity Type</summary>
public enum OpportunityType
+157 -91
View File
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
//---------------------------------------------------------------------------
namespace Saxonite.Base.App
{
@@ -18,6 +18,7 @@ namespace Saxonite.Base.App
{
Unknown = 0,
ActivityIndex,
ItemAddress,
ItemImage,
ItemSport,
JournalistArticle,
@@ -52,6 +53,38 @@ namespace Saxonite.Base.App
ActivityIndex_UpdateOn,
ActivityIndex_UpdateBy,
ActivityIndex_UpdateHost,
ItemAddress_Id,
ItemAddress_ItemType,
ItemAddress_ItemId,
ItemAddress_AddressType,
ItemAddress_Caption,
ItemAddress_Line1,
ItemAddress_Line2,
ItemAddress_Line3,
ItemAddress_Town,
ItemAddress_Province,
ItemAddress_RegionIdProvince,
ItemAddress_Country,
ItemAddress_RegionIdCountry,
ItemAddress_PostalCode,
ItemAddress_PhoneMain,
ItemAddress_LocationSource,
ItemAddress_LocationStoredAt,
ItemAddress_LocationUpdateRequired,
ItemAddress_LocationData,
ItemAddress_LocationFormattedAddress,
ItemAddress_LocationLatitude,
ItemAddress_LocationLongitude,
ItemAddress_LocationAltitude,
ItemAddress_Notes,
ItemAddress_Flags,
ItemAddress_Status,
ItemAddress_CreateOn,
ItemAddress_CreateBy,
ItemAddress_CreateHost,
ItemAddress_UpdateOn,
ItemAddress_UpdateBy,
ItemAddress_UpdateHost,
ItemImage_Id,
ItemImage_ItemType,
ItemImage_ItemId,
@@ -270,8 +303,8 @@ namespace Saxonite.Base.App
//-------------------------------------------------------------------
// Data members.
private static readonly int tableCount = 14;
private static readonly int columnCount = 228;
private static readonly int tableCount = 15;
private static readonly int columnCount = 260;
private static ulong maxTextLen = 0;
//-------------------------------------------------------------------
@@ -418,6 +451,7 @@ namespace Saxonite.Base.App
private static readonly String[] tables =
{
"ActivityIndex",
"ItemAddress",
"ItemImage",
"ItemSport",
"JournalistArticle",
@@ -474,30 +508,48 @@ namespace Saxonite.Base.App
new ColumnDfn(2,"Id",5,-5,true,19),
new ColumnDfn(2,"ItemType",3,5,false,5),
new ColumnDfn(2,"ItemId",4,4,false,10),
new ColumnDfn(2,"ImageType",3,5,false,5),
new ColumnDfn(2,"ImageSeq",2,-6,false,3),
new ColumnDfn(2,"SessionUid",5,-5,false,19),
new ColumnDfn(2,"ImageUid",4,4,false,10),
new ColumnDfn(2,"Filename",0,-9,false,1024),
new ColumnDfn(2,"Mime",0,12,false,64),
new ColumnDfn(2,"ContentType",0,12,false,128),
new ColumnDfn(2,"Width",4,4,false,10),
new ColumnDfn(2,"Height",4,4,false,10),
new ColumnDfn(2,"ImageData",10,-3,false,0),
new ColumnDfn(2,"AddressType",3,5,false,5),
new ColumnDfn(2,"Caption",0,-9,false,200),
new ColumnDfn(2,"Line1",0,-9,false,200),
new ColumnDfn(2,"Line2",0,-9,false,200),
new ColumnDfn(2,"Line3",0,-9,false,200),
new ColumnDfn(2,"Town",0,-9,false,100),
new ColumnDfn(2,"Province",0,-9,false,100),
new ColumnDfn(2,"RegionIdProvince",4,4,false,10),
new ColumnDfn(2,"Country",0,-9,false,100),
new ColumnDfn(2,"RegionIdCountry",4,4,false,10),
new ColumnDfn(2,"PostalCode",0,-9,false,32),
new ColumnDfn(2,"PhoneMain",0,-9,false,100),
new ColumnDfn(2,"LocationSource",0,12,false,100),
new ColumnDfn(2,"LocationStoredAt",9,93,false,16),
new ColumnDfn(2,"LocationUpdateRequired",1,-7,false,1),
new ColumnDfn(2,"LocationData",0,-9,false,4000),
new ColumnDfn(2,"LocationFormattedAddress",0,-9,false,4000),
new ColumnDfn(2,"LocationLatitude",8,3,false,9),
new ColumnDfn(2,"LocationLongitude",8,3,false,9),
new ColumnDfn(2,"LocationAltitude",8,3,false,9),
new ColumnDfn(2,"Notes",0,-9,false,2000),
new ColumnDfn(2,"Flags",3,5,false,5),
new ColumnDfn(2,"Status",0,12,false,3),
new ColumnDfn(2,"Status",0,1,false,3),
new ColumnDfn(2,"CreateOn",9,93,false,23),
new ColumnDfn(2,"CreateBy",4,4,false,10),
new ColumnDfn(2,"CreateHost",0,12,false,100),
new ColumnDfn(2,"UpdateOn",9,93,false,23),
new ColumnDfn(2,"UpdateBy",4,4,false,10),
new ColumnDfn(2,"UpdateHost",0,12,false,100),
new ColumnDfn(3,"Id",4,4,true,10),
new ColumnDfn(3,"Id",5,-5,true,19),
new ColumnDfn(3,"ItemType",3,5,false,5),
new ColumnDfn(3,"ItemId",4,4,false,10),
new ColumnDfn(3,"SportId",4,4,false,10),
new ColumnDfn(3,"ItemSportData",0,-9,false,0),
new ColumnDfn(3,"ImageType",3,5,false,5),
new ColumnDfn(3,"ImageSeq",2,-6,false,3),
new ColumnDfn(3,"SessionUid",5,-5,false,19),
new ColumnDfn(3,"ImageUid",4,4,false,10),
new ColumnDfn(3,"Filename",0,-9,false,1024),
new ColumnDfn(3,"Mime",0,12,false,64),
new ColumnDfn(3,"ContentType",0,12,false,128),
new ColumnDfn(3,"Width",4,4,false,10),
new ColumnDfn(3,"Height",4,4,false,10),
new ColumnDfn(3,"ImageData",10,-3,false,0),
new ColumnDfn(3,"Notes",0,-9,false,2000),
new ColumnDfn(3,"Flags",3,5,false,5),
new ColumnDfn(3,"Status",0,12,false,3),
@@ -508,13 +560,10 @@ namespace Saxonite.Base.App
new ColumnDfn(3,"UpdateBy",4,4,false,10),
new ColumnDfn(3,"UpdateHost",0,12,false,100),
new ColumnDfn(4,"Id",4,4,true,10),
new ColumnDfn(4,"UserAccountIdJournalist",4,4,false,10),
new ColumnDfn(4,"SportIdPrimary",4,4,false,10),
new ColumnDfn(4,"RegionIdPrimary",4,4,false,10),
new ColumnDfn(4,"Headline",0,-9,false,200),
new ColumnDfn(4,"Summary",0,-9,false,2000),
new ColumnDfn(4,"BodyData",0,-9,false,0),
new ColumnDfn(4,"PublishedAt",9,93,false,16),
new ColumnDfn(4,"ItemType",3,5,false,5),
new ColumnDfn(4,"ItemId",4,4,false,10),
new ColumnDfn(4,"SportId",4,4,false,10),
new ColumnDfn(4,"ItemSportData",0,-9,false,0),
new ColumnDfn(4,"Notes",0,-9,false,2000),
new ColumnDfn(4,"Flags",3,5,false,5),
new ColumnDfn(4,"Status",0,12,false,3),
@@ -525,14 +574,13 @@ namespace Saxonite.Base.App
new ColumnDfn(4,"UpdateBy",4,4,false,10),
new ColumnDfn(4,"UpdateHost",0,12,false,100),
new ColumnDfn(5,"Id",4,4,true,10),
new ColumnDfn(5,"Name",0,-9,false,100),
new ColumnDfn(5,"OrganisationType",0,12,false,3),
new ColumnDfn(5,"OrganisationCategory",0,12,false,3),
new ColumnDfn(5,"UserAccountIdJournalist",4,4,false,10),
new ColumnDfn(5,"SportIdPrimary",4,4,false,10),
new ColumnDfn(5,"RegionIdPrimary",4,4,false,10),
new ColumnDfn(5,"CountryIso2Code",0,12,false,2),
new ColumnDfn(5,"PhoneMain",0,-9,false,50),
new ColumnDfn(5,"PhoneAlt",0,-9,false,50),
new ColumnDfn(5,"Headline",0,-9,false,200),
new ColumnDfn(5,"Summary",0,-9,false,2000),
new ColumnDfn(5,"BodyData",0,-9,false,0),
new ColumnDfn(5,"PublishedAt",9,93,false,16),
new ColumnDfn(5,"Notes",0,-9,false,2000),
new ColumnDfn(5,"Flags",3,5,false,5),
new ColumnDfn(5,"Status",0,12,false,3),
@@ -543,15 +591,14 @@ namespace Saxonite.Base.App
new ColumnDfn(5,"UpdateBy",4,4,false,10),
new ColumnDfn(5,"UpdateHost",0,12,false,100),
new ColumnDfn(6,"Id",4,4,true,10),
new ColumnDfn(6,"OrganisationId",4,4,false,10),
new ColumnDfn(6,"Name",0,-9,false,100),
new ColumnDfn(6,"OrganisationType",0,12,false,3),
new ColumnDfn(6,"OrganisationCategory",0,12,false,3),
new ColumnDfn(6,"SportIdPrimary",4,4,false,10),
new ColumnDfn(6,"RegionIdPrimary",4,4,false,10),
new ColumnDfn(6,"OpportunityTypeCode",0,12,false,3),
new ColumnDfn(6,"Position",0,-9,false,200),
new ColumnDfn(6,"Outline",0,-9,false,2000),
new ColumnDfn(6,"OpportunityData",0,-9,false,0),
new ColumnDfn(6,"PublishedAt",9,93,false,16),
new ColumnDfn(6,"ExpiresAt",9,93,false,16),
new ColumnDfn(6,"CountryIso2Code",0,12,false,2),
new ColumnDfn(6,"PhoneMain",0,-9,false,50),
new ColumnDfn(6,"PhoneAlt",0,-9,false,50),
new ColumnDfn(6,"Notes",0,-9,false,2000),
new ColumnDfn(6,"Flags",3,5,false,5),
new ColumnDfn(6,"Status",0,12,false,3),
@@ -562,12 +609,15 @@ namespace Saxonite.Base.App
new ColumnDfn(6,"UpdateBy",4,4,false,10),
new ColumnDfn(6,"UpdateHost",0,12,false,100),
new ColumnDfn(7,"Id",4,4,true,10),
new ColumnDfn(7,"RegionType",3,5,false,5),
new ColumnDfn(7,"CountryIso2Code",0,12,false,2),
new ColumnDfn(7,"Name",0,-9,false,100),
new ColumnDfn(7,"Latitude",8,3,false,9),
new ColumnDfn(7,"Longitude",8,3,false,9),
new ColumnDfn(7,"RegionIdParent",4,4,false,10),
new ColumnDfn(7,"OrganisationId",4,4,false,10),
new ColumnDfn(7,"SportIdPrimary",4,4,false,10),
new ColumnDfn(7,"RegionIdPrimary",4,4,false,10),
new ColumnDfn(7,"OpportunityTypeCode",0,12,false,3),
new ColumnDfn(7,"Position",0,-9,false,200),
new ColumnDfn(7,"Outline",0,-9,false,2000),
new ColumnDfn(7,"OpportunityData",0,-9,false,0),
new ColumnDfn(7,"PublishedAt",9,93,false,16),
new ColumnDfn(7,"ExpiresAt",9,93,false,16),
new ColumnDfn(7,"Notes",0,-9,false,2000),
new ColumnDfn(7,"Flags",3,5,false,5),
new ColumnDfn(7,"Status",0,12,false,3),
@@ -578,7 +628,12 @@ namespace Saxonite.Base.App
new ColumnDfn(7,"UpdateBy",4,4,false,10),
new ColumnDfn(7,"UpdateHost",0,12,false,100),
new ColumnDfn(8,"Id",4,4,true,10),
new ColumnDfn(8,"RegionType",3,5,false,5),
new ColumnDfn(8,"CountryIso2Code",0,12,false,2),
new ColumnDfn(8,"Name",0,-9,false,100),
new ColumnDfn(8,"Latitude",8,3,false,9),
new ColumnDfn(8,"Longitude",8,3,false,9),
new ColumnDfn(8,"RegionIdParent",4,4,false,10),
new ColumnDfn(8,"Notes",0,-9,false,2000),
new ColumnDfn(8,"Flags",3,5,false,5),
new ColumnDfn(8,"Status",0,12,false,3),
@@ -589,24 +644,7 @@ namespace Saxonite.Base.App
new ColumnDfn(8,"UpdateBy",4,4,false,10),
new ColumnDfn(8,"UpdateHost",0,12,false,100),
new ColumnDfn(9,"Id",4,4,true,10),
new ColumnDfn(9,"EmailAddress",0,-9,false,200),
new ColumnDfn(9,"Title",0,-9,false,20),
new ColumnDfn(9,"FirstName",0,-9,false,100),
new ColumnDfn(9,"Initials",0,-9,false,10),
new ColumnDfn(9,"LastName",0,-9,false,100),
new ColumnDfn(9,"PhoneMain",0,-9,false,50),
new ColumnDfn(9,"PhoneMobile",0,-9,false,50),
new ColumnDfn(9,"PhoneAlt",0,-9,false,50),
new ColumnDfn(9,"DateOfBirth",9,93,false,16),
new ColumnDfn(9,"RegionIdCountry",4,4,false,10),
new ColumnDfn(9,"RegionIdProvince",4,4,false,10),
new ColumnDfn(9,"PasswordToken",0,12,false,32),
new ColumnDfn(9,"PasswordHashed",0,-9,false,100),
new ColumnDfn(9,"PasswordHistory",0,-9,false,0),
new ColumnDfn(9,"PasswordChangedAt",9,93,false,16),
new ColumnDfn(9,"LastLoginAt",9,93,false,16),
new ColumnDfn(9,"LastInvalidLoginAt",9,93,false,16),
new ColumnDfn(9,"InvalidLoginCount",3,5,false,5),
new ColumnDfn(9,"Name",0,-9,false,100),
new ColumnDfn(9,"Notes",0,-9,false,2000),
new ColumnDfn(9,"Flags",3,5,false,5),
new ColumnDfn(9,"Status",0,12,false,3),
@@ -616,19 +654,25 @@ namespace Saxonite.Base.App
new ColumnDfn(9,"UpdateOn",9,93,false,23),
new ColumnDfn(9,"UpdateBy",4,4,false,10),
new ColumnDfn(9,"UpdateHost",0,12,false,100),
new ColumnDfn(10,"Id",5,-5,true,19),
new ColumnDfn(10,"UserAccountId",4,4,false,10),
new ColumnDfn(10,"ItemType",3,5,false,5),
new ColumnDfn(10,"ItemId",5,-5,false,19),
new ColumnDfn(10,"CurrentlyListed",1,-7,false,1),
new ColumnDfn(10,"ListedAtFirst",9,93,false,16),
new ColumnDfn(10,"ListedAtLast",9,93,false,16),
new ColumnDfn(10,"ViewedAtFirst",9,93,false,16),
new ColumnDfn(10,"ViewedAtLast",9,93,false,16),
new ColumnDfn(10,"Reaction",3,5,false,5),
new ColumnDfn(10,"ReactedAtFirst",9,93,false,16),
new ColumnDfn(10,"ReactedAtLast",9,93,false,16),
new ColumnDfn(10,"UserActivityData",0,-9,false,0),
new ColumnDfn(10,"Id",4,4,true,10),
new ColumnDfn(10,"EmailAddress",0,-9,false,200),
new ColumnDfn(10,"Title",0,-9,false,20),
new ColumnDfn(10,"FirstName",0,-9,false,100),
new ColumnDfn(10,"Initials",0,-9,false,10),
new ColumnDfn(10,"LastName",0,-9,false,100),
new ColumnDfn(10,"PhoneMain",0,-9,false,50),
new ColumnDfn(10,"PhoneMobile",0,-9,false,50),
new ColumnDfn(10,"PhoneAlt",0,-9,false,50),
new ColumnDfn(10,"DateOfBirth",9,93,false,16),
new ColumnDfn(10,"RegionIdCountry",4,4,false,10),
new ColumnDfn(10,"RegionIdProvince",4,4,false,10),
new ColumnDfn(10,"PasswordToken",0,12,false,32),
new ColumnDfn(10,"PasswordHashed",0,-9,false,100),
new ColumnDfn(10,"PasswordHistory",0,-9,false,0),
new ColumnDfn(10,"PasswordChangedAt",9,93,false,16),
new ColumnDfn(10,"LastLoginAt",9,93,false,16),
new ColumnDfn(10,"LastInvalidLoginAt",9,93,false,16),
new ColumnDfn(10,"InvalidLoginCount",3,5,false,5),
new ColumnDfn(10,"Notes",0,-9,false,2000),
new ColumnDfn(10,"Flags",3,5,false,5),
new ColumnDfn(10,"Status",0,12,false,3),
@@ -640,9 +684,17 @@ namespace Saxonite.Base.App
new ColumnDfn(10,"UpdateHost",0,12,false,100),
new ColumnDfn(11,"Id",5,-5,true,19),
new ColumnDfn(11,"UserAccountId",4,4,false,10),
new ColumnDfn(11,"OrganisationId",4,4,false,10),
new ColumnDfn(11,"OrganisationRoleCodes",0,12,false,256),
new ColumnDfn(11,"OrganisationRoleCount",2,-6,false,3),
new ColumnDfn(11,"ItemType",3,5,false,5),
new ColumnDfn(11,"ItemId",5,-5,false,19),
new ColumnDfn(11,"CurrentlyListed",1,-7,false,1),
new ColumnDfn(11,"ListedAtFirst",9,93,false,16),
new ColumnDfn(11,"ListedAtLast",9,93,false,16),
new ColumnDfn(11,"ViewedAtFirst",9,93,false,16),
new ColumnDfn(11,"ViewedAtLast",9,93,false,16),
new ColumnDfn(11,"Reaction",3,5,false,5),
new ColumnDfn(11,"ReactedAtFirst",9,93,false,16),
new ColumnDfn(11,"ReactedAtLast",9,93,false,16),
new ColumnDfn(11,"UserActivityData",0,-9,false,0),
new ColumnDfn(11,"Notes",0,-9,false,2000),
new ColumnDfn(11,"Flags",3,5,false,5),
new ColumnDfn(11,"Status",0,12,false,3),
@@ -654,7 +706,9 @@ namespace Saxonite.Base.App
new ColumnDfn(11,"UpdateHost",0,12,false,100),
new ColumnDfn(12,"Id",5,-5,true,19),
new ColumnDfn(12,"UserAccountId",4,4,false,10),
new ColumnDfn(12,"UserRoleCode",0,12,false,16),
new ColumnDfn(12,"OrganisationId",4,4,false,10),
new ColumnDfn(12,"OrganisationRoleCodes",0,12,false,256),
new ColumnDfn(12,"OrganisationRoleCount",2,-6,false,3),
new ColumnDfn(12,"Notes",0,-9,false,2000),
new ColumnDfn(12,"Flags",3,5,false,5),
new ColumnDfn(12,"Status",0,12,false,3),
@@ -664,27 +718,39 @@ namespace Saxonite.Base.App
new ColumnDfn(12,"UpdateOn",9,93,false,23),
new ColumnDfn(12,"UpdateBy",4,4,false,10),
new ColumnDfn(12,"UpdateHost",0,12,false,100),
new ColumnDfn(13,"Id",5,-5,true,19),
new ColumnDfn(13,"UserAccountId",4,4,false,10),
new ColumnDfn(13,"ActivityIndexIds",0,-9,false,0),
new ColumnDfn(13,"UserSessionData",0,-9,false,0),
new ColumnDfn(13,"UserRoleCode",0,12,false,16),
new ColumnDfn(13,"Notes",0,-9,false,2000),
new ColumnDfn(13,"Flags",3,5,false,5),
new ColumnDfn(13,"Status",0,12,false,3),
new ColumnDfn(13,"CreateOn",9,93,false,23),
new ColumnDfn(13,"CreateBy",4,4,false,10),
new ColumnDfn(13,"CreateHost",0,12,false,100),
new ColumnDfn(13,"UpdateOn",9,93,false,23),
new ColumnDfn(14,"Id",4,4,true,10),
new ColumnDfn(13,"UpdateBy",4,4,false,10),
new ColumnDfn(13,"UpdateHost",0,12,false,100),
new ColumnDfn(14,"UserAccountId",4,4,false,10),
new ColumnDfn(14,"SportId",4,4,false,10),
new ColumnDfn(14,"Participation",3,5,false,5),
new ColumnDfn(14,"Officiating",3,5,false,5),
new ColumnDfn(14,"UserSportData",0,-9,false,0),
new ColumnDfn(14,"Notes",0,-9,false,2000),
new ColumnDfn(14,"ActivityIndexIds",0,-9,false,0),
new ColumnDfn(14,"UserSessionData",0,-9,false,0),
new ColumnDfn(14,"Flags",3,5,false,5),
new ColumnDfn(14,"Status",0,12,false,3),
new ColumnDfn(14,"CreateOn",9,93,false,23),
new ColumnDfn(14,"CreateBy",4,4,false,10),
new ColumnDfn(14,"CreateHost",0,12,false,100),
new ColumnDfn(14,"UpdateOn",9,93,false,23),
new ColumnDfn(14,"UpdateBy",4,4,false,10),
new ColumnDfn(14,"UpdateHost",0,12,false,100),
new ColumnDfn(15,"Id",4,4,true,10),
new ColumnDfn(15,"UserAccountId",4,4,false,10),
new ColumnDfn(15,"SportId",4,4,false,10),
new ColumnDfn(15,"Participation",3,5,false,5),
new ColumnDfn(15,"Officiating",3,5,false,5),
new ColumnDfn(15,"UserSportData",0,-9,false,0),
new ColumnDfn(15,"Notes",0,-9,false,2000),
new ColumnDfn(15,"Flags",3,5,false,5),
new ColumnDfn(15,"Status",0,12,false,3),
new ColumnDfn(15,"CreateOn",9,93,false,23),
new ColumnDfn(15,"CreateBy",4,4,false,10),
new ColumnDfn(15,"CreateHost",0,12,false,100),
new ColumnDfn(15,"UpdateOn",9,93,false,23),
new ColumnDfn(15,"UpdateBy",4,4,false,10),
new ColumnDfn(15,"UpdateHost",0,12,false,100),
};
//-------------------------------------------------------------------
@@ -95,6 +95,7 @@ namespace Saxonite.Net.Standard.Base.App
public List<TypeCodeDesc> OrganisationTypeCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationType); } }
public List<TypeCodeDesc> OrganisationCategoryCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } }
public List<TypeCodeDesc> OrganisationRoleCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } }
public List<TypeCodeDesc> AddressTypeCodes { get { return GetCodesOfType(Sax.CodeType.AddressType); } }
public List<TypeCodeDesc> OpportunityTypeCodes { get { return GetCodesOfType(Sax.CodeType.OpportunityType); } }
public List<TypeCodeDesc> ActivityReactionCodes { get { return GetCodesOfType(Sax.CodeType.ActivityReaction); } }
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
@@ -210,6 +211,7 @@ namespace Saxonite.Net.Standard.Base.App
QueryRegionsToCache(regionIds);
foreach (SysId regionId in regionIds)
{
if (!SysId.IsValid(regionId)) continue;
SaxRegion region = GetRegion(regionCache.GetValue(regionId, null));
if (region != null)
regions.Add(region);
@@ -284,6 +286,7 @@ namespace Saxonite.Net.Standard.Base.App
QuerySportsToCache(sportIds);
foreach (SysId sportId in sportIds)
{
if (!SysId.IsValid(sportId)) continue;
SaxSport sport = GetSport(sportCache.GetValue(sportId, null));
if (sport != null)
sports.Add(sport);
@@ -298,6 +301,50 @@ namespace Saxonite.Net.Standard.Base.App
return sport;
}
//-------------------------------------------------------------------
// Common Data Components
//-------------------------------------------------------------------
// User Accounts.
private readonly Dictionary<SysId, SaxUserAccount> userAccountCache = new Dictionary<SysId, SaxUserAccount>();
public SaxUserAccount GetUserAccount(SysId userAccountId)
{
if (!SysId.IsValid(userAccountId)) return null;
if (!userAccountCache.ContainsKey(userAccountId))
userAccountCache.Add(userAccountId, AccountMgr.GetUserAccountById(userAccountId));
return userAccountCache.GetValue(userAccountId, null);
}
public String GetUserAccountEmailAddress(SysId userAccountId)
{
SaxUserAccount userAccount = GetUserAccount(userAccountId);
return userAccount?.EmailAddress ?? "";
}
public String GetUserAccountDisplayName(SysId userAccountId)
{
SaxUserAccount userAccount = GetUserAccount(userAccountId);
return userAccount?.GetDisplayName() ?? "";
}
//-------------------------------------------------------------------
// User Accounts.
private readonly Dictionary<SysId, SaxOrganisation> organisationCache = new Dictionary<SysId, SaxOrganisation>();
public SaxOrganisation GetOrganisation(SysId organisationId)
{
if (!SysId.IsValid(organisationId)) return null;
if (!organisationCache.ContainsKey(organisationId))
organisationCache.Add(organisationId, AccountMgr.GetOrganisationById(organisationId));
return organisationCache.GetValue(organisationId, null);
}
public String GetOrganisationName(SysId organisationId)
{
SaxOrganisation organisation = GetOrganisation(organisationId);
return organisation?.Name ?? "";
}
public SysId GetOrganisationRegionId(SysId organisationId)
{
SaxOrganisation organisation = GetOrganisation(organisationId);
return organisation?.RegionIdPrimary ?? new SysId();
}
//-------------------------------------------------------------------
}
//=======================================================================
@@ -25,6 +25,7 @@ namespace Saxonite.Net.Standard.Base.App
private static readonly List<TypeCodeDesc> organisationTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> organisationCategoryCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> organisationRoleCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> addressTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> opportunityTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> activityReactionCodes = new List<TypeCodeDesc>();
@@ -140,7 +141,14 @@ namespace Saxonite.Net.Standard.Base.App
opportunityTypeCodes.Add(Sax.OpportunityType.Board, "BRD", "Board");
//---------------------------------------------------------------
// Opportunity types.
// Address Types.
addressTypeCodes.Add(Sax.AddressType.Location, "Location", "Location");
addressTypeCodes.Add(Sax.AddressType.Home, "Home", "Home");
addressTypeCodes.Add(Sax.AddressType.Office, "Office", "Office");
addressTypeCodes.Add(Sax.AddressType.Delivery, "Delivery", "Delivery");
//---------------------------------------------------------------
// Activity Reactions.
activityReactionCodes.Add(Sax.ActivityReaction.Good, "Good", "Good");
activityReactionCodes.Add(Sax.ActivityReaction.VeryGood, "VeryGood", "Very Good");
activityReactionCodes.Add(Sax.ActivityReaction.Exceptional, "Exceptional", "Exceptional");
@@ -58,6 +58,8 @@ namespace Saxonite.Net.Standard.Base.App
return new List<TypeCodeDesc>(organisationCategoryCodes);
case Sax.CodeType.OrganisationRole:
return new List<TypeCodeDesc>(organisationRoleCodes);
case Sax.CodeType.AddressType:
return new List<TypeCodeDesc>(addressTypeCodes);
case Sax.CodeType.OpportunityType:
return new List<TypeCodeDesc>(opportunityTypeCodes);
case Sax.CodeType.ActivityReaction:
@@ -0,0 +1,471 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Text;
namespace Saxonite.Net.Standard.Base.Bus
{
//=======================================================================
// ItemAddress.
//=======================================================================
public abstract class SaxItemAddress : SacsHierarchyItem
{
//-------------------------------------------------------------------
// Columns.
public enum Column
{
Pos,
Id,
// Item.
ItemType,
ItemType_Code,
ItemType_Desc,
ItemId,
Item_Caption,
// Address.
AddressType,
AddressType_Code,
AddressType_Desc,
Caption,
Line1,
Line2,
Line3,
Town,
Province,
Country,
PostalCode,
PhoneMain,
// Regions.
RegionIdProvince,
RegionProvince_Name,
RegionIdCountry,
RegionCountry_Name,
// Location.
// Associated data.
// Common.
Notes,
Flags,
Status,
Status_Desc,
Status_Ind,
CreateOn_Date,
UpdateOn_Date,
}
//-------------------------------------------------------------------
/// <summary>Properties other than common.</summary>
public class DataProperties
{
public ItemId ItemId { get; set; }
public Sax.AddressType AddressType { get; set; }
public String Caption { get; set; }
public String Line1 { get; set; }
public String Line2 { get; set; }
public String Line3 { get; set; }
public String Town { get; set; }
public String Province { get; set; }
public SysId RegionIdProvince { get; set; }
public String Country { get; set; }
public SysId RegionIdCountry { get; set; }
public String PostalCode { get; set; }
public String PhoneMain { get; set; }
// Location.
public String LocationSource { get; set; }
public DateTime LocationStoredAt { get; set; }
public bool LocationUpdateRequired { get; set; }
public String LocationData { get; set; }
public String LocationFormattedAddress { get; set; }
public Decimal LocationLatitude { get; set; }
public Decimal LocationLongitude { get; set; }
public Decimal LocationAltitude { get; set; }
}
//-------------------------------------------------------------------
// Data.
public new class Data : SacsHierarchyItem.Data
{
// Data members.
private readonly DataProperties data = new DataProperties();
// Construction.
public Data()
{
Status = DefaultStatus;
}
// Properties.
public ItemId ItemId
{
get { return data.ItemId; }
set { CheckChanged(data.ItemId, value); data.ItemId = value; }
}
public Sax.AddressType AddressType
{
get { return data.AddressType; }
set { CheckChanged((short)data.AddressType, (short)value); data.AddressType = value; }
}
public String Caption
{
get { return data.Caption; }
set { CheckChanged(data.Caption, value); data.Caption = value; }
}
public String Line1
{
get { return data.Line1; }
set { CheckChanged(data.Line1, value); data.Line1 = value; }
}
public String Line2
{
get { return data.Line2; }
set { CheckChanged(data.Line2, value); data.Line2 = value; }
}
public String Line3
{
get { return data.Line3; }
set { CheckChanged(data.Line3, value); data.Line3 = value; }
}
public String Town
{
get { return data.Town; }
set { CheckChanged(data.Town, value); data.Town = value; }
}
public String PostalCode
{
get { return data.PostalCode; }
set { CheckChanged(data.PostalCode, value); data.PostalCode = value; }
}
public String Province
{
get { return data.Province; }
set { CheckChanged(data.Province, value); data.Province = value; }
}
public SysId RegionIdProvince
{
get { return data.RegionIdProvince; }
set { CheckChanged(data.RegionIdProvince, value); data.RegionIdProvince = value; }
}
public String Country
{
get { return data.Country; }
set { CheckChanged(data.Country, value); data.Country = value; }
}
public SysId RegionIdCountry
{
get { return data.RegionIdCountry; }
set { CheckChanged(data.RegionIdCountry, value); data.RegionIdCountry = value; }
}
public String PhoneMain
{
get { return data.PhoneMain; }
set { CheckChanged(data.PhoneMain, value); data.PhoneMain = value; }
}
// Location.
public String LocationSource
{
get { return data.LocationSource; }
set { CheckChanged(data.LocationSource, value); data.LocationSource = value; }
}
public DateTime LocationStoredAt
{
get { return data.LocationStoredAt; }
set { CheckChanged(data.LocationStoredAt, value); data.LocationStoredAt = value; }
}
public bool LocationUpdateRequired
{
get { return data.LocationUpdateRequired; }
set { CheckChanged(data.LocationUpdateRequired, value); data.LocationUpdateRequired = value; }
}
public String LocationData
{
get { return data.LocationData; }
set { CheckChanged(data.LocationData, value); data.LocationData = value; }
}
public String LocationFormattedAddress
{
get { return data.LocationFormattedAddress; }
set { CheckChanged(data.LocationFormattedAddress, value); data.LocationFormattedAddress = value; }
}
public Decimal LocationLatitude
{
get { return data.LocationLatitude; }
set { CheckChanged(data.LocationLatitude, value); data.LocationLatitude = value; }
}
public Decimal LocationLongitude
{
get { return data.LocationLongitude; }
set { CheckChanged(data.LocationLongitude, value); data.LocationLongitude = value; }
}
public Decimal LocationAltitude
{
get { return data.LocationAltitude; }
set { CheckChanged(data.LocationAltitude, value); data.LocationAltitude = value; }
}
// Population.
internal void PopulateFrom(Data data)
{
ItemId = data.ItemId;
AddressType = data.AddressType;
Caption = data.Caption;
Line1 = data.Line1;
Line2 = data.Line2;
Line3 = data.Line3;
Town = data.Town;
RegionIdProvince = data.RegionIdProvince;
Province = data.Province;
RegionIdCountry = data.RegionIdCountry;
Country = data.Country;
PostalCode = data.PostalCode;
PhoneMain = data.PhoneMain;
// Location.
LocationSource = data.LocationSource;
LocationStoredAt = data.LocationStoredAt;
LocationUpdateRequired = data.LocationUpdateRequired;
LocationData = data.LocationData;
LocationFormattedAddress = data.LocationFormattedAddress;
LocationLatitude = data.LocationLatitude;
LocationLongitude = data.LocationLongitude;
LocationAltitude = data.LocationAltitude;
base.PopulateFrom(data);
}
public Data Clone()
{
Data data = new Data();
data.PopulateFrom(this);
return data;
}
}
//-------------------------------------------------------------------
// Error field - identify properties with validation error.
public new class ErrField : SacsHierarchyItem.ErrField
{
// Identifies the field that has invalid data.
public ValidValue ItemId { get; set; } = ValidValue.Valid;
public ValidValue AddressType { get; set; } = ValidValue.Valid;
public ValidValue Caption { get; set; } = ValidValue.Valid;
public ValidValue Line1 { get; set; } = ValidValue.Valid;
public ValidValue Line2 { get; set; } = ValidValue.Valid;
public ValidValue Line3 { get; set; } = ValidValue.Valid;
public ValidValue Town { get; set; } = ValidValue.Valid;
public ValidValue RegionIdProvince { get; set; } = ValidValue.Valid;
public ValidValue Province { get; set; } = ValidValue.Valid;
public ValidValue RegionIdCountry { get; set; } = ValidValue.Valid;
public ValidValue Country { get; set; } = ValidValue.Valid;
public ValidValue PostalCode { get; set; } = ValidValue.Valid;
public ValidValue PhoneMain { get; set; } = ValidValue.Valid;
// Location.
public ValidValue LocationSource { get; set; } = ValidValue.Valid;
public ValidValue LocationStoredAt { get; set; } = ValidValue.Valid;
public ValidValue LocationUpdateRequired { get; set; } = ValidValue.Valid;
public ValidValue LocationData { get; set; } = ValidValue.Valid;
public ValidValue LocationFormattedAddress { get; set; } = ValidValue.Valid;
public ValidValue LocationLatitude { get; set; } = ValidValue.Valid;
public ValidValue LocationLongitude { get; set; } = ValidValue.Valid;
public ValidValue LocationAltitude { get; set; } = ValidValue.Valid;
}
//-------------------------------------------------------------------
// Data members.
private readonly Data data = new Data();
//-------------------------------------------------------------------
// Construction.
protected SaxItemAddress(SysId id, ItemId itemId, Sax.AddressType addressType) : base(id)
{
base.SetData(data);
ItemId = itemId;
AddressType = addressType;
Status = DefaultStatus;
}
//-------------------------------------------------------------------
// Status.
private static readonly List<SaStatus> validStatuses = new List<SaStatus>()
{
SaStatus.Active,
SaStatus.Inactive,
SaStatus.Deleted,
};
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(validStatuses); } }
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
{
if (status == SaStatus.Active) return DataValue.TriStateType.Green;
if (status == SaStatus.Inactive) return DataValue.TriStateType.Red;
if (status == SaStatus.Deleted) return DataValue.TriStateType.Purple;
return DataValue.TriStateType.Unknown;
}
//-------------------------------------------------------------------
// Utilities.
public ItemId GetItemId()
{
return new ItemId((short)Sax.DataItemType.ItemAddress, Id);
}
//-------------------------------------------------------------------
// Properties.
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
if (ItemId.IsValid(ItemId) && ItemId.Type != data.ItemId.Type && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
throw new NotSupportedException(fn + " Item Id cannot be changed");
if (SysId.IsValid(RegionIdProvince) && SysId.ToInt(RegionIdProvince) != SysId.ToInt(data.RegionIdProvince))
throw new NotSupportedException(fn + " Address Id cannot be changed");
this.data.PopulateFrom(data);
}
public ItemId ItemId
{
get { return data.ItemId; }
protected set { data.ItemId = value; }
}
public Sax.AddressType AddressType
{
get { return data.AddressType; }
set { data.AddressType = value; }
}
public String Caption
{
get { return data.Caption; }
set { data.Caption = value; }
}
public String Line1
{
get { return data.Line1; }
set { data.Line1 = value; }
}
public String Line2
{
get { return data.Line2; }
set { data.Line2 = value; }
}
public String Line3
{
get { return data.Line3; }
set { data.Line3 = value; }
}
public String Town
{
get { return data.Town; }
set { data.Town = value; }
}
public String Province
{
get { return data.Province; }
set { data.Province = value; }
}
public SysId RegionIdProvince
{
get { return data.RegionIdProvince; }
set { data.RegionIdProvince = value; }
}
public String Country
{
get { return data.Country; }
set { data.Country = value; }
}
public SysId RegionIdCountry
{
get { return data.RegionIdCountry; }
set { data.RegionIdCountry = value; }
}
public String PostalCode
{
get { return data.PostalCode; }
set { data.PostalCode = value; }
}
public String PhoneMain
{
get { return data.PhoneMain; }
set { data.PhoneMain = value; }
}
// Location.
public String LocationSource
{
get { return data.LocationSource; }
set { data.LocationSource = value; }
}
public DateTime LocationStoredAt
{
get { return data.LocationStoredAt; }
set { data.LocationStoredAt = value; }
}
public bool LocationUpdateRequired
{
get { return data.LocationUpdateRequired; }
set { data.LocationUpdateRequired = value; }
}
public String LocationData
{
get { return data.LocationData; }
set { data.LocationData = value; }
}
public String LocationFormattedAddress
{
get { return data.LocationFormattedAddress; }
set { data.LocationFormattedAddress = value; }
}
public Decimal LocationLatitude
{
get { return data.LocationLatitude; }
set { data.LocationLatitude = value; }
}
public Decimal LocationLongitude
{
get { return data.LocationLongitude; }
set { data.LocationLongitude = value; }
}
public Decimal LocationAltitude
{
get { return data.LocationAltitude; }
set { data.LocationAltitude = value; }
}
//-------------------------------------------------------------------
// Flags - positions 1-16 available.
//-------------------------------------------------------------------
// A s s o c i a t e d D a t a
//-------------------------------------------------------------------
//-------------------------------------------------------------------
// P a r a m s
//-------------------------------------------------------------------
// List parameters.
public enum StatusCat
{
Any,
NotDeleted,
ActiveOnly,
InctiveOnly,
}
/// <summary>
/// Item list parameters.
/// </summary>
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
public List<ItemId> ItemIdsIncluded { get; } = new List<ItemId>();
public String AddressPartial { get; set; }
public String NotesPartial { get; set; }
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
}
//-------------------------------------------------------------------
}
//=======================================================================
// Item list extension methods.
public static class SaxItemAddressList
{
}
//=======================================================================
}
@@ -155,7 +155,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
{
if (!ReferenceMgr.SportExistsById(data.SportIdPrimary))
{
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
errField.SportIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Invalid sport specified");
}
}
@@ -163,11 +163,34 @@ namespace Saxonite.Net.Standard.Base.Mgr
// Region.
if (errField.RegionIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.RegionIdPrimary))
{
if (!ReferenceMgr.RegionExistsById(data.RegionIdPrimary))
SaxRegion region = ReferenceMgr.GetRegionById(data.RegionIdPrimary);
if (region == null)
{
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
errField.RegionIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Invalid region specified");
}
if (region.RegionType != App.Sax.RegionType.Country)
{
errField.RegionIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Region must be a country");
}
}
// Region & name must be unique.
if (errField.Name != SacsHierarchyItem.ValidValue.Ignore && !StringUtil.IsEmpty(data.Name) && errField.RegionIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.RegionIdPrimary))
{
// Name must be unique within region.
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
if (SysId.IsValid(data.Id))
prmOrganisation.IdsExcluded.Add(data.Id);
prmOrganisation.NameFull = data.Name;
prmOrganisation.RegionIdsIncluded.Add(data.RegionIdPrimary);
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.Any;
if (AccountMgr.GetOrganisationCount(prmOrganisation) > 0)
{
errField.Name = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Name must be unique within region");
}
}
}
@@ -0,0 +1,259 @@
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Saxonite.Base.App;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Bus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Saxonite.Net.Standard.Base.Mgr
{
//=======================================================================
partial class SaxItemDataMgr
{
//*******************************************************************
// Item Data Mgr - Item Address
//*******************************************************************
// Utilities.
//-------------------------------------------------------------------
// Create item.
public abstract SaxItemAddress CreateItemAddress(ItemId itemId, Sax.AddressType addressType);
//-------------------------------------------------------------------
// Item exists.
public bool ItemAddressExistsById(SysId id)
{
ClearErrorState();
if (!SysId.IsValid(id)) return false;
SaxItemAddress.Params prmItemAddress = new SaxItemAddress.Params();
prmItemAddress.IdsIncluded.Add(id);
prmItemAddress.StatusCat = SaxItemAddress.StatusCat.Any;
return GetItemAddressCount(prmItemAddress) == 1;
}
//-------------------------------------------------------------------
// Retrieve individual items.
public abstract SaxItemAddress GetItemAddress(SaxItemAddress.Params prmItemAddress);
public SaxItemAddress GetItemAddressById(SysId id)
{
ClearErrorState();
if (!SysId.IsValid(id)) return null;
SaxItemAddress.Params prmItemAddress = new SaxItemAddress.Params();
prmItemAddress.IdsIncluded.Add(id);
prmItemAddress.StatusCat = SaxItemAddress.StatusCat.Any;
return GetItemAddress(prmItemAddress);
}
//-------------------------------------------------------------------
// Validate item data.
public bool IsValidItemAddress(SaxItemAddress itemAddress)
{
ClearErrorState();
if (itemAddress == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
return IsValidItemAddressData(itemAddress.GetData(), new SaxItemAddress.ErrField());
}
public virtual bool IsValidItemAddressData(SaxItemAddress.Data data, SaxItemAddress.ErrField errField)
{
ClearErrorState();
//---------------------------------------------------------------
// Item Id.
if (errField.ItemId != SacsHierarchyItem.ValidValue.Ignore && !ItemId.IsValid(data.ItemId))
{
errField.ItemId = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Item Id must be specified");
}
// Address.
if (errField.Caption != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Caption, "caption", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Caption)))
{
errField.Caption = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
if (errField.Line1 != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Line1, "line 1", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line1)))
{
errField.Line1 = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
if (errField.Line2 != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Line2, "line 2", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line2)))
{
errField.Line2 = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
if (errField.Line3 != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Line3, "line 3", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line3)))
{
errField.Line3 = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
if (errField.Town != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Town, "town", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town), true))
{
errField.Town = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
if (errField.RegionIdProvince != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.RegionIdProvince))
{
// Province is not mandatory.
}
if (errField.Province != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Province, "province", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Province)))
{
errField.Province = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
if (errField.RegionIdCountry != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.RegionIdCountry))
{
errField.RegionIdCountry = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("Country region must be specified");
}
if (errField.Country != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Country, "country", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Country), true))
{
errField.Country = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
if (errField.PostalCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PostalCode, "postal code", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_PostalCode)))
{
errField.PostalCode = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
if (errField.PhoneMain != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PhoneMain, "country", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_PhoneMain)))
{
errField.PhoneMain = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
//---------------------------------------------------------------
// Location.
if (errField.LocationSource != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.LocationSource, "location source", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_LocationSource)))
{
errField.LocationSource = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
if (errField.LocationData != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.LocationData, "location data", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_LocationData)))
{
errField.LocationData = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
if (errField.LocationFormattedAddress != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.LocationFormattedAddress, "location source", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_LocationFormattedAddress)))
{
errField.LocationFormattedAddress = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
//---------------------------------------------------------------
// Common properties.
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Notes)))
{
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
{
if (!IsValidValue(data.StatusCode, "status", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Status), true, true))
{
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
return false;
}
if (!SaxItemAddress.ValidStatuses.Contains(data.Status))
{
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState(ErrorMessage.InvalidStatus);
}
}
//---------------------------------------------------------------
// Associated data.
if (data.Status != SaStatus.Deleted)
{
// Item must exists.
if (errField.ItemId != SacsHierarchyItem.ValidValue.Ignore && ItemId.IsValid(data.ItemId))
{
switch ((Sax.DataItemType)data.ItemId.Type)
{
case Sax.DataItemType.Organisation:
if (!AccountMgr.OrganisationExistsById(data.ItemId.Id))
return SetErrorState("Invalid organisation specified");
break;
default:
return SetErrorState("Invalid Item Type specified");
}
}
}
//---------------------------------------------------------------
return true;
}
//-------------------------------------------------------------------
// Item database interface.
public abstract bool InsertItemAddress(SaxItemAddress itemAddress, DbUpdateInfo dbUpdateInfo);
public abstract bool UpdateItemAddress(SaxItemAddress itemAddress, DbUpdateInfo dbUpdateInfo);
public virtual bool ItemAddressCanBeDeleted(SaxItemAddress itemAddress)
{
ClearErrorState();
return true;
}
public abstract bool DeleteItemAddress(SaxItemAddress itemAddress, DbUpdateInfo dbUpdateInfo);
//-------------------------------------------------------------------
// Item list.
public abstract ColumnDfn GetItemAddressColumnDfn(SaxItemAddress.Column columnId, String caption = "", int width = 0);
public abstract List<String> GetItemAddressQueryFilter(SaxItemAddress.Params prmItemAddress);
public abstract long GetItemAddressCount(SaxItemAddress.Params prmItemAddress);
public abstract List<SaxItemAddress> GetItemAddressList(SaxItemAddress.Params prmItemAddress);
public abstract DbResultSet ExecuteItemAddressQuery(List<ColumnDfn> columns, SaxItemAddress.Params prmItemAddress);
//-------------------------------------------------------------------
/// <summary>
/// Extract and format result set data value where specific handling is required.
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
/// </summary>
public virtual DataValue GetItemAddressDataValue(ColumnDfn column, NamedValue.Map values)
{
DataValue value = new DataValue();
switch ((SaxItemAddress.Column)column.Id)
{
//-----------------------------------------------------------
// Data item type.
case SaxItemAddress.Column.ItemType_Code:
{
value = new DataValue(DataItemTypeCodes.GetCodeForType(values.GetLong(column.DataName)));
}
break;
case SaxItemAddress.Column.ItemType_Desc:
{
value = new DataValue(DataItemTypeCodes.GetDescForType(values.GetLong(column.DataName)));
}
break;
//-----------------------------------------------------------
// Notes.
case SaxItemAddress.Column.Notes:
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
break;
//-----------------------------------------------------------
// Status.
case SaxItemAddress.Column.Status_Desc:
case SaxItemAddress.Column.Status_Ind:
{
String statusCode = values.GetValue(column.DataName).ToString();
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
if (column.Id == (int)SaxItemAddress.Column.Status_Desc)
value = new DataValue(SacsSystem.GetStatusDesc(status));
else if (column.Id == (int)SaxItemAddress.Column.Status_Ind)
value = new DataValue(SaxItemAddress.GetStatusTriState(status));
}
break;
//-----------------------------------------------------------
}
return value;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -74,6 +74,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
public List<TypeCodeDesc> OrganisationTypeCodes { get { return Internals.OrganisationTypeCodes; } }
public List<TypeCodeDesc> OrganisationCategoryCodes { get { return Internals.OrganisationCategoryCodes; } }
public List<TypeCodeDesc> OrganisationRoleCodes { get { return Internals.OrganisationRoleCodes; } }
public List<TypeCodeDesc> AddressTypeCodes { get { return Internals.AddressTypeCodes; } }
public List<TypeCodeDesc> OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } }
public List<TypeCodeDesc> ActivityReactionCodes { get { return Internals.ActivityReactionCodes; } }