v1.2.8
This commit is contained in:
@@ -261,6 +261,12 @@ namespace Saxonite.Net.Core.Web.Base.App
|
||||
return GetCodeTypeCaption(Sax.CodeType.OrganisationRole, organisationRole);
|
||||
}
|
||||
|
||||
// Association types.
|
||||
public String GetAssociationTypeCaption(Sax.AssociationType addressType)
|
||||
{
|
||||
return GetCodeTypeCaption(Sax.CodeType.AssociationType, addressType);
|
||||
}
|
||||
|
||||
// Address types.
|
||||
public String GetAddressTypeCaption(Sax.AddressType addressType)
|
||||
{
|
||||
|
||||
@@ -121,6 +121,7 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
|
||||
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> AssociationTypeCodes { get { return Internals.AssociationTypeCodes; } }
|
||||
public List<TypeCodeDesc> AddressTypeCodes { get { return Internals.AddressTypeCodes; } }
|
||||
public List<TypeCodeDesc> ContactMethodCodes { get { return Internals.ContactMethodCodes; } }
|
||||
public List<TypeCodeDesc> EventTypeCodes { get { return Internals.EventTypeCodes; } }
|
||||
|
||||
@@ -97,6 +97,7 @@ namespace Saxonite.Net.Core.Web.Base.Models
|
||||
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> AssociationTypeCodes { get { return Internals.AssociationTypeCodes; } }
|
||||
public List<TypeCodeDesc> AddressTypeCodes { get { return Internals.AddressTypeCodes; } }
|
||||
public List<TypeCodeDesc> ContactMethodCodes { get { return Internals.ContactMethodCodes; } }
|
||||
public List<TypeCodeDesc> EventTypeCodes { get { return Internals.EventTypeCodes; } }
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
|
||||
// Captions.
|
||||
responseData.Stats.User.Caption = Localiser["user.caption.users"];
|
||||
responseData.Stats.Organisation.Caption = Localiser["organisation.caption.organisations"];
|
||||
responseData.Stats.Organisation.Caption = Localiser["caption.organisations"];
|
||||
|
||||
// Core Database connection.
|
||||
ISacsDatabase db = SaxGlobals.App.GetCoreDatabase(SessionContext);
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// NB Only allowed if there isn't a current user session.
|
||||
if (!ValidUserSession && AppConfig.Security.SignIn.KeepLoggedIn.Allowed)
|
||||
{
|
||||
String encryptedParams = GetRequestCookie(CookieName_KeepLoggedIn);
|
||||
String encryptedParams = GetRequestCookie(KeepLoggedIn.CookieName);
|
||||
KeepLoggedInParams keepLoggedInParams = ExtractKeepLoggedInParams(encryptedParams);
|
||||
String logSuffix = keepLoggedInParams.GetValidParams().Concat("", " ", ".");
|
||||
if (SysId.IsValid(keepLoggedInParams.UserAccountId))
|
||||
|
||||
+4
-4
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
|
||||
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Controller: Organisation - Activation - Ajax
|
||||
// Controller: Organisation - Ajax - Activation
|
||||
//=======================================================================
|
||||
partial class OrganisationController
|
||||
{
|
||||
@@ -30,7 +30,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Organisation details.
|
||||
public OrganisationItemData organisation { get; } = new OrganisationItemData();
|
||||
// Member awaiting activation.
|
||||
public List<MemberData_List> Members { get; } = new List<MemberData_List>();
|
||||
public List<MemberListData> Members { get; } = new List<MemberListData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -38,7 +38,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public IActionResult Ajax_GetActivationInfo(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetActivationInfo";
|
||||
String messageTitle = Localiser["organisation.caption.organisation"];
|
||||
String messageTitle = Localiser["caption.organisation"];
|
||||
AjaxResponse_OrganisationActivationInfo responseData = new AjaxResponse_OrganisationActivationInfo(model);
|
||||
|
||||
// Validate session.
|
||||
@@ -108,7 +108,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public IActionResult Ajax_Activate(Model_OrganisationActivation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_Activate";
|
||||
String messageTitle = Localiser["organisation.caption.organisation"];
|
||||
String messageTitle = Localiser["caption.organisation"];
|
||||
AjaxResponse_Organisation responseData = new AjaxResponse_Organisation(model);
|
||||
|
||||
// Validate session.
|
||||
@@ -0,0 +1,619 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
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 Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Core.Web.Admin.Models;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using AssociationTypeOption = Saxonite.Net.Core.Web.Admin.Models.Model_OrganisationAssociations.AssociationTypeOption;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Controller: Organisation - Ajax - Associations
|
||||
//=======================================================================
|
||||
partial class OrganisationController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Association type combinations.
|
||||
//-------------------------------------------------------------------
|
||||
private static readonly String optionLabel_AffiliatedTo = "Affiliated to";
|
||||
private static readonly String optionLabel_Affiliate = "Affiliate";
|
||||
private static readonly String optionLabel_Partner = "Partner";
|
||||
// Associations are between two items (From & To) but in the context of
|
||||
// displaying associations for an organisation, the organisation may be
|
||||
// the 'From' item (normal) or the 'To' item (reversed).
|
||||
private class AssociationTypeData
|
||||
{
|
||||
public AssociationTypeData()
|
||||
{
|
||||
// No parameter construction - populating association details for individual item (see Populate()).
|
||||
}
|
||||
public AssociationTypeData(AssociationTypeOption associationTypeOption)
|
||||
{
|
||||
// Population on construction - generic association type definitions, eg. for drop down menu options.
|
||||
Populate(associationTypeOption);
|
||||
}
|
||||
public void Populate(AssociationTypeOption associationTypeOption)
|
||||
{
|
||||
// Default labels - option to select association etc.
|
||||
Type = ((int)associationTypeOption).ToString();
|
||||
Label = GetOptionLabel(associationTypeOption);
|
||||
}
|
||||
public void Populate(Sax.AssociationType associationType, bool reversed)
|
||||
{
|
||||
// Default labels - option to select association etc.
|
||||
Populate(GetAssociationTypeOption(associationType, reversed));
|
||||
}
|
||||
public void Populate(Sax.AssociationType associationType, bool reversed, String label)
|
||||
{
|
||||
// Populate for specific labels, eg. to identify nature of associated organisation.
|
||||
AssociationTypeOption associationTypeOption = GetAssociationTypeOption(associationType, reversed);
|
||||
Type = ((int)associationTypeOption).ToString();
|
||||
Label = label;
|
||||
}
|
||||
// Properties.
|
||||
public String Type { get; set; }
|
||||
public String Label { get; set; }
|
||||
// Utilities.
|
||||
public static AssociationTypeOption GetAssociationTypeOption(Sax.AssociationType associationType, bool reversed)
|
||||
{
|
||||
switch (associationType)
|
||||
{
|
||||
case Sax.AssociationType.Affiliate: return reversed ? AssociationTypeOption.AffiliatedTo : AssociationTypeOption.AffiliateParent;
|
||||
case Sax.AssociationType.Partner: return AssociationTypeOption.Partner;
|
||||
}
|
||||
return AssociationTypeOption.Unknown;
|
||||
}
|
||||
public static String GetOptionLabel(AssociationTypeOption associationTypeOption)
|
||||
{
|
||||
switch (associationTypeOption)
|
||||
{
|
||||
case AssociationTypeOption.AffiliateParent: return optionLabel_AffiliatedTo;
|
||||
case AssociationTypeOption.AffiliatedTo: return optionLabel_Affiliate;
|
||||
case AssociationTypeOption.Partner: return optionLabel_Partner;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Association data.
|
||||
//-------------------------------------------------------------------
|
||||
private class AssociationListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public class OrganisationData
|
||||
{
|
||||
public String Id { get; set; }
|
||||
public String Name { get; set; }
|
||||
}
|
||||
public OrganisationData Organisation { get; } = new OrganisationData();
|
||||
public OrganisationData OrganisationAssoc { get; } = new OrganisationData();
|
||||
public AssociationTypeData Assoc { get; } = new AssociationTypeData();
|
||||
}
|
||||
private class AssociationItemData : AssociationListData
|
||||
{
|
||||
}
|
||||
private void PopulateAssociationResponseListData(AssociationListData data, SaxItemAssociation itemAssociation, SaxOrganisation organisation, SaxOrganisation organisationAssoc)
|
||||
{
|
||||
data.Id = SysId.ToString(itemAssociation.Id);
|
||||
// Organisation.
|
||||
data.Organisation.Id = SysId.ToString(organisation.Id);
|
||||
data.Organisation.Name = organisation.Name;
|
||||
// Associated Organisation.
|
||||
data.OrganisationAssoc.Id = SysId.ToString(organisationAssoc.Id);
|
||||
data.OrganisationAssoc.Name = organisationAssoc.Name;
|
||||
// Association type.
|
||||
bool associationReversed = itemAssociation.ItemIdTo.Id.Equals(organisation.Id);
|
||||
String associationLabel = "";
|
||||
if (itemAssociation.AssociationType == Sax.AssociationType.Affiliate)
|
||||
associationLabel = associationReversed ? "Member organisation" : associationLabel = "Parent organisation";
|
||||
else if (itemAssociation.AssociationType == Sax.AssociationType.Partner)
|
||||
associationLabel = "Partner organisation";
|
||||
data.Assoc.Populate(itemAssociation.AssociationType, associationReversed, associationLabel);
|
||||
// Common properties.
|
||||
data.StatusCode = itemAssociation.StatusCode;
|
||||
data.StatusDesc = itemAssociation.StatusDesc;
|
||||
}
|
||||
private void PopulateAssociationResponseItemData(AssociationItemData data, SaxItemAssociation itemAssociation, SaxOrganisation organisation, SaxOrganisation organisationAssoc)
|
||||
{
|
||||
PopulateAssociationResponseListData(data, itemAssociation, organisation, organisationAssoc);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Organisation Association List ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_AssociationList : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_AssociationList(SaxModel_Admin model) : base(model) { }
|
||||
// Association list.
|
||||
public List<AssociationListData> Associations { get; } = new List<AssociationListData>();
|
||||
// Reference data.
|
||||
public List<AssociationTypeData> AssociationTypes { get; } = new List<AssociationTypeData>();
|
||||
public List<CodeDesc> Statuses { get; } = new List<CodeDesc>();
|
||||
public String DefaultStatusCode { get; set; }
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/GetAssociationList")]
|
||||
[Route("Organisation/Ajax/GetAssociations")]
|
||||
public IActionResult Ajax_GetAssociationList(Model_OrganisationAssociations model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetAssociationList";
|
||||
String messageTitle = Localiser["caption.organisation.associations"];
|
||||
AjaxResponse_AssociationList responseData = new AjaxResponse_AssociationList(model);
|
||||
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Organisation Id is mandatory.
|
||||
SysId organisationId = model.Filter.OrganisationId.ToSysId();
|
||||
if (!SysId.IsValid(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Request to retrieve associations without valid organisation Id.");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
}
|
||||
|
||||
// Reference data - association types.
|
||||
// 'Label' is option caption to add new association of the specified type.
|
||||
responseData.AssociationTypes.Add(new AssociationTypeData(AssociationTypeOption.AffiliateParent));
|
||||
responseData.AssociationTypes.Add(new AssociationTypeData(AssociationTypeOption.AffiliatedTo));
|
||||
responseData.AssociationTypes.Add(new AssociationTypeData(AssociationTypeOption.Partner));
|
||||
|
||||
// Reference data - statuses.
|
||||
foreach (SaStatus status in SaxItemAssociation.ValidStatuses.FindAll(item => item != SaStatus.Deleted))
|
||||
responseData.Statuses.Add(SacsSystem.GetStatusCode(status), Localiser.GetStatusCaption(status));
|
||||
responseData.DefaultStatusCode = SacsSystem.GetStatusCode(SaxItemAssociation.DefaultStatus);
|
||||
|
||||
// Get organisation associations.
|
||||
GetOrganisationAssociations(model, organisationId, responseData.Associations);
|
||||
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Associations.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
private void GetOrganisationAssociations(SaxModel_Admin model, SysId organisationId, List<AssociationListData> associations)
|
||||
{
|
||||
String fn = GetType().Name + ".GetOrganisationAssociations";
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
|
||||
// Item filter.
|
||||
SaxItemAssociation.Params prmItemAssociation = new SaxItemAssociation.Params();
|
||||
prmItemAssociation.ItemIdsIncluded.Add(new ItemId((short)Sax.DataItemType.Organisation, organisationId));
|
||||
prmItemAssociation.StatusCat = SaxItemAssociation.StatusCat.NotDeleted;
|
||||
model.Paging.ItemTotal = (ulong)ItemDataMgr.GetItemAssociationCount(prmItemAssociation);
|
||||
model.PopulatePagingTo(prmItemAssociation.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
ColumnDfn colId = ItemDataMgr.GetItemAssociationColumnDfn(SaxItemAssociation.Column.Id);
|
||||
ColumnDfn colItemTypeFrom = ItemDataMgr.GetItemAssociationColumnDfn(SaxItemAssociation.Column.ItemTypeFrom);
|
||||
ColumnDfn colItemIdFrom = ItemDataMgr.GetItemAssociationColumnDfn(SaxItemAssociation.Column.ItemIdFrom);
|
||||
ColumnDfn colItemTypeTo = ItemDataMgr.GetItemAssociationColumnDfn(SaxItemAssociation.Column.ItemTypeTo);
|
||||
ColumnDfn colItemIdTo = ItemDataMgr.GetItemAssociationColumnDfn(SaxItemAssociation.Column.ItemIdTo);
|
||||
ColumnDfn colAssociationType = ItemDataMgr.GetItemAssociationColumnDfn(SaxItemAssociation.Column.AssociationType);
|
||||
ColumnDfn colStatus = ItemDataMgr.GetItemAssociationColumnDfn(SaxItemAssociation.Column.Status);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId,
|
||||
colItemTypeFrom, colItemIdFrom,
|
||||
colItemTypeTo, colItemIdTo,
|
||||
colAssociationType,
|
||||
colStatus
|
||||
};
|
||||
|
||||
// Query items.
|
||||
List<SysId> organisationIds = new List<SysId>();
|
||||
using (DbResultSet resultSet = ItemDataMgr.ExecuteItemAssociationQuery(columns, prmItemAssociation))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
AssociationListData associationData = new AssociationListData()
|
||||
{
|
||||
Id = values.GetString(colId.DataName),
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName)),
|
||||
};
|
||||
// Items.
|
||||
bool assiationReversed = false;
|
||||
ItemId itemIdFrom = new ItemId((short)values.GetLong(colItemTypeFrom.DataName), new SysId(values.GetLong(colItemIdFrom.DataName)));
|
||||
ItemId itemIdTo = new ItemId((short)values.GetLong(colItemTypeTo.DataName), new SysId(values.GetLong(colItemIdTo.DataName)));
|
||||
if (ItemId.IsValid(itemIdFrom) && ItemId.IsValid(itemIdTo) && itemIdFrom.Type == (int)Sax.DataItemType.Organisation && itemIdTo.Type == (int)Sax.DataItemType.Organisation)
|
||||
{
|
||||
organisationIds.AddId(itemIdFrom.Id);
|
||||
organisationIds.AddId(itemIdTo.Id);
|
||||
if (itemIdFrom.Id.Equals(organisationId))
|
||||
{
|
||||
associationData.Organisation.Id = SysId.ToString(itemIdFrom.Id);
|
||||
associationData.OrganisationAssoc.Id = SysId.ToString(itemIdTo.Id);
|
||||
}
|
||||
else if (itemIdTo.Id.Equals(organisationId))
|
||||
{
|
||||
assiationReversed = true;
|
||||
associationData.Organisation.Id = SysId.ToString(itemIdTo.Id);
|
||||
associationData.OrganisationAssoc.Id = SysId.ToString(itemIdFrom.Id);
|
||||
}
|
||||
else if (SacsSystem.DebugMode)
|
||||
// Track invalid associations, ie. where neither item is this organisation.
|
||||
Debugger.Break();
|
||||
}
|
||||
else if (SacsSystem.DebugMode)
|
||||
// Track invalid associations, ie. where either item is not an organisation.
|
||||
Debugger.Break();
|
||||
// Association type.
|
||||
Sax.AssociationType associationType = (Sax.AssociationType)values.GetLong(colAssociationType.DataName);
|
||||
associationData.Assoc.Populate(associationType, assiationReversed);
|
||||
// Add association to the list.
|
||||
associations.Add(associationData);
|
||||
}
|
||||
}
|
||||
// Populate organisation details.
|
||||
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||
prmOrganisation.IdsIncluded.AddRange(organisationIds);
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.Any;
|
||||
List<SaxOrganisation> organisations = AccountMgr.GetOrganisationList(prmOrganisation);
|
||||
disposableItems.AddRange(organisations);
|
||||
foreach (AssociationListData associationData in associations)
|
||||
{
|
||||
associationData.Organisation.Name = organisations.GetOrganisationName(new SysId(StringUtil.ToLong(associationData.Organisation.Id)));
|
||||
associationData.OrganisationAssoc.Name = organisations.GetOrganisationName(new SysId(StringUtil.ToLong(associationData.OrganisationAssoc.Id)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Organisation Association ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_Association : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_Association(SaxModel_Admin model) : base(model) { }
|
||||
// Association details.
|
||||
public AssociationItemData Association { get; } = new AssociationItemData();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/GetAssociation")]
|
||||
public IActionResult Ajax_GetAssociation(Model_OrganisationAssociations model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetAssociation";
|
||||
String messageTitle = Localiser["caption.organisation.association"];
|
||||
AjaxResponse_Association responseData = new AjaxResponse_Association(model);
|
||||
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
|
||||
// Identify item.
|
||||
SysId itemAssociationId = model.ItemAssociationId.ToSysId();
|
||||
if (!SysId.IsValid(itemAssociationId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
// Retrieve association.
|
||||
SaxItemAssociation itemAssociation = ItemDataMgr.GetItemAssociationById(itemAssociationId);
|
||||
disposableItems.Add(itemAssociation);
|
||||
if (itemAssociation == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve Item Association for Id: '" + model.ItemAssociationId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Identify organisations.
|
||||
SysId organisationId = model.OrganisationId.ToSysId();
|
||||
SysId organisationIdAssoc = null;
|
||||
if (!SysId.IsValid(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Organisation Id must be supplied.");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.incomplete"]));
|
||||
}
|
||||
|
||||
// Validate the association.
|
||||
if (itemAssociation.ItemIdFrom.Type != (int)Sax.DataItemType.Organisation)
|
||||
{
|
||||
SaLogger.Warn(fn + " Inconsistent association 'From' item type: " + AssociationTypeCodes.GetCodeForType(itemAssociation.ItemIdFrom.Type) + ". Expected: Organisation.");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.inconsistent"]));
|
||||
}
|
||||
if (itemAssociation.ItemIdTo.Type != (int)Sax.DataItemType.Organisation)
|
||||
{
|
||||
SaLogger.Warn(fn + " Inconsistent association 'To' item type: " + AssociationTypeCodes.GetCodeForType(itemAssociation.ItemIdTo.Type) + ". Expected: Organisation.");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.inconsistent"]));
|
||||
}
|
||||
|
||||
// Identify organisations from association items.
|
||||
// The specified organisation must be one or other of the association's items.
|
||||
if (itemAssociation.ItemIdFrom.Id.Equals(organisationId))
|
||||
organisationIdAssoc = itemAssociation.ItemIdTo.Id;
|
||||
else if (itemAssociation.ItemIdTo.Id.Equals(organisationId))
|
||||
organisationIdAssoc = itemAssociation.ItemIdFrom.Id;
|
||||
else
|
||||
{
|
||||
SaLogger.Warn(fn + " Inconsistent association - Specified organisation is neither item.");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.inconsistent"]));
|
||||
}
|
||||
|
||||
// Retrieve Organisation.
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
disposableItems.Add(organisation);
|
||||
if (organisation == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve Organisation for Id: '" + organisationId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Retrieve associated Organisation.
|
||||
SaxOrganisation organisationAssoc = AccountMgr.GetOrganisationById(organisationIdAssoc);
|
||||
disposableItems.Add(organisationAssoc);
|
||||
if (organisationAssoc == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve Organisation for Id: '" + organisationIdAssoc + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateAssociationResponseItemData(responseData.Association, itemAssociation, organisation, organisationAssoc);
|
||||
}
|
||||
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Store Organisation Association ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/StoreAssociation")]
|
||||
public IActionResult Ajax_StoreAssociation(Model_OrganisationAssociations model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_StoreAssociation";
|
||||
String messageTitle = Localiser["caption.organisation.association"];
|
||||
AjaxResponse_Association responseData = new AjaxResponse_Association(model);
|
||||
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Validate item properties.
|
||||
model.ValidateOrganisationAssociationData(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
|
||||
// Organisation.
|
||||
SysId organisationId = model.OrganisationId.ToSysId();
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
disposableItems.Add(organisation);
|
||||
if (organisation == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve Organisation for Id: " + model.OrganisationId);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.incomplete"]));
|
||||
}
|
||||
|
||||
// Associated Organisation.
|
||||
SysId organisationIdAssoc = model.OrganisationIdAssoc.ToSysId();
|
||||
SaxOrganisation organisationAssoc = AccountMgr.GetOrganisationById(organisationIdAssoc);
|
||||
disposableItems.Add(organisationAssoc);
|
||||
if (organisationAssoc == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve associated Organisation for Id: " + model.OrganisationIdAssoc);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.incomplete"]));
|
||||
}
|
||||
if (organisationIdAssoc.Equals(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Associated organisation must not be the same as the organisation.");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.inconsistent"]));
|
||||
}
|
||||
|
||||
// Association type.
|
||||
Sax.AssociationType associationType = model.GetAssociationTypeForOption(model.Association.GetAssociationTypeOption());
|
||||
if ((int)associationType < 1)
|
||||
{
|
||||
SaLogger.Warn(fn + " Association Type must be specified.");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.inconsistent"]));
|
||||
}
|
||||
AssociationTypeOption associationTypeOption = model.Association.GetAssociationTypeOption();
|
||||
if ((int)associationTypeOption < 1)
|
||||
{
|
||||
SaLogger.Warn(fn + " Association Type Option must be specified.");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.inconsistent"]));
|
||||
}
|
||||
if (!model.IsConsistentWith(associationTypeOption, associationType))
|
||||
{
|
||||
SaLogger.Warn(fn + " Association Type Option (" + associationTypeOption + ") is inconsistent with Association Type (" + associationType + ").");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.inconsistent"]));
|
||||
}
|
||||
|
||||
// Identify From/To items.
|
||||
ItemId itemIdFrom = organisation.GetItemId();
|
||||
ItemId itemIdTo = organisationAssoc.GetItemId();
|
||||
if (model.IsAssociationTypeDirectionReversed(associationTypeOption))
|
||||
{
|
||||
itemIdFrom = organisationAssoc.GetItemId();
|
||||
itemIdTo = organisation.GetItemId();
|
||||
}
|
||||
|
||||
// Retrieve existing association.
|
||||
SysId itemAssociationId = model.ItemAssociationId.ToSysId();
|
||||
if (SysId.IsValid(itemAssociationId) == StringUtil.ToBool(model.NewItem))
|
||||
{
|
||||
// Inconsistentcy between the 'Existing' flag and whether the Item Association Id has been specified.
|
||||
SaLogger.Warn(fn + " Item Association Id " + (StringUtil.ToBool(model.NewItem) ? "specified for new item" : "not specified for existing item") + ".");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.inconsistent"]));
|
||||
}
|
||||
SaxItemAssociation itemAssociation = ItemDataMgr.GetItemAssociationById(itemAssociationId);
|
||||
disposableItems.Add(itemAssociation);
|
||||
if (itemAssociation == null && SysId.IsValid(itemAssociationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve item association for Id: '" + itemAssociationId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
if (itemAssociation != null)
|
||||
{
|
||||
// Validate From/To items.
|
||||
if (!itemAssociation.ItemIdFrom.Equals(itemIdFrom))
|
||||
{
|
||||
SaLogger.Warn(fn + " Inconsistent association - expected 'From' Item Id: " + SysId.ToString(organisation.Id) + ". Found: " + SysId.ToString(itemAssociation.ItemIdFrom.Id));
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
if (!itemAssociation.ItemIdTo.Equals(itemIdTo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Inconsistent association - expected 'To' Item Id: " + SysId.ToString(organisation.Id) + ". Found: " + SysId.ToString(itemAssociation.ItemIdTo.Id));
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Item Association not identified.
|
||||
|
||||
// Check for deleted association that can be reused.
|
||||
SaxItemAssociation.Params itemAssociationParams = new SaxItemAssociation.Params();
|
||||
|
||||
if (itemAssociation != null)
|
||||
itemAssociation.Status = SaxItemAssociation.DefaultStatus;
|
||||
else
|
||||
{
|
||||
// Association not found - create a new one.
|
||||
itemAssociation = ItemDataMgr.CreateItemAssociation(itemIdFrom, itemIdTo, associationType);
|
||||
}
|
||||
disposableItems.Add(itemAssociation);
|
||||
}
|
||||
|
||||
// Populate item properties.
|
||||
if (model.Association.StatusCode != null)
|
||||
itemAssociation.Status = model.Association.GetStatus();
|
||||
|
||||
// Store item.
|
||||
if (!SysId.IsValid(itemAssociation.Id))
|
||||
{
|
||||
if (!ItemDataMgr.InsertItemAssociation(itemAssociation, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert user organisation: " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + ItemDataMgr.ErrorStateMessage));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ItemDataMgr.UpdateItemAssociation(itemAssociation, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update user organisation [Id:" + SysId.ToString(itemAssociation.Id) + "]: " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + ItemDataMgr.ErrorStateMessage));
|
||||
}
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateAssociationResponseItemData(responseData.Association, itemAssociation, organisation, organisationAssoc);
|
||||
}
|
||||
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Remove Organisation Association ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/RemoveAssociation")]
|
||||
public IActionResult Ajax_RemoveAssociation(Model_OrganisationAssociations model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_RemoveAssociation";
|
||||
String messageTitle = Localiser["caption.organisation.association"];
|
||||
AjaxResponse_Association responseData = new AjaxResponse_Association(model);
|
||||
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
|
||||
// Organisation.
|
||||
SysId organisationId = model.OrganisationId.ToSysId();
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
disposableItems.Add(organisation);
|
||||
if (organisation == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve Organisation for Id: '" + model.OrganisationId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.incomplete"]));
|
||||
}
|
||||
|
||||
// Association Organisation.
|
||||
SysId organisationIdAssoc = model.OrganisationIdAssoc.ToSysId();
|
||||
SaxOrganisation organisationAssoc = AccountMgr.GetOrganisationById(organisationIdAssoc);
|
||||
disposableItems.Add(organisationAssoc);
|
||||
if (organisationAssoc == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve associated Organisation for Id: '" + model.OrganisationIdAssoc + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.incomplete"]));
|
||||
}
|
||||
if (organisationIdAssoc.Equals(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Associated organisation must not be the same as the organisation.");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.inconsistent"]));
|
||||
}
|
||||
|
||||
// Item Association.
|
||||
SysId itemAssociationId = model.ItemAssociationId.ToSysId();
|
||||
SaxItemAssociation itemAssociation = ItemDataMgr.GetItemAssociationById(itemAssociationId);
|
||||
disposableItems.Add(itemAssociation);
|
||||
if (itemAssociation == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve Item Association for Id: '" + itemAssociationId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Validate association Item Ids.
|
||||
if (!itemAssociation.ItemIdFrom.Id.Equals(organisation.Id) && !itemAssociation.ItemIdTo.Id.Equals(organisation.Id))
|
||||
{
|
||||
SaLogger.Warn(fn + " Inconsistent user organisation properties. Organisation must be 'From' or 'To' item");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.inconsistent"]));
|
||||
}
|
||||
if (!itemAssociation.ItemIdFrom.Id.Equals(organisationAssoc.Id) && !itemAssociation.ItemIdTo.Id.Equals(organisationAssoc.Id))
|
||||
{
|
||||
SaLogger.Warn(fn + " Inconsistent user organisation properties. Associated Organisation must be 'From' or 'To' item");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.data.inconsistent"]));
|
||||
}
|
||||
|
||||
// Logically delete item.
|
||||
itemAssociation.Status = SaStatus.Deleted;
|
||||
if (!ItemDataMgr.UpdateItemAssociation(itemAssociation, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update Item Association [Id:" + SysId.ToString(itemAssociation.Id) + "]: " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + ItemDataMgr.ErrorStateMessage));
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateAssociationResponseItemData(responseData.Association, itemAssociation, organisation, organisationAssoc);
|
||||
}
|
||||
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
+17
-17
@@ -15,13 +15,13 @@ using System.Threading.Tasks;
|
||||
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Controller: Organisation - Members - Ajax
|
||||
// Controller: Organisation - Ajax - Members
|
||||
//=======================================================================
|
||||
partial class OrganisationController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Member data.
|
||||
private class MemberData_List : AjaxResponse_Data.ItemData_Base
|
||||
private class MemberListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
// User.
|
||||
public String UserAccountId { get; set; }
|
||||
@@ -38,12 +38,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public int RoleCount { get; set; }
|
||||
public bool? Member { get; set; } = null;
|
||||
}
|
||||
private class MemberData_Full : MemberData_List
|
||||
private class MemberItemData : MemberListData
|
||||
{
|
||||
// Organisation user.
|
||||
public List<String> RoleCodes { get; } = new List<string>();
|
||||
}
|
||||
private void PopulateMemberResponseData(MemberData_List data, SaxUserOrganisation userOrganisation, SaxUserAccount userAccount, SaxOrganisation organisation)
|
||||
private void PopulateMemberResponseListData(MemberListData data, SaxUserOrganisation userOrganisation, SaxUserAccount userAccount, SaxOrganisation organisation)
|
||||
{
|
||||
data.Id = SysId.ToString(userOrganisation.Id);
|
||||
// User.
|
||||
@@ -63,9 +63,9 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (userOrganisation.GetOrganisationRoles().ToList().Exists(item => item == Sax.OrganisationRole.Member))
|
||||
data.Member = true;
|
||||
}
|
||||
private void PopulateMemberResponseData(MemberData_Full data, SaxUserOrganisation userOrganisation, SaxUserAccount userAccount, SaxOrganisation organisation)
|
||||
private void PopulateMemberResponseItemData(MemberItemData data, SaxUserOrganisation userOrganisation, SaxUserAccount userAccount, SaxOrganisation organisation)
|
||||
{
|
||||
PopulateMemberResponseData(data as MemberData_List, userOrganisation, userAccount, organisation);
|
||||
PopulateMemberResponseListData(data, userOrganisation, userAccount, organisation);
|
||||
// Organisation user:
|
||||
// Exclude 'Member' role.
|
||||
foreach (Sax.OrganisationRole organisationRole in userOrganisation.GetOrganisationRoles().ToList().FindAll(item => item != Sax.OrganisationRole.Member))
|
||||
@@ -80,7 +80,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_MemberList(SaxModel_Admin model) : base(model) { }
|
||||
// Member list.
|
||||
public List<MemberData_List> Members { get; } = new List<MemberData_List>();
|
||||
public List<MemberListData> Members { get; } = new List<MemberListData>();
|
||||
// Reference data.
|
||||
public List<CodeDesc> MemberRoles { get; } = new List<CodeDesc>();
|
||||
public List<CodeDesc> Statuses { get; } = new List<CodeDesc>();
|
||||
@@ -92,7 +92,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public IActionResult Ajax_GetMemberList(Model_OrganisationMembers model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetMemberList";
|
||||
String messageTitle = Localiser["organisation.caption.members"];
|
||||
String messageTitle = Localiser["caption.organisation.members"];
|
||||
AjaxResponse_MemberList responseData = new AjaxResponse_MemberList(model);
|
||||
|
||||
// Validate session.
|
||||
@@ -128,7 +128,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
private void GetOrganisationMembers(SaxModel_Admin model, SysId organisationId, List<MemberData_List> members)
|
||||
private void GetOrganisationMembers(SaxModel_Admin model, SysId organisationId, List<MemberListData> members)
|
||||
{
|
||||
// Item filter.
|
||||
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
@@ -165,7 +165,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
MemberData_List memberData = new MemberData_List()
|
||||
MemberListData memberData = new MemberListData()
|
||||
{
|
||||
Id = values.GetString(colId.DataName),
|
||||
// User.
|
||||
@@ -196,7 +196,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_Member(SaxModel_Admin model) : base(model) { }
|
||||
// Member details.
|
||||
public MemberData_Full Member { get; } = new MemberData_Full();
|
||||
public MemberItemData Member { get; } = new MemberItemData();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -204,7 +204,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public IActionResult Ajax_GetMember(Model_OrganisationMembers model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetItem";
|
||||
String messageTitle = Localiser["organisation.caption.member"];
|
||||
String messageTitle = Localiser["caption.organisation.member"];
|
||||
AjaxResponse_Member responseData = new AjaxResponse_Member(model);
|
||||
|
||||
// Validate session.
|
||||
@@ -248,7 +248,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateMemberResponseData(responseData.Member, userOrganisation, userAccount, organisation);
|
||||
PopulateMemberResponseItemData(responseData.Member, userOrganisation, userAccount, organisation);
|
||||
}
|
||||
|
||||
responseData.Success = true;
|
||||
@@ -263,7 +263,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public IActionResult Ajax_StoreMember(Model_OrganisationMembers model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_StoreMember";
|
||||
String messageTitle = Localiser["organisation.caption.member"];
|
||||
String messageTitle = Localiser["caption.organisation.member"];
|
||||
AjaxResponse_Member responseData = new AjaxResponse_Member(model);
|
||||
|
||||
// Validate session.
|
||||
@@ -375,7 +375,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateMemberResponseData(responseData.Member, userOrganisation, userAccount, organisation);
|
||||
PopulateMemberResponseItemData(responseData.Member, userOrganisation, userAccount, organisation);
|
||||
}
|
||||
|
||||
responseData.Success = true;
|
||||
@@ -390,7 +390,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public IActionResult Ajax_RemoveMember(Model_OrganisationMembers model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_RemoveMember";
|
||||
String messageTitle = Localiser["organisation.caption.member"];
|
||||
String messageTitle = Localiser["caption.organisation.member"];
|
||||
AjaxResponse_Member responseData = new AjaxResponse_Member(model);
|
||||
|
||||
// Validate session.
|
||||
@@ -457,7 +457,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateMemberResponseData(responseData.Member, userOrganisation, userAccount, organisation);
|
||||
PopulateMemberResponseItemData(responseData.Member, userOrganisation, userAccount, organisation);
|
||||
}
|
||||
|
||||
responseData.Success = true;
|
||||
@@ -133,7 +133,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public IActionResult Ajax_GetList(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetList";
|
||||
String messageTitle = Localiser["organisation.caption.organisations"];
|
||||
String messageTitle = Localiser["caption.organisations"];
|
||||
AjaxResponse_OrganisationList responseData = new AjaxResponse_OrganisationList(model);
|
||||
|
||||
// Validate session.
|
||||
@@ -253,7 +253,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public IActionResult Ajax_GetItem(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetItem";
|
||||
String messageTitle = Localiser["organisation.caption.organisation"];
|
||||
String messageTitle = Localiser["caption.organisation"];
|
||||
AjaxResponse_Organisation responseData = new AjaxResponse_Organisation(model);
|
||||
|
||||
// Validate session.
|
||||
@@ -299,7 +299,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public IActionResult Ajax_StoreItem(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_StoreItem";
|
||||
String messageTitle = Localiser["organisation.caption.organisation"];
|
||||
String messageTitle = Localiser["caption.organisation"];
|
||||
AjaxResponse_Organisation responseData = new AjaxResponse_Organisation(model);
|
||||
|
||||
// Validate session.
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public IActionResult Ajax_GetImages(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetImages";
|
||||
String messageTitle = Localiser["organisation.caption.organisation"];
|
||||
String messageTitle = Localiser["caption.organisation"];
|
||||
AjaxResponse_OrganisationImages responseData = new AjaxResponse_OrganisationImages(model);
|
||||
|
||||
// Validate session.
|
||||
@@ -113,7 +113,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
String fn = GetType().Name + ".UploadOrganisationLogoImage";
|
||||
AjaxResponse_UploadOrganisationLogoImage responseData = new AjaxResponse_UploadOrganisationLogoImage(model);
|
||||
String messageTitle = Localiser["organisation.caption.organisation"];
|
||||
String messageTitle = Localiser["caption.organisation"];
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
@@ -223,7 +223,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public IActionResult Ajax_StoreImages(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_StoreImages";
|
||||
String messageTitle = Localiser["organisation.caption.organisation"];
|
||||
String messageTitle = Localiser["caption.organisation"];
|
||||
AjaxResponse_OrganisationImages responseData = new AjaxResponse_OrganisationImages(model);
|
||||
|
||||
// Validate session.
|
||||
|
||||
@@ -68,10 +68,37 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return RedirectToAction("", "");
|
||||
|
||||
// Retrieve organisation.
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(model.Filter.OrganisationId.ToSysId());
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(model.OrganisationId.ToSysId());
|
||||
if (organisation == null)
|
||||
RedirectToAction("", "Organisation");
|
||||
model.MemberOrganisationName = organisation?.Name;
|
||||
model.Filter.OrganisationId= SysId.ToString(organisation.Id);
|
||||
model.Filter.OrganisationName = organisation.Name;
|
||||
|
||||
// Paging.
|
||||
model.Paging.PageNo = 1;
|
||||
model.Paging.PageLength = 12;
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Organisation Associations action.
|
||||
/// <para>- POST action to allow Organisation Id to be supplied, eg. from Organsiations page.</para>
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public IActionResult Associations(Model_OrganisationAssociations model)
|
||||
{
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
// Retrieve organisation.
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(model.OrganisationId.ToSysId());
|
||||
if (organisation == null)
|
||||
RedirectToAction("", "Organisation");
|
||||
model.Filter.OrganisationId = SysId.ToString(organisation.Id);
|
||||
model.Filter.OrganisationName = organisation.Name;
|
||||
|
||||
// Paging.
|
||||
model.Paging.PageNo = 1;
|
||||
|
||||
@@ -143,16 +143,16 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
String keepLoggedInCookieValue = GenerateKeepLoggedInCookieValue();
|
||||
int cookieExpiresDays = Math.Max(Sax.Config.Security.SignIn.KeepLoggedIn.CookieExpiresDays_Min, Math.Min(Sax.Config.Security.SignIn.KeepLoggedIn.CookieExpiresDays_Max, AppConfig.Security.SignIn.KeepLoggedIn.CookieExpiresDays));
|
||||
SetResponseCookie(CookieName_KeepLoggedIn, keepLoggedInCookieValue, DateTime.Now.AddDays(cookieExpiresDays), true);
|
||||
SetResponseCookie(KeepLoggedIn.CookieName, keepLoggedInCookieValue, DateTime.Now.AddDays(cookieExpiresDays), true);
|
||||
SaLogger.Info(this.GetType().Name + ".SetKeepLoggedInCookie 'Keep Logged In' cookie set. Value: " + keepLoggedInCookieValue);
|
||||
}
|
||||
|
||||
/// <summary>Set the 'Keep Logged In' response cookie to expired with no data.</summary>
|
||||
public void ClearKeepLoggedInCookie()
|
||||
{
|
||||
if (StringUtil.IsEmpty(GetRequestCookie(CookieName_KeepLoggedIn))) return;
|
||||
if (StringUtil.IsEmpty(GetRequestCookie(KeepLoggedIn.CookieName))) return;
|
||||
// Clear cookie by setting expiry date in the past.
|
||||
SetResponseCookie(CookieName_KeepLoggedIn, "", DateTime.Today.AddDays(-7), true);
|
||||
SetResponseCookie(KeepLoggedIn.CookieName, "", DateTime.Today.AddDays(-7), true);
|
||||
SaLogger.Info(GetType().Name + ".ClearKeepLoggedInCookie 'Keep Logged In' cookie cleared.");
|
||||
}
|
||||
|
||||
@@ -162,11 +162,13 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// to ensure that cookie value can be decrypted even if application restarts in the meantime.
|
||||
// - Generating IV from same key results in different value each time.
|
||||
// - IV Must be regenerated if key is changed: uncomment 'Generated' variable and copy resulting value to IV variable.
|
||||
// NB
|
||||
public static String CookieName_KeepLoggedIn = "SXKLI";
|
||||
public static String Base64Key_KeepLoggedIn = SacsEncryptionHelper.EncodePlainKey("<=Saxonite^{kEEp+1Ogg3d-IN}~32*>", SacsEncryptionHelper.KeyLength);
|
||||
public static String Base64IV_KeepLoggedIn_Generated = SacsEncryptionHelper.InitSymmetricEncryptionIV(Base64Key_KeepLoggedIn);
|
||||
public static String Base64IV_KeepLoggedIn = "YOX10FIPp1zM1pg5U6fW7A==";
|
||||
public static class KeepLoggedIn
|
||||
{
|
||||
public static String CookieName = "SXKLI";
|
||||
public static String Base64Key = SacsEncryptionHelper.EncodePlainKey("<=Saxonite^{kEEp+1Ogg3d-IN}~32*>", SacsEncryptionHelper.KeyLength);
|
||||
public static String Base64IV = "YOX10FIPp1zM1pg5U6fW7A==";
|
||||
private static String Base64IV_Generated = SacsEncryptionHelper.InitSymmetricEncryptionIV(KeepLoggedIn.Base64Key);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Keep-logged-in cookie value.
|
||||
@@ -175,7 +177,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
NameValueCollection keepLoggedInParams = new NameValueCollection();
|
||||
keepLoggedInParams.Add(ParamName_KeepLoggedIn_UserAccountId, SysId.ToString(SessionData_Admin.User.UserAccountId));
|
||||
return EncryptParameters(keepLoggedInParams, Base64IV_KeepLoggedIn, Base64Key_KeepLoggedIn);
|
||||
return EncryptParameters(keepLoggedInParams, KeepLoggedIn.Base64IV, KeepLoggedIn.Base64Key);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -196,7 +198,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
KeepLoggedInParams keepLoggedInParams = new KeepLoggedInParams();
|
||||
if (!StringUtil.IsEmpty(encryptedParams))
|
||||
{
|
||||
NameValueCollection linkParams = DecryptParameters(encryptedParams, Base64IV_KeepLoggedIn, Base64Key_KeepLoggedIn);
|
||||
NameValueCollection linkParams = DecryptParameters(encryptedParams, KeepLoggedIn.Base64IV, KeepLoggedIn.Base64Key);
|
||||
keepLoggedInParams.UserAccountId = new SysId(StringUtil.ToInt(linkParams.Get(ParamName_KeepLoggedIn_UserAccountId)));
|
||||
}
|
||||
if (DebugMode) SaLogger.Info(GetType().Name + ".ExtractKeepLoggedInParams UserAccountId: " + SysId.ToString(keepLoggedInParams.UserAccountId));
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Resend the cookie to extend the expiry date if it is currently populated.
|
||||
if (!StringUtil.IsEmpty(GetRequestCookie(CookieName_KeepLoggedIn)))
|
||||
if (!StringUtil.IsEmpty(GetRequestCookie(KeepLoggedIn.CookieName)))
|
||||
SetKeepLoggedInCookie();
|
||||
|
||||
// Construct response.
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// User data.
|
||||
private class UserData_List : AjaxResponse_Data.ItemData_Base
|
||||
private class UserListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String EmailAddress { get; set; }
|
||||
public String DisplayName { get; set; }
|
||||
@@ -34,7 +34,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public String LastOnlineLoginAt { get; set; }
|
||||
public String LastAdminLoginAt { get; set; }
|
||||
}
|
||||
private class UserData_Full : UserData_List
|
||||
private class UserItemData : UserListData
|
||||
{
|
||||
public String RegionIdCountry { get; set; }
|
||||
public String RegionIdProvince { get; set; }
|
||||
@@ -48,7 +48,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// User roles.
|
||||
public List<String> userRoleCodes { get; } = new List<string>();
|
||||
}
|
||||
private void PopulateUserResponseData(SaxModel_Admin model, UserData_List data, SaxUserAccount user, List<SaxUserSport> userSports, List<SaxUserRole> userRoles)
|
||||
private void PopulateUserResponseListData(SaxModel_Admin model, UserListData data, SaxUserAccount user, List<SaxUserSport> userSports, List<SaxUserRole> userRoles)
|
||||
{
|
||||
data.Id = SysId.ToString(user.Id);
|
||||
data.EmailAddress = user.EmailAddress;
|
||||
@@ -71,9 +71,9 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (userRole_SystemAdmin != null)
|
||||
data.LastAdminLoginAt = model.FormatDateTimeForDisplay(userRole_SystemAdmin.LastLoginAt);
|
||||
}
|
||||
private void PopulateUserResponseData(SaxModel_Admin model, UserData_Full data, SaxUserAccount user, List<SaxUserSport> userSports, List<SaxUserRole> userRoles)
|
||||
private void PopulateUserResponseItemData(SaxModel_Admin model, UserItemData data, SaxUserAccount user, List<SaxUserSport> userSports, List<SaxUserRole> userRoles)
|
||||
{
|
||||
PopulateUserResponseData(model, data as UserData_List, user, userSports, userRoles);
|
||||
PopulateUserResponseListData(model, data, user, userSports, userRoles);
|
||||
|
||||
data.RegionIdCountry = SysId.ToString(user.RegionIdCountry);
|
||||
data.RegionIdProvince = SysId.ToString(user.RegionIdProvince);
|
||||
@@ -81,12 +81,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// User sports.
|
||||
if (userSports != null && !userSports.IsEmpty())
|
||||
{
|
||||
data.Sports = new List<UserData_Full.UserSportData>();
|
||||
data.Sports = new List<UserItemData.UserSportData>();
|
||||
List<SaxSport> sports = ReferenceMgr.GetSportListByIds(userSports.GetSportIds());
|
||||
foreach (SaxUserSport userSport in userSports)
|
||||
{
|
||||
SaxSport sport = sports.GetSportById(userSport.SportId);
|
||||
UserData_Full.UserSportData userSportData = new UserData_Full.UserSportData()
|
||||
UserItemData.UserSportData userSportData = new UserItemData.UserSportData()
|
||||
{
|
||||
SportId = SysId.ToString(userSport.SportId),
|
||||
SportName = sport?.Name ?? null
|
||||
@@ -130,7 +130,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_UserList(SaxModel_Admin model) : base(model) { }
|
||||
// User list.
|
||||
public List<UserData_List> Users { get; } = new List<UserData_List>();
|
||||
public List<UserListData> Users { get; } = new List<UserListData>();
|
||||
// Reference data.
|
||||
public List<CodeDesc> UserRoles { get; } = new List<CodeDesc>();
|
||||
public List<CodeDesc> Statuses { get; } = new List<CodeDesc>();
|
||||
@@ -205,7 +205,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
UserData_List userData = new UserData_List()
|
||||
UserListData userData = new UserListData()
|
||||
{
|
||||
Id = values.GetString(colId.DataName),
|
||||
EmailAddress = values.GetString(colEmail.DataName),
|
||||
@@ -246,7 +246,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_User(SaxModel_Admin model) : base(model) { }
|
||||
// User details.
|
||||
public UserData_Full user { get; } = new UserData_Full();
|
||||
public UserItemData user { get; } = new UserItemData();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -290,7 +290,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
disposableItems.AddRange(userRoles);
|
||||
|
||||
// Construct response.
|
||||
PopulateUserResponseData(model, responseData.user, user, userSports, userRoles);
|
||||
PopulateUserResponseItemData(model, responseData.user, user, userSports, userRoles);
|
||||
responseData.Success = true;
|
||||
}
|
||||
return Json(responseData);
|
||||
@@ -342,7 +342,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
disposableItems.AddRange(userRoles);
|
||||
|
||||
// Construct response.
|
||||
PopulateUserResponseData(model, responseData.user, user, userSports, userRoles);
|
||||
PopulateUserResponseItemData(model, responseData.user, user, userSports, userRoles);
|
||||
responseData.Success = true;
|
||||
}
|
||||
return Json(responseData);
|
||||
@@ -478,7 +478,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
disposableItems.AddRange(userSports);
|
||||
|
||||
// Construct response.
|
||||
PopulateUserResponseData(model, responseData.user, user, userSports, userRoles.GetUserRolesByStatus(SaStatus.Active));
|
||||
PopulateUserResponseItemData(model, responseData.user, user, userSports, userRoles.GetUserRolesByStatus(SaStatus.Active));
|
||||
responseData.Success = true;
|
||||
}
|
||||
return Json(responseData);
|
||||
@@ -554,7 +554,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
disposableItems.AddRange(userSports);
|
||||
|
||||
// Construct response.
|
||||
PopulateUserResponseData(model, responseData.user, userAccount, userSports, userRoles.GetUserRolesByStatus(SaStatus.Active));
|
||||
PopulateUserResponseItemData(model, responseData.user, userAccount, userSports, userRoles.GetUserRolesByStatus(SaStatus.Active));
|
||||
responseData.SetNotification(messageTitle, "Emails sent: " + emailsSentCount);
|
||||
responseData.Success = true;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// User data.
|
||||
private class UserData_List : AjaxResponse_Data.ItemData_Base
|
||||
private class UserListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String EmailAddress { get; set; }
|
||||
public String DisplayName { get; set; }
|
||||
@@ -29,10 +29,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public String LastLoginAt { get; set; }
|
||||
public String OnlineAt { get; set; }
|
||||
}
|
||||
private class UserData_Full : UserData_List
|
||||
private class UserItemData : UserListData
|
||||
{
|
||||
}
|
||||
private void PopulateUserResponseData(SaxModel_Admin model, UserData_List data, SaxUserAccount user, SaxUserOnline userOnline)
|
||||
private void PopulateUserResponseListData(SaxModel_Admin model, UserListData data, SaxUserAccount user, SaxUserOnline userOnline)
|
||||
{
|
||||
data.Id = SysId.ToString(user.Id);
|
||||
data.EmailAddress = user.EmailAddress;
|
||||
@@ -44,9 +44,9 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (userOnline != null)
|
||||
data.OnlineAt = model.FormatDateTimeForDisplay(userOnline.OnlineAt);
|
||||
}
|
||||
private void PopulateUserResponseData(SaxModel_Admin model, UserData_Full data, SaxUserAccount user, SaxUserOnline userOnline)
|
||||
private void PopulateUserResponseItemData(SaxModel_Admin model, UserItemData data, SaxUserAccount user, SaxUserOnline userOnline)
|
||||
{
|
||||
PopulateUserResponseData(model, data as UserData_List, user, userOnline);
|
||||
PopulateUserResponseListData(model, data, user, userOnline);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -60,7 +60,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_UserList(SaxModel_Admin model) : base(model) { }
|
||||
// User list.
|
||||
public List<UserData_List> Users { get; } = new List<UserData_List>();
|
||||
public List<UserListData> Users { get; } = new List<UserListData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -107,7 +107,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
UserData_List userData = new UserData_List()
|
||||
UserListData userData = new UserListData()
|
||||
{
|
||||
Id = values.GetString(colUserAccountId.DataName),
|
||||
EmailAddress = values.GetString(colEmail.DataName),
|
||||
@@ -138,7 +138,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_User(SaxModel_Admin model) : base(model) { }
|
||||
// User details.
|
||||
public UserData_Full user { get; } = new UserData_Full();
|
||||
public UserItemData user { get; } = new UserItemData();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -178,7 +178,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
disposableItems.Add(userOnline);
|
||||
|
||||
// Construct response.
|
||||
PopulateUserResponseData(model, responseData.user, user, userOnline);
|
||||
PopulateUserResponseItemData(model, responseData.user, user, userOnline);
|
||||
responseData.Success = true;
|
||||
}
|
||||
return Json(responseData);
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||
using Saxonite.Net.Core.Web.Base.Models;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
{
|
||||
//=======================================================================
|
||||
public class Model_OrganisationAssociations : SaxModel_Admin
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
public enum AssociationTypeOption
|
||||
{
|
||||
Unknown = 0,
|
||||
AffiliateParent,
|
||||
AffiliatedTo,
|
||||
Partner,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public Model_OrganisationAssociations(SaxLocaliser localiser) :
|
||||
base(localiser)
|
||||
{
|
||||
AdditionalFiles_JS.Add("js/sax-org-ass.js");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// List configuration.
|
||||
public class FilterData
|
||||
{
|
||||
public String OrganisationId { get; set; }
|
||||
public String OrganisationName { get; set; }
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item association.
|
||||
public String ItemAssociationId { get; set; }
|
||||
/// <summary>Flag to indicate that a new association needs to be created - must be consistent with validity of Item Association Id.</summary>
|
||||
public String NewItem { get; set; }
|
||||
// Organisation.
|
||||
public String OrganisationId { get; set; }
|
||||
// Associated organisation.
|
||||
public String OrganisationIdAssoc { get; set; }
|
||||
public class AssociationData
|
||||
{
|
||||
// Association type option.
|
||||
public String TypeOption { get; set; }
|
||||
public AssociationTypeOption GetAssociationTypeOption() { return EnumUtil.ParseEnum(TypeOption, AssociationTypeOption.Unknown); }
|
||||
// Association properties.
|
||||
public String StatusCode { get; set; }
|
||||
public SaStatus GetStatus() { return SacsSystem.GetStatusForCode(StatusCode); }
|
||||
}
|
||||
public AssociationData Association { get; } = new AssociationData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
public bool IsAssociationTypeDirectionReversed(AssociationTypeOption associationTypeOption)
|
||||
{
|
||||
switch (associationTypeOption)
|
||||
{
|
||||
case AssociationTypeOption.AffiliatedTo:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public Sax.AssociationType GetAssociationTypeForOption(AssociationTypeOption associationTypeOption)
|
||||
{
|
||||
switch (associationTypeOption)
|
||||
{
|
||||
case AssociationTypeOption.AffiliateParent:
|
||||
case AssociationTypeOption.AffiliatedTo:
|
||||
return Sax.AssociationType.Affiliate;
|
||||
case AssociationTypeOption.Partner:
|
||||
return Sax.AssociationType.Partner;
|
||||
}
|
||||
return Sax.AssociationType.Unknown;
|
||||
}
|
||||
public bool IsConsistentWith(AssociationTypeOption associationTypeOption, Sax.AssociationType associationType)
|
||||
{
|
||||
switch (associationType)
|
||||
{
|
||||
case Sax.AssociationType.Affiliate:
|
||||
return new List<AssociationTypeOption>() { AssociationTypeOption.AffiliatedTo, AssociationTypeOption.AffiliateParent }.Contains(associationTypeOption);
|
||||
case Sax.AssociationType.Partner:
|
||||
return new List<AssociationTypeOption>() { AssociationTypeOption.Partner }.Contains(associationTypeOption);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validation.
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation association validation.
|
||||
public bool ValidateOrganisationAssociationData(SaxController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
|
||||
// Associated Organisation.
|
||||
if (OrganisationIdAssoc != null)
|
||||
{
|
||||
// Mandatory.
|
||||
String controlName = "OrganisationIdAssoc";
|
||||
if (!SysId.IsValid(OrganisationIdAssoc.ToSysId()))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
// Must exist.
|
||||
else if (!AccountMgr.OrganisationExistsById(OrganisationIdAssoc.ToSysId()))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
|
||||
// Not same as primary organisation.
|
||||
else if (OrganisationId != null && OrganisationId.ToSysId().Equals(OrganisationIdAssoc.ToSysId()))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
|
||||
// Association type option.
|
||||
if (Association.TypeOption != null)
|
||||
{
|
||||
// Mandatory.
|
||||
String controlName = "AssociationTypeOption";
|
||||
if (StringUtil.IsEmpty(Association.TypeOption))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
// Valid value.
|
||||
else if ((int)Association.GetAssociationTypeOption() < 1)
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
|
||||
// Association status.
|
||||
if (Association.StatusCode != null)
|
||||
{
|
||||
// Mandatory.
|
||||
String controlName = "AssociationStatus";
|
||||
if (StringUtil.IsEmpty(Association.StatusCode))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
// Valid value.
|
||||
else if (!SaxOrganisation.ValidStatuses.Contains(Association.GetStatus()))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
|
||||
return !responseData.HasControlErrors();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -32,18 +32,19 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
public class FilterData
|
||||
{
|
||||
public String OrganisationId { get; set; }
|
||||
public String OrganisationName { get; set; }
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
public String OrganisationId { get { return Filter.OrganisationId; } set { Filter.OrganisationId = value; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation.
|
||||
public String OrganisationId { get; set; }
|
||||
// User Organisation (member) properties.
|
||||
public String UserOrganisationId { get; set; }
|
||||
[EmailAddress]
|
||||
public String MemberUserEmailAddress{ get; set; }
|
||||
public String MemberUserAccountId { get; set; }
|
||||
public String MemberOrganisationId { get; set; }
|
||||
public String MemberOrganisationName { get; set; }
|
||||
public String MemberRoleCodeDelim = ",";
|
||||
public List<String> MemberRoleCodes { get; set; }
|
||||
public List<String> GetMemberRoleCodes()
|
||||
|
||||
@@ -123,12 +123,39 @@
|
||||
<data name="caption.image.upload" xml:space="preserve">
|
||||
<value>Image Upload</value>
|
||||
</data>
|
||||
<data name="caption.member.create" xml:space="preserve">
|
||||
<value>Add Member</value>
|
||||
</data>
|
||||
<data name="caption.member.remove" xml:space="preserve">
|
||||
<value>Remove Member</value>
|
||||
</data>
|
||||
<data name="caption.member.update" xml:space="preserve">
|
||||
<value>Update Member</value>
|
||||
</data>
|
||||
<data name="caption.organisation" xml:space="preserve">
|
||||
<value>Organisation</value>
|
||||
</data>
|
||||
<data name="caption.organisation.address" xml:space="preserve">
|
||||
<value>Organisation Address</value>
|
||||
</data>
|
||||
<data name="caption.organisation.association" xml:space="preserve">
|
||||
<value>Organisation Association</value>
|
||||
</data>
|
||||
<data name="caption.organisation.associations" xml:space="preserve">
|
||||
<value>Organisation Associations</value>
|
||||
</data>
|
||||
<data name="caption.organisation.images" xml:space="preserve">
|
||||
<value>Organisation Images</value>
|
||||
</data>
|
||||
<data name="caption.organisation.member" xml:space="preserve">
|
||||
<value>Organisation Member</value>
|
||||
</data>
|
||||
<data name="caption.organisation.members" xml:space="preserve">
|
||||
<value>Organisation Members</value>
|
||||
</data>
|
||||
<data name="caption.organisations" xml:space="preserve">
|
||||
<value>Organisations</value>
|
||||
</data>
|
||||
<data name="company.name" xml:space="preserve">
|
||||
<value>Sportierre</value>
|
||||
</data>
|
||||
@@ -192,6 +219,15 @@
|
||||
<data name="label.assigned" xml:space="preserve">
|
||||
<value>Assigned</value>
|
||||
</data>
|
||||
<data name="label.associated.organisation" xml:space="preserve">
|
||||
<value>Associated organisation</value>
|
||||
</data>
|
||||
<data name="label.association" xml:space="preserve">
|
||||
<value>Association</value>
|
||||
</data>
|
||||
<data name="label.associations" xml:space="preserve">
|
||||
<value>Associations</value>
|
||||
</data>
|
||||
<data name="label.available" xml:space="preserve">
|
||||
<value>Available</value>
|
||||
</data>
|
||||
@@ -567,24 +603,6 @@
|
||||
<data name="organisation.activate.organisation.header" xml:space="preserve">
|
||||
<value>Organisation to activate:</value>
|
||||
</data>
|
||||
<data name="organisation.caption.member" xml:space="preserve">
|
||||
<value>Organisation Member</value>
|
||||
</data>
|
||||
<data name="organisation.caption.member.create" xml:space="preserve">
|
||||
<value>Add Member</value>
|
||||
</data>
|
||||
<data name="organisation.caption.member.remove" xml:space="preserve">
|
||||
<value>Remove Member</value>
|
||||
</data>
|
||||
<data name="organisation.caption.member.update" xml:space="preserve">
|
||||
<value>Update Member</value>
|
||||
</data>
|
||||
<data name="organisation.caption.members" xml:space="preserve">
|
||||
<value>Organisation Members</value>
|
||||
</data>
|
||||
<data name="organisation.caption.organisation" xml:space="preserve">
|
||||
<value>Organisation</value>
|
||||
</data>
|
||||
<data name="organisation.caption.organisation.activate" xml:space="preserve">
|
||||
<value>Activate Organisation</value>
|
||||
</data>
|
||||
@@ -594,9 +612,6 @@
|
||||
<data name="organisation.caption.organisation.update" xml:space="preserve">
|
||||
<value>Update Organisation</value>
|
||||
</data>
|
||||
<data name="organisation.caption.organisations" xml:space="preserve">
|
||||
<value>Organisations</value>
|
||||
</data>
|
||||
<data name="organisation.caption.select.member.roles" xml:space="preserve">
|
||||
<value>Select Member Roles</value>
|
||||
</data>
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
@model Model_OrganisationAssociations
|
||||
@inject SaxLocaliser Localiser
|
||||
@{
|
||||
/* Organisation Associations - Index */
|
||||
ViewData["Title"] = "Organisation Associations";
|
||||
}
|
||||
|
||||
<div class="sax-panel OrganisationAssociations">
|
||||
|
||||
<script type="text/javascript">
|
||||
sax.lbl.refresh = '@(Localiser.GetJavascriptText("label.refresh"))';
|
||||
sax.lbl.add = '@(Localiser.GetJavascriptText("label.add"))';
|
||||
sax.lbl.create = '@(Localiser.GetJavascriptText("label.create"))';
|
||||
sax.lbl.edit = '@(Localiser.GetJavascriptText("label.edit"))';
|
||||
sax.lbl.remove = '@(Localiser.GetJavascriptText("label.remove"))';
|
||||
</script>
|
||||
|
||||
@* Filter Panel *@
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmAssociationFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="sax-panel-filter">
|
||||
|
||||
@* Header - Page caption, paging controls, actions. *@
|
||||
<div class="sax-header row">
|
||||
<div class="col"><div class="sax-caption">@Localiser["caption.organisation.associations"]</div></div>
|
||||
<div class="fixed row">
|
||||
<div>
|
||||
<partial name="~/Views/Common/ResultsPaging.cshtml" />
|
||||
</div>
|
||||
<div class="fixed">
|
||||
@* Burger menu *@
|
||||
<ul class="nav navbar-nav navbar-dark navbar-right sax-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sax-dropdown-menu">@* Menu items will be inserted here. *@</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
@* Organisation Association filter - Organisation etc. *@
|
||||
<div class="row">
|
||||
<div class="col-sm-3 sax-label text-left text-sm-right">@Localiser["caption.organisation"]</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@Html.HiddenFor(model => model.Filter.OrganisationId, new { @id = "ifFilterOrganisationId", @class= "OrganisationId" })
|
||||
<input type="text" id="ifFilterOrganisation" class="sax-input OrganisationName" readonly="readonly" value="@(Model.Filter.OrganisationName)" />
|
||||
</div>
|
||||
<div class="fixed"><button id="pbFilterOrganisationSelect" class="sax-button">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Filter element templates *@
|
||||
<div class="sax-panel-item-template">
|
||||
@* Burger dropdown item template - ul is ignored *@
|
||||
<ul class="sax-dropdown-menu AssociationFilter">
|
||||
<li class="sax-dropdown-item sax-action"><div class="sax-label">XXX</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@* Results Panel *@
|
||||
<div class="sax-panel-results">
|
||||
<div class="sax-panel-messages"></div>
|
||||
<div class="sax-panel-item-list"></div>
|
||||
|
||||
@* element templates *@
|
||||
<div class="sax-panel-item-template">
|
||||
@* Organisation Association item template *@
|
||||
<div class="sax-panel-item Association">
|
||||
<div class="sax-header row">
|
||||
<div class="col">
|
||||
@* User name *@
|
||||
<div class="sax-caption sax-action"><div class="UserDisplayName"></div></div>
|
||||
</div>
|
||||
<div class="fixed sax-actions">
|
||||
@* Burger menu *@
|
||||
<ul class="nav navbar-nav navbar-light navbar-right sax-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sax-dropdown-menu">@* Menu items will be inserted here. *@</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-6"></div>
|
||||
<div class="col-sm-6 right"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4"></div>
|
||||
<div class="col-sm-4"><div class=""></div></div>
|
||||
@* Association status *@
|
||||
<div class="col-sm-4 sax-note right"><span class="StatusDesc"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* Burger dropdown item template - ul is ignored *@
|
||||
<ul class="sax-dropdown-menu Association">
|
||||
<li class="sax-dropdown-item sax-action"><div class="sax-label">...</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@* Organisation Association components *@
|
||||
<partial name="Panel-Organisation-Association.cshtml" />
|
||||
@* Select Organisation components *@
|
||||
<partial name="~/Views/Common/SelectOrganisation.cshtml" />
|
||||
@@ -12,6 +12,7 @@
|
||||
sax.lbl.create = '@(Localiser.GetJavascriptText("label.create"))';
|
||||
sax.lbl.edit = '@(Localiser.GetJavascriptText("label.edit"))';
|
||||
sax.lbl.location = '@(Localiser.GetJavascriptText("label.location"))';
|
||||
sax.lbl.associations = '@(Localiser.GetJavascriptText("label.associations"))';
|
||||
sax.lbl.images = '@(Localiser.GetJavascriptText("label.images"))';
|
||||
sax.lbl.activate = '@(Localiser.GetJavascriptText("label.activate"))';
|
||||
</script>
|
||||
@@ -29,7 +30,7 @@
|
||||
@* Header - Page caption, paging controls, actions. *@
|
||||
<div class="sax-header">
|
||||
<div class="row">
|
||||
<div class="col"><div class="sax-caption">@Localiser["organisation.caption.organisations"]</div></div>
|
||||
<div class="col"><div class="sax-caption">@Localiser["caption.organisations"]</div></div>
|
||||
<div class="fixed row">
|
||||
<div class="col">
|
||||
<partial name="~/Views/Common/ResultsPaging.cshtml" />
|
||||
@@ -174,14 +175,14 @@
|
||||
{
|
||||
@Html.HiddenFor(model => model.OrganisationId, new { @class = "OrganisationId" })
|
||||
}
|
||||
@* Organisation dialog and form. *@
|
||||
<partial name="Panel-OrganisationDialog.cshtml" />
|
||||
@* Organisation Activation dialog and form. *@
|
||||
<partial name="Panel-ActivationDialog.cshtml" />
|
||||
@* Organisation Address dialog, form and script. *@
|
||||
<partial name="Panel-OrganisationAddressDialog.cshtml" />
|
||||
@* Organisation Images dialog, form and script. *@
|
||||
<partial name="Panel-OrganisationImagesDialog.cshtml" />
|
||||
@* Select Item dialog and script. *@
|
||||
@* Organisation dialog and form *@
|
||||
<partial name="Panel-Organisation-Dialog.cshtml" />
|
||||
@* Organisation Activation dialog and form *@
|
||||
<partial name="Panel-Organisation-Activation.cshtml" />
|
||||
@* Organisation Address dialog, form and script *@
|
||||
<partial name="Panel-Organisation-Address.cshtml" />
|
||||
@* Organisation Images dialog, form and script *@
|
||||
<partial name="Panel-Organisation-Images.cshtml" />
|
||||
@* Select Item dialog and script *@
|
||||
<partial name="~/Views/Common/SelectItem.cshtml" />
|
||||
</div>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
@* Header - Page caption, paging controls, actions. *@
|
||||
<div class="sax-header row">
|
||||
<div class="col"><div class="sax-caption">@Localiser["organisation.caption.members"]</div></div>
|
||||
<div class="col"><div class="sax-caption">@Localiser["caption.organisation.members"]</div></div>
|
||||
<div class="fixed row">
|
||||
<div>
|
||||
<partial name="~/Views/Common/ResultsPaging.cshtml" />
|
||||
@@ -41,12 +41,12 @@
|
||||
<div class="sax-content">
|
||||
@* Organisation Member filter - Organisation etc. *@
|
||||
<div class="row">
|
||||
<div class="col-sm-3 sax-label text-left text-sm-right">@Localiser["organisation.caption.organisation"]</div>
|
||||
<div class="col-sm-3 sax-label text-left text-sm-right">@Localiser["caption.organisation"]</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@Html.HiddenFor(model => model.Filter.OrganisationId, new { @id = "ifFilterOrganisationId" })
|
||||
<input type="text" id="ifFilterOrganisation" class="sax-input" readonly="readonly" value="@(Model.MemberOrganisationName)" />
|
||||
<input type="text" id="ifFilterOrganisation" class="sax-input" readonly="readonly" value="@(Model.Filter.OrganisationName)" />
|
||||
</div>
|
||||
<div class="fixed"><button id="pbFilterOrganisationSelect" class="sax-button">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
@@ -112,6 +112,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
<partial name="Panel-MemberDialog.cshtml" />
|
||||
<partial name="Panel-Organisation-Member.cshtml" />
|
||||
|
||||
<partial name="~/Views/Common/SelectOrganisation.cshtml" />
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
@model Model_OrganisationAssociations
|
||||
@inject SaxLocaliser Localiser
|
||||
@* Organisation - Associations components *@
|
||||
|
||||
@* Organisation Association Id form. *@
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmAssociationId" }))
|
||||
{
|
||||
@Html.HiddenFor(model => model.OrganisationId, new { @id = "", @class = "OrganisationId" })
|
||||
@Html.HiddenFor(model => model.ItemAssociationId, new { @id = "", @class = "ItemAssociationId" })
|
||||
}
|
||||
|
||||
@* Organisation Association dialog. *@
|
||||
<div id="dlgOrganisationAssociation" class="sax-dialog" title="@Localiser["caption.organisation.association"]">
|
||||
|
||||
<div class="spacer"></div>
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOrganisationAssociation", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.HiddenFor(model => model.ItemAssociationId, new { @id = "", @class = "ItemAssociationId" })
|
||||
@Html.HiddenFor(model => model.NewItem, new { @id = "", @class = "NewItem" })
|
||||
@Html.HiddenFor(model => model.OrganisationId, new { @id = "", @class = "OrganisationId" })
|
||||
|
||||
@* Organisation name *@
|
||||
<div class="sax-form-control OrganisationName">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationName"><span>@Localiser["label.organisation"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
<input type="text" id="ifOrganisationName" class="OrganisationName sax-input" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name)" disabled="disabled" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Association Type Option *@
|
||||
<div class="sax-form-control AssociationTypeOption">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="cbAssociationTypeOption"><span>@Localiser["label.association"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
<select type="text" id="cbAssociationTypeOption" name="Association.TypeOption" class="AssociationTypeOption sax-select"></select>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Associated Organisation *@
|
||||
<div class="sax-form-control OrganisationIdAssoc">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationNameAssoc"><span>@Localiser["label.associated.organisation"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control row">
|
||||
<div class="col">
|
||||
<input type="hidden" name="OrganisationIdAssoc" class="OrganisationIdAssoc" />
|
||||
<input type="text" id="ifOrganisationNameAssoc" class="OrganisationNameAssoc sax-input" disabled="disabled" />
|
||||
</div>
|
||||
<div class="fixed pl4">
|
||||
<button type="button" id="pbAssocOrganisationSelect" class="sax-button">@Localiser["label.select"]</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
}
|
||||
<div class="spacer"></div>
|
||||
</div>
|
||||
+3
-3
@@ -6,9 +6,9 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
sax.dlg.title.selectOrganisation = '@Localiser.GetJavascriptText("organisation.caption.select.organisation")';
|
||||
sax.dlg.title.createMember = '@Localiser.GetJavascriptText("organisation.caption.member.create")';
|
||||
sax.dlg.title.updateMember = '@Localiser.GetJavascriptText("organisation.caption.member.update")';
|
||||
sax.dlg.title.removeMember = '@Localiser.GetJavascriptText("organisation.caption.member.remove")';
|
||||
sax.dlg.title.createMember = '@Localiser.GetJavascriptText("caption.member.create")';
|
||||
sax.dlg.title.updateMember = '@Localiser.GetJavascriptText("caption.member.update")';
|
||||
sax.dlg.title.removeMember = '@Localiser.GetJavascriptText("caption.member.remove")';
|
||||
sax.dlg.title.selectMemberRoles = '@Localiser.GetJavascriptText("organisation.caption.select.member.roles")';
|
||||
sax.data.userRoleCodeDelim = '@Model.MemberRoleCodeDelim';
|
||||
</script>
|
||||
@@ -134,7 +134,7 @@
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('UsersOnline');">@Localiser["label.users.online"]</div>
|
||||
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('User');">@Localiser["user.caption.users"]</div>
|
||||
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Organisation');">@Localiser["organisation.caption.organisations"]</div>
|
||||
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Organisation');">@Localiser["caption.organisations"]</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
|
||||
@@ -182,6 +182,11 @@
|
||||
background-image: url('../img/action/process24.png');
|
||||
}
|
||||
|
||||
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-network
|
||||
{
|
||||
background-image: url('../img/action/network-24.png');
|
||||
}
|
||||
|
||||
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-close
|
||||
{
|
||||
background-image: url('../img/action/prev24.png');
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 362 B |
Binary file not shown.
|
After Width: | Height: | Size: 525 B |
Binary file not shown.
|
After Width: | Height: | Size: 743 B |
@@ -97,11 +97,17 @@
|
||||
return index % 2 == 1 ? "other" : "";
|
||||
});
|
||||
}
|
||||
sax.populateSelectCodeDesc = function ($sel, values)
|
||||
sax.populateSelect = function ($sel, values, code, desc)
|
||||
{
|
||||
code = code || 'code';
|
||||
desc = desc || 'desc';
|
||||
$sel = $($sel).empty();
|
||||
for (const value of values)
|
||||
$sel.append($('<option>').prop('value', value.code).text(value.desc));
|
||||
$sel.append($('<option>').prop('value', value[code]).text(value[desc]));
|
||||
}
|
||||
sax.populateSelectCodeDesc = function ($sel, values)
|
||||
{
|
||||
sax.populateSelect($sel, values);
|
||||
}
|
||||
sax.checkTextAreaMaxLength = function (ctrl, len)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
let addr = item.address || {};
|
||||
let frm = $frm.orgAddr;
|
||||
$('input.OrganisationId', frm).val(item.id);
|
||||
$('.OrganisationName', frm).val(item.name);
|
||||
$('input.OrganisationName', frm).val(item.name);
|
||||
$('input.AddressId', frm).val(addr.id);
|
||||
$('input.AddressLine1', frm).val(addr.line1);
|
||||
$('input.AddressLine2', frm).val(addr.line2);
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* Admin - Organisation Association scripts.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let oa = sax.mdl.organisationAssociations = { data: {}, ajax: {} };
|
||||
let $pnl = oa.$pnl = {}, $frm = oa.$frm = {}, $dlg = oa.$dlg = {};
|
||||
let mdlOrg = function () { return sax.mdl.organisations; }
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oa.refreshResults = function (delay)
|
||||
{
|
||||
if (!oa.awaitingRefreshResponse)
|
||||
{
|
||||
var $items = $('.sax-panel-item-list', $pnl.results).fadeOut(200).empty();
|
||||
var $msgs = $('.sax-panel-messages', $pnl.results).hide().empty().append($('<div class="sax-message">' + sax.msg.dataQuerying + '</div>')).fadeIn(200);
|
||||
}
|
||||
oa.ajax.refreshResults = oa.ajax.refreshResults || { url: sax.url.base + 'Organisation/Ajax/GetAssociationList', formId: 'frmAssociationFilter', callbackFn: oa.doRefreshResults };
|
||||
sax.doAjaxRequest(oa.ajax.refreshResults, delay || 50);
|
||||
oa.awaitingRefreshResponse = true;
|
||||
}
|
||||
oa.doRefreshResults = function (response)
|
||||
{
|
||||
sax.debug('doRefreshResults', response);
|
||||
delete oa.awaitingRefreshResponse;
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
var $msgs = $('.sax-panel-messages', $pnl.results).hide().empty();
|
||||
var $items = $('.sax-panel-item-list', $pnl.results).hide().empty();
|
||||
sax.refreshPaging(response, '#frmAssociationFilter', oa.refreshResults);
|
||||
if (!response.success) return;
|
||||
// Reference data - association types.
|
||||
if (response.associationTypes && response.associationTypes.length)
|
||||
oa.data.associationTypes = response.associationTypes;
|
||||
// Reference data - Statuses.
|
||||
if (response.defaultStatusCode) oa.data.defaultStatusCode = response.defaultStatusCode;
|
||||
if (response.statuses)
|
||||
sax.populateSelectCodeDesc('#cbAssociationStatus', response.statuses);
|
||||
// Menu.
|
||||
var $bgr = $('.sax-burger', $pnl.filter).hide();
|
||||
var $mnu = $('ul.sax-dropdown-menu', $bgr).empty();
|
||||
$mnu.append(oa.getFilterMenuOption(sax.lbl.refresh, function () { oa.refreshResults(); }, 'sax-refresh'));
|
||||
$mnu.append(oa.getFilterMenuOption(sax.lbl.add, function () { oa.createItem(); }, 'sax-add'));
|
||||
$bgr.toggle(!!$('.sax-dropdown-item', $mnu).length);
|
||||
// Items.
|
||||
var items = response.associations;
|
||||
if (!items.length)
|
||||
return $msgs.append($('<div class="sax-message">' + sax.msg.dataNoneFound + '</div>')).fadeIn(500);
|
||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||
$items.append(sax.populateItem(oa.getItemTemplate(), items[itemIdx]));
|
||||
$items.fadeIn(50);
|
||||
}
|
||||
sax.populateItem = function ($item, item)
|
||||
{
|
||||
if (!item) return;
|
||||
$item.prop('id', oa.itemIdPrefix + item.id);
|
||||
$('.UserEmailAddress', $item).text(item.emailAddress);
|
||||
$('.UserStatusDesc', $item).text(item.userStatusDesc).addClass('sax-status-' + (item.userStatusCode || '').toLowerCase());
|
||||
$('.UserStatus', $item).toggle(!item.userActive);
|
||||
$('.UserDisplayName', $item).text(item.displayName);
|
||||
$('.AssociationRoleCount .RoleCount', $item).text(item.roleCount);
|
||||
$('.StatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + (item.statusCode || '').toLowerCase());
|
||||
$('.sax-caption .sax-action').toggleClass('sax-action', !item.deleted);
|
||||
let $mnu = $('ul.sax-dropdown-menu', $item).empty();
|
||||
if (!item.deleted)
|
||||
{
|
||||
let fnUpdItm = function () { oa.updateItem(item, $item) };
|
||||
$mnu.append(oa.getItemMenuOption(sax.lbl.edit, fnUpdItm, 'sax-edit'));
|
||||
$item.on('click', '.sax-header .sax-caption', fnUpdItm).on('dblclick', fnUpdItm);
|
||||
if (item.association)
|
||||
$mnu.append(oa.getItemMenuOption(sax.lbl.remove, function () { oa.removeItem(item, $item) }, 'sax-remove'));
|
||||
}
|
||||
$('.sax-burger', $item).toggle(!!$('.sax-dropdown-item', $mnu).length);
|
||||
$('.sax-panel-messages', $pnl.results).hide().empty();
|
||||
return $item;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oa.getFilterDropdownTemplate = function ()
|
||||
{
|
||||
return $('.sax-panel-item-template .sax-dropdown-menu.AssociationFilter li.sax-dropdown-item', $pnl.filter).clone();
|
||||
}
|
||||
oa.getItemTemplate = function ()
|
||||
{
|
||||
return $('.sax-panel-item-template .sax-panel-item.Association', $pnl.results).clone();
|
||||
}
|
||||
oa.getItemDropdownTemplate = function ()
|
||||
{
|
||||
return $('.sax-panel-item-template .sax-dropdown-menu.Association li.sax-dropdown-item', $pnl.results).clone();
|
||||
}
|
||||
oa.getFilterMenuOption = function (lbl, fn, cls)
|
||||
{
|
||||
return oa.getMenuOption(oa.getFilterDropdownTemplate(), lbl, fn, cls);
|
||||
}
|
||||
oa.getItemMenuOption = function (lbl, fn, cls)
|
||||
{
|
||||
return oa.getMenuOption(oa.getItemDropdownTemplate(), lbl, fn, cls);
|
||||
}
|
||||
oa.getMenuOption = function ($opt, lbl, fn, cls)
|
||||
{
|
||||
return $opt.find('div.sax-label').text(lbl).end().on('click', fn).addClass(cls);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oa.selectFilterOrganisation = function ()
|
||||
{
|
||||
sax.selectOrganisation.fn.openDialog({ caption: sax.dlg.title.selectOrganisation, fnCallback: oa.onFilterOrganisationSelected });
|
||||
}
|
||||
oa.onFilterOrganisationSelected = function (id, name)
|
||||
{
|
||||
$('#ifFilterOrganisationId', $frm.filter).val(id);
|
||||
$('#ifFilterOrganisation', $frm.filter).val(name);
|
||||
oa.refreshResults(50);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oa.selectAssocOrganisation = function ()
|
||||
{
|
||||
sax.selectOrganisation.fn.openDialog({ caption: sax.dlg.title.selectOrganisation, fnCallback: oa.onAssocOrganisationSelected });
|
||||
}
|
||||
oa.onAssocOrganisationSelected = function (id, name)
|
||||
{
|
||||
$('.OrganisationIdAssoc', $frm.assoc).val(id);
|
||||
$('.OrganisationNameAssoc', $frm.assoc).val(name);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oa.createItem = function ()
|
||||
{
|
||||
oa.clearItem();
|
||||
let frm = $frm.assoc;
|
||||
$('.NewItem', frm).val(1);
|
||||
$('.OrganisationId', frm).val($('.OrganisationId', $frm.filter).val());
|
||||
$('.OrganisationName', frm).val($('.OrganisationName', $frm.filter).val());
|
||||
sax.openAssocDialog();
|
||||
}
|
||||
oa.clearItem = function ()
|
||||
{
|
||||
let frm = $frm.assoc;
|
||||
$('.ItemAssociationId,.NewItem,.OrganisationId,.OrganisationIdAssoc,input[type="text"],textarea,select', frm).val('');
|
||||
sax.populateSelect($('.sax-select.AssociationTypeOption', $frm.assoc), oa.data.associationTypes, 'type', 'label');
|
||||
sax.clearControlErrors(frm);
|
||||
}
|
||||
sax.openAssocDialog = function ()
|
||||
{
|
||||
sax.openDialog($dlg.assoc, 640, 480);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oa.updateItem = function (item, $item)
|
||||
{
|
||||
$('.OrganisationId', $frm.orgId).val(item.id);
|
||||
oa.ajax.getItemAssoc = oa.ajax.getItemAssoc || { url: sax.url.base + 'Organisation/Ajax/GetAssociation', formId: 'frmOrganisationId', callbackFn: oa.onUpdateItem };
|
||||
sax.doAjaxRequest(oa.ajax.getItemAssoc, 50);
|
||||
}
|
||||
oa.onUpdateItem = function (response)
|
||||
{
|
||||
sax.debug('onUpdateItemAssociation', response);
|
||||
if (!response.success) return;
|
||||
oa.clearItem();
|
||||
// Association.
|
||||
let item = response.organisation;
|
||||
let assoc = item.association || {};
|
||||
let frm = $frm.assoc;
|
||||
|
||||
$('input.ItemAssociationId', frm).val(item.id);
|
||||
$('input.OrganisationId', frm).val(item.organisationId);
|
||||
$('.OrganisationName', frm).val(item.name);
|
||||
|
||||
sax.openAssocDialog();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oa.storeItem = function ()
|
||||
{
|
||||
oa.ajax.storeItemAssoc = oa.ajax.storeItemAssoc || { url: sax.url.base + 'Organisation/Ajax/StoreAssociation', formId: 'frmOrganisationAssociation', callbackFn: oa.onStoreItem };
|
||||
sax.doAjaxRequest(oa.ajax.storeItemAssoc, 50);
|
||||
}
|
||||
oa.onStoreItem = function (response)
|
||||
{
|
||||
//sax.debug('onStoreItemAssociation', response);
|
||||
sax.refreshControlValues(response.controlValues, $frm.assoc);
|
||||
if (!response.success) return;
|
||||
$dlg.assoc.dialog('close');
|
||||
mdlOrg().refreshItem(response.organisation);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
$pnl.assocs = $('.sax-panel.OrganisationAssociations');
|
||||
$pnl.filter = $('.sax-panel-filter', $pnl.assocs);
|
||||
$pnl.results = $('.sax-panel-results', $pnl.assocs);
|
||||
|
||||
$frm.filter = $('#frmAssociationFilter', $pnl.assocs);
|
||||
$frm.filter.on('dblclick', '#ifFilterOrganisation', oa.selectFilterOrganisation).on('click', '#pbFilterOrganisationSelect', oa.selectFilterOrganisation);
|
||||
|
||||
$frm.assocId = $('#frmAssociationId');
|
||||
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { oa.storeItem(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.assoc = $('#dlgOrganisationAssociation').dialog(opt);
|
||||
|
||||
$frm.assoc = $('#frmOrganisationAssociation', $dlg.assoc);
|
||||
$frm.assoc.on('input', '.sax-input', function () { sax.clearControlError(this); });
|
||||
$frm.assoc.on('change', '.sax-select', function () { sax.clearControlError(this); });
|
||||
$frm.assoc.on('dblclick', '.OrganisationAssoc', oa.selectAssocOrganisation).on('click', '#pbAssocOrganisationSelect', oa.selectAssocOrganisation);
|
||||
|
||||
setTimeout(oa.refreshResults, 250);
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -256,7 +256,7 @@
|
||||
$pnl.filter = $('.sax-panel-filter', $pnl.mbrs);
|
||||
$pnl.results = $('.sax-panel-results', $pnl.mbrs);
|
||||
|
||||
$frm.filter = $('#frmOrganisationFilter');
|
||||
$frm.filter = $('#frmMemberFilter');
|
||||
$frm.filter.on('dblclick', '#ifFilterOrganisation', sax.selectFilterOrganisation);
|
||||
$frm.filter.on('click', '#pbFilterOrganisationSelect', sax.selectFilterOrganisation);
|
||||
|
||||
@@ -276,6 +276,7 @@
|
||||
setTimeout(om.refreshResults, 250);
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -74,6 +74,7 @@
|
||||
$mnu.append(op.getItemMenuOption(sax.lbl.activate, function () { op.activateItem(item) }, 'sax-unlock'));
|
||||
$mnu.append(op.getItemMenuOption(sax.lbl.images, function () { op.updateItemImages(item, $item) }, 'sax-image'));
|
||||
$mnu.append(op.getItemMenuOption(sax.lbl.location, function () { op.updateItemAddress(item, $item) }, 'sax-location'));
|
||||
$mnu.append(op.getItemMenuOption(sax.lbl.associations, function () { op.viewItemAssociations(item, $item) }, 'sax-network'));
|
||||
}
|
||||
$('.sax-burger', $item).toggle(!!$('.sax-dropdown-item', $mnu).length);
|
||||
$('.sax-panel-messages', $pnl.results).hide().empty();
|
||||
@@ -106,16 +107,6 @@
|
||||
return $opt.find('div.sax-label').text(lbl).end().on('click', fn).addClass(cls);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
op.onClickMemberCount = function (id)
|
||||
{
|
||||
if (!(id * 1)) return;
|
||||
sax.doPleaseWait();
|
||||
let frm = $('#frmOrganisationId');
|
||||
$('.OrganisationId', frm).val(id);
|
||||
frm.prop('action', sax.url.base + 'Organisation/Members').submit();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
op.getFilterSport = function ()
|
||||
{
|
||||
@@ -443,6 +434,14 @@
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
op.onClickMemberCount = function (id)
|
||||
{
|
||||
if (!(id * 1)) return;
|
||||
sax.doPleaseWait();
|
||||
$('.OrganisationId', $frm.orgId).val(id);
|
||||
$frm.orgId.prop('action', sax.url.base + 'Organisation/Members').submit();
|
||||
}
|
||||
|
||||
op.updateItemImages = function (item, $item)
|
||||
{
|
||||
sax.mdl.organisationImages.updateItemImages(item, $item)
|
||||
@@ -453,6 +452,14 @@
|
||||
sax.mdl.organisationAddress.updateItemAddress(item, $item);
|
||||
}
|
||||
|
||||
op.viewItemAssociations = function (item, $item)
|
||||
{
|
||||
if (!(item.id * 1)) return;
|
||||
sax.doPleaseWait();
|
||||
$('.OrganisationId', $frm.orgId).val(item.id);
|
||||
$frm.orgId.prop('action', sax.url.base + 'Organisation/Associations').submit();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
|
||||
@@ -177,6 +177,12 @@
|
||||
<data name="caption.contact.method" xml:space="preserve">
|
||||
<value>Contact Method</value>
|
||||
</data>
|
||||
<data name="caption.member.create" xml:space="preserve">
|
||||
<value>Add Member</value>
|
||||
</data>
|
||||
<data name="caption.member.update" xml:space="preserve">
|
||||
<value>Update Member</value>
|
||||
</data>
|
||||
<data name="company.name" xml:space="preserve">
|
||||
<value>Solum Forti</value>
|
||||
</data>
|
||||
@@ -719,12 +725,6 @@ You will then be able to publicise your sporting activities.</value>
|
||||
<data name="organisation.caption.events" xml:space="preserve">
|
||||
<value>Events</value>
|
||||
</data>
|
||||
<data name="organisation.caption.member.create" xml:space="preserve">
|
||||
<value>Add Member</value>
|
||||
</data>
|
||||
<data name="organisation.caption.member.update" xml:space="preserve">
|
||||
<value>Update Member</value>
|
||||
</data>
|
||||
<data name="organisation.caption.opportunities" xml:space="preserve">
|
||||
<value>Organisation Opportunities</value>
|
||||
</data>
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// NB Only allowed if there isn't a current user session.
|
||||
if (!ValidUserSession && AppConfig.Security.SignIn.KeepLoggedIn.Allowed)
|
||||
{
|
||||
String encryptedParams = GetRequestCookie(CookieName_KeepLoggedIn);
|
||||
String encryptedParams = GetRequestCookie(KeepLoggedIn.CookieName);
|
||||
KeepLoggedInParams keepLoggedInParams = ExtractKeepLoggedInParams(encryptedParams);
|
||||
String logSuffix = keepLoggedInParams.GetValidParams().Concat("", " ", ".");
|
||||
if (SysId.IsValid(keepLoggedInParams.UserAccountId))
|
||||
|
||||
@@ -203,16 +203,16 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
String keepLoggedInCookieValue = GenerateKeepLoggedInCookieValue();
|
||||
int cookieExpiresDays = Math.Max(Sax.Config.Security.SignIn.KeepLoggedIn.CookieExpiresDays_Min, Math.Min(Sax.Config.Security.SignIn.KeepLoggedIn.CookieExpiresDays_Max, AppConfig.Security.SignIn.KeepLoggedIn.CookieExpiresDays));
|
||||
SetResponseCookie(CookieName_KeepLoggedIn, keepLoggedInCookieValue, DateTime.Now.AddDays(cookieExpiresDays), true);
|
||||
SetResponseCookie(KeepLoggedIn.CookieName, keepLoggedInCookieValue, DateTime.Now.AddDays(cookieExpiresDays), true);
|
||||
SaLogger.Info(this.GetType().Name + ".SetKeepLoggedInCookie 'Keep Logged In' cookie set. Value: " + keepLoggedInCookieValue);
|
||||
}
|
||||
|
||||
/// <summary>Set the 'Keep Logged In' response cookie to expired with no data.</summary>
|
||||
public void ClearKeepLoggedInCookie()
|
||||
{
|
||||
if (StringUtil.IsEmpty(GetRequestCookie(CookieName_KeepLoggedIn))) return;
|
||||
if (StringUtil.IsEmpty(GetRequestCookie(KeepLoggedIn.CookieName))) return;
|
||||
// Clear cookie by setting expiry date in the past.
|
||||
SetResponseCookie(CookieName_KeepLoggedIn, "", DateTime.Today.AddDays(-7), true);
|
||||
SetResponseCookie(KeepLoggedIn.CookieName, "", DateTime.Today.AddDays(-7), true);
|
||||
SaLogger.Info(GetType().Name + ".ClearKeepLoggedInCookie 'Keep Logged In' cookie cleared.");
|
||||
}
|
||||
|
||||
@@ -223,10 +223,13 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// - Generating IV from same key results in different value each time.
|
||||
// - IV Must be regenerated if key is changed: uncomment 'Generated' variable and copy resulting value to IV variable.
|
||||
// NB - 'Keep Logged In' is termed 'Remember Me' in the Online application.
|
||||
public static String CookieName_KeepLoggedIn = "SAXRM";
|
||||
public static String Base64Key_KeepLoggedIn = SacsEncryptionHelper.EncodePlainKey("<=Saxonite^OnlIne{R$Member-m3}~>", SacsEncryptionHelper.KeyLength);
|
||||
//public static String Base64IV_KeepLoggedIn_Generated = SacsEncryptionHelper.InitSymmetricEncryptionIV(Base64Key_KeepLoggedIn);
|
||||
public static String Base64IV_KeepLoggedIn = "zZiDncOwG4H+PpChrd4DvA==";
|
||||
public static class KeepLoggedIn
|
||||
{
|
||||
public static String CookieName = "SAXRM";
|
||||
public static String Base64Key = SacsEncryptionHelper.EncodePlainKey("<=Saxonite^OnlIne{R$Member-m3}~>", SacsEncryptionHelper.KeyLength);
|
||||
//private static String Base64IV_Generated = SacsEncryptionHelper.InitSymmetricEncryptionIV(KeepLoggedIn.Base64Key);
|
||||
public static String Base64IV = "zZiDncOwG4H+PpChrd4DvA==";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Keep-logged-in cookie value.
|
||||
@@ -235,7 +238,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
NameValueCollection keepLoggedInParams = new NameValueCollection();
|
||||
keepLoggedInParams.Add(ParamName_KeepLoggedIn_UserAccountId, SysId.ToString(SessionData_Online.User.UserAccountId));
|
||||
return EncryptParameters(keepLoggedInParams, Base64IV_KeepLoggedIn, Base64Key_KeepLoggedIn);
|
||||
return EncryptParameters(keepLoggedInParams, KeepLoggedIn.Base64IV, KeepLoggedIn.Base64Key);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -256,7 +259,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
KeepLoggedInParams keepLoggedInParams = new KeepLoggedInParams();
|
||||
if (!StringUtil.IsEmpty(encryptedParams))
|
||||
{
|
||||
NameValueCollection linkParams = DecryptParameters(encryptedParams, Base64IV_KeepLoggedIn, Base64Key_KeepLoggedIn);
|
||||
NameValueCollection linkParams = DecryptParameters(encryptedParams, KeepLoggedIn.Base64IV, KeepLoggedIn.Base64Key);
|
||||
keepLoggedInParams.UserAccountId = new SysId(StringUtil.ToInt(linkParams.Get(ParamName_KeepLoggedIn_UserAccountId)));
|
||||
}
|
||||
if (DebugMode) SaLogger.Info(GetType().Name + ".ExtractKeepLoggedInParams UserAccountId: " + SysId.ToString(keepLoggedInParams.UserAccountId));
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Resend the cookie to extend the expiry date if it is currently populated.
|
||||
if (!StringUtil.IsEmpty(GetRequestCookie(CookieName_KeepLoggedIn)))
|
||||
if (!StringUtil.IsEmpty(GetRequestCookie(KeepLoggedIn.CookieName)))
|
||||
SetKeepLoggedInCookie();
|
||||
|
||||
// Construct response.
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
<div class="col-sm">
|
||||
<div class="sax-control row">
|
||||
<input type="hidden" name="Organisation.SportId" class="OrganisationSportId" />
|
||||
<div class="col"><input type="text" class="OrganisationSportCaption sax-input" readonly="readonly" /> </div>
|
||||
<div class="fixed"><button class="SelectSport sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px">@Localiser["label.select"]</button></div>
|
||||
<div class="col"><input type="text" class="OrganisationSportName sax-input" readonly="readonly" /> </div>
|
||||
<div class="fixed"><button class="SelectOrganisationSport sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
}
|
||||
|
||||
<script type="text/javascript">
|
||||
sax.dlg.title.createMember = '@Localiser.GetJavascriptText("organisation.caption.member.create")';
|
||||
sax.dlg.title.updateMember = '@Localiser.GetJavascriptText("organisation.caption.member.update")';
|
||||
sax.dlg.title.createMember = '@Localiser.GetJavascriptText("caption.member.create")';
|
||||
sax.dlg.title.updateMember = '@Localiser.GetJavascriptText("caption.member.update")';
|
||||
sax.dlg.title.selectRegion = '@Localiser.GetJavascriptText("reference.caption.region.select")';
|
||||
sax.dlg.title.selectSport = '@Localiser.GetJavascriptText("reference.caption.sport.select")';
|
||||
sax.data.userRoleCodeDelim = '@Model.MemberRoleCodeDelim';
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
{
|
||||
or.fn.init();
|
||||
$('input[type="text"],textarea,select,.OrganisationSportId,.OrganisationRegionIdCountry', or.$frm).val('');
|
||||
$('.OrganisationRegionIdCountry', or.$frm).val(sax.data.regionIdCountryDefault);
|
||||
$('.OrganisationRegionCaptionCountry', or.$frm).val(sax.data.regionNameCountryDefault);
|
||||
$('.OrganisationRegionIdPrimary', or.$frm).val(sax.data.regionIdCountryDefault);
|
||||
$('.OrganisationRegionNamePrimary', or.$frm).val(sax.data.regionNameCountryDefault);
|
||||
sax.clearControlErrors(or.$frm);
|
||||
sax.openDialog(or.$dlg, 640, 760);
|
||||
}
|
||||
@@ -45,19 +45,19 @@
|
||||
or.onSelectOrgSport = function (sport)
|
||||
{
|
||||
sax.clearControlError($('.OrganisationSportId', or.$frm).val(sport.id));
|
||||
$('.OrganisationSportCaption', or.$frm).val(sport ? sport.name : '');
|
||||
$('.OrganisationSportName', or.$frm).val(sport ? sport.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
or.selectOrgRegionCountry = function ()
|
||||
or.selectOrgRegionPrimary = function ()
|
||||
{
|
||||
//sax.debug($('.OrganisationRegionIdCountry', or.$frm).val());
|
||||
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.OrganisationRegionIdCountry', or.$frm).val(), typesInc: [30], fnCallback: or.onSelectOrgRegionCountry })
|
||||
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.OrganisationRegionIdCountry', or.$frm).val(), typesInc: [30], fnCallback: or.onSelectOrgRegionPrimary })
|
||||
}
|
||||
or.onSelectOrgRegionCountry = function (region)
|
||||
or.onSelectOrgRegionPrimary = function (region)
|
||||
{
|
||||
sax.clearControlError($('.OrganisationRegionIdCountry', or.$frm).val(region.id));
|
||||
$('.OrganisationRegionCaptionCountry', or.$frm).val(region ? region.name : '');
|
||||
sax.clearControlError($('.OrganisationRegionIdPrimary', or.$frm).val(region.id));
|
||||
$('.OrganisationRegionNamePrimary', or.$frm).val(region ? region.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -70,8 +70,8 @@
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); or.fn.cleanUp(); };
|
||||
or.$dlg = $('#dlgOrganisationRequest').dialog(opt);
|
||||
or.$frm = $('#frmOrganisationRequest', or.$dlg);
|
||||
or.$frm.on('dblclick', 'input.OrganisationSportCaption', or.selectOrgSport).on('click', 'button.SelectSport', or.selectOrgSport);
|
||||
or.$frm.on('dblclick', 'input.OrganisationRegionCaptionCountry', or.selectOrgRegionCountry).on('click', 'button.SelectRegionCountry', or.selectOrgRegionCountry);
|
||||
or.$frm.on('dblclick', 'input.OrganisationSportName', or.selectOrgSport).on('click', 'button.SelectOrganisationSport', or.selectOrgSport);
|
||||
or.$frm.on('dblclick', 'input.OrganisationRegionNamePrimary', or.selectOrgRegionPrimary).on('click', 'button.SelectOrganisationRegionPrimary', or.selectOrgRegionPrimary);
|
||||
$('.sax-input, .sax-textarea', or.$frm).on('input', function () { sax.clearControlError(this); });
|
||||
$('.sax-select', or.$frm).on('change', function () { sax.clearControlError(this); });
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
if (response.types) sax.populateSelectCodeDesc($('.sax-select.OrganisationType', $frm.org), response.types);
|
||||
$('.OrganisationType', $frm.org).val(item.typeCode);
|
||||
$('.OrganisationSportId', $frm.org).val(item.sportId);
|
||||
$('.OrganisationSportCaption', $frm.org).val(item.sportName);
|
||||
$('.OrganisationSportName', $frm.org).val(item.sportName);
|
||||
$('.OrganisationRegionIdPrimary', $frm.org).val(item.regionPrimary.id);
|
||||
$('.OrganisationRegionNamePrimary', $frm.org).val(item.regionPrimary.name);
|
||||
$('.OrganisationAbout', $frm.org).val(item.about);
|
||||
@@ -164,13 +164,13 @@
|
||||
po.onSelectOrgSport = function (sport)
|
||||
{
|
||||
sax.clearControlError($('.OrganisationSportId', $frm.org).val(sport.id));
|
||||
$('.OrganisationSportCaption', $frm.org).val(sport ? sport.name : '');
|
||||
$('.OrganisationSportName', $frm.org).val(sport ? sport.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
po.selectOrgRegionPrimary = function ()
|
||||
{
|
||||
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.OrganisationRegionIdCountry', $frm.org).val(), typesInc: [30], fnCallback: po.onSelectOrgRegionPrimary })
|
||||
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.OrganisationRegionIdPrimary', $frm.org).val(), typesInc: [30], fnCallback: po.onSelectOrgRegionPrimary })
|
||||
}
|
||||
po.onSelectOrgRegionPrimary = function (region)
|
||||
{
|
||||
@@ -242,8 +242,8 @@
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.org = $('#dlgProfileOrganisation').dialog(opt);
|
||||
$frm.org = $('#frmProfileOrganisation', $dlg.org);
|
||||
$frm.org.on('dblclick', 'input.OrganisationSportCaption', po.selectOrgSport).on('click', 'button.SelectSport', po.selectOrgSport);
|
||||
$frm.org.on('dblclick', 'input.OrganisationRegionNameCountry', po.selectOrgRegionPrimary).on('click', 'button.SelectOrganisationRegionPrimary', po.selectOrgRegionPrimary);
|
||||
$frm.org.on('dblclick', 'input.OrganisationSportName', po.selectOrgSport).on('click', 'button.SelectSport', po.selectOrgSport);
|
||||
$frm.org.on('dblclick', 'input.OrganisationRegionNamePrimary', po.selectOrgRegionPrimary).on('click', 'button.SelectOrganisationRegionPrimary', po.selectOrgRegionPrimary);
|
||||
$frm.org.on('click', '.OrganisationContactMethods .sax-action.sax-add', po.addConMth);
|
||||
$pnl.conMths = $('.OrganisationContactMethods', $frm.org);
|
||||
$pnl.tblconMths = $('table.sax-data', $pnl.conMths);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.2.7.0";
|
||||
private static String version { get; } = "1.2.8.0";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
@@ -40,6 +40,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Version history.
|
||||
//-------------------------------------------------------------------
|
||||
// 1.2.8 ?-Jul-2022
|
||||
// -
|
||||
// 1.2.7 9-Jun-2022 Online Activty list images
|
||||
// - Organisation logo and article thumbnail in article list.
|
||||
// 1.2.6 16-May-2022 Image resizing
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
OrganisationType,
|
||||
OrganisationCategory,
|
||||
OrganisationRole,
|
||||
AssociationType,
|
||||
AddressType,
|
||||
ContactMethod,
|
||||
EventType,
|
||||
@@ -85,6 +86,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
// Item link components.
|
||||
ItemImage = 400,
|
||||
ItemAddress = 405,
|
||||
ItemAssociation = 410,
|
||||
ItemSport = 420,
|
||||
}
|
||||
|
||||
@@ -247,6 +249,17 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
ArticleAdmin,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public enum AssociationType
|
||||
{
|
||||
Unknown = 0,
|
||||
/* Do not change the numeric values - tied to database. */
|
||||
/// <summary>'To' Affiliated to 'From' item. From/To: Organisation.</summary>
|
||||
Affiliate = 10,
|
||||
/// <summary>Partner items. From/To: Organisation.</summary>
|
||||
Partner = 20,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public enum AddressType
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -21,6 +21,7 @@ namespace Saxonite.Base.App
|
||||
ActivityIndex,
|
||||
Article,
|
||||
ItemAddress,
|
||||
ItemAssociation,
|
||||
ItemImage,
|
||||
ItemSport,
|
||||
Organisation,
|
||||
@@ -119,6 +120,21 @@ namespace Saxonite.Base.App
|
||||
ItemAddress_UpdateOn,
|
||||
ItemAddress_UpdateBy,
|
||||
ItemAddress_UpdateHost,
|
||||
ItemAssociation_Id,
|
||||
ItemAssociation_ItemTypeFrom,
|
||||
ItemAssociation_ItemIdFrom,
|
||||
ItemAssociation_ItemTypeTo,
|
||||
ItemAssociation_ItemIdTo,
|
||||
ItemAssociation_AssociationType,
|
||||
ItemAssociation_Notes,
|
||||
ItemAssociation_Flags,
|
||||
ItemAssociation_Status,
|
||||
ItemAssociation_CreateOn,
|
||||
ItemAssociation_CreateBy,
|
||||
ItemAssociation_CreateHost,
|
||||
ItemAssociation_UpdateOn,
|
||||
ItemAssociation_UpdateBy,
|
||||
ItemAssociation_UpdateHost,
|
||||
ItemImage_Id,
|
||||
ItemImage_ItemType,
|
||||
ItemImage_ItemId,
|
||||
@@ -378,8 +394,8 @@ namespace Saxonite.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 19;
|
||||
private static readonly int columnCount = 331;
|
||||
private static readonly int tableCount = 20;
|
||||
private static readonly int columnCount = 346;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -529,6 +545,7 @@ namespace Saxonite.Base.App
|
||||
"ActivityIndex",
|
||||
"Article",
|
||||
"ItemAddress",
|
||||
"ItemAssociation",
|
||||
"ItemImage",
|
||||
"ItemSport",
|
||||
"Organisation",
|
||||
@@ -647,18 +664,11 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(4,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(4,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(5,"Id",5,-5,true,19),
|
||||
new ColumnDfn(5,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(5,"ItemId",4,4,false,10),
|
||||
new ColumnDfn(5,"ImageType",3,5,false,5),
|
||||
new ColumnDfn(5,"ImageSeq",2,-6,false,3),
|
||||
new ColumnDfn(5,"SessionUid",5,-5,false,19),
|
||||
new ColumnDfn(5,"ImageUid",4,4,false,10),
|
||||
new ColumnDfn(5,"Filename",0,-9,false,1024),
|
||||
new ColumnDfn(5,"Mime",0,12,false,64),
|
||||
new ColumnDfn(5,"ContentType",0,12,false,128),
|
||||
new ColumnDfn(5,"Width",4,4,false,10),
|
||||
new ColumnDfn(5,"Height",4,4,false,10),
|
||||
new ColumnDfn(5,"ImageData",10,-3,false,0),
|
||||
new ColumnDfn(5,"ItemTypeFrom",3,5,false,5),
|
||||
new ColumnDfn(5,"ItemIdFrom",4,4,false,10),
|
||||
new ColumnDfn(5,"ItemTypeTo",3,5,false,5),
|
||||
new ColumnDfn(5,"ItemIdTo",4,4,false,10),
|
||||
new ColumnDfn(5,"AssociationType",3,5,false,5),
|
||||
new ColumnDfn(5,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(5,"Flags",3,5,false,5),
|
||||
new ColumnDfn(5,"Status",0,12,false,3),
|
||||
@@ -668,11 +678,19 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(5,"UpdateOn",9,93,false,23),
|
||||
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,"Id",5,-5,true,19),
|
||||
new ColumnDfn(6,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(6,"ItemId",4,4,false,10),
|
||||
new ColumnDfn(6,"SportId",4,4,false,10),
|
||||
new ColumnDfn(6,"ItemSportData",0,-9,false,0),
|
||||
new ColumnDfn(6,"ImageType",3,5,false,5),
|
||||
new ColumnDfn(6,"ImageSeq",2,-6,false,3),
|
||||
new ColumnDfn(6,"SessionUid",5,-5,false,19),
|
||||
new ColumnDfn(6,"ImageUid",4,4,false,10),
|
||||
new ColumnDfn(6,"Filename",0,-9,false,1024),
|
||||
new ColumnDfn(6,"Mime",0,12,false,64),
|
||||
new ColumnDfn(6,"ContentType",0,12,false,128),
|
||||
new ColumnDfn(6,"Width",4,4,false,10),
|
||||
new ColumnDfn(6,"Height",4,4,false,10),
|
||||
new ColumnDfn(6,"ImageData",10,-3,false,0),
|
||||
new ColumnDfn(6,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(6,"Flags",3,5,false,5),
|
||||
new ColumnDfn(6,"Status",0,12,false,3),
|
||||
@@ -683,15 +701,10 @@ 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,"Name",0,-9,false,100),
|
||||
new ColumnDfn(7,"OrganisationType",0,12,false,3),
|
||||
new ColumnDfn(7,"OrganisationCategory",0,12,false,3),
|
||||
new ColumnDfn(7,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(7,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(7,"About",0,-9,false,2000),
|
||||
new ColumnDfn(7,"Facilities",0,-9,false,2000),
|
||||
new ColumnDfn(7,"ContactData",0,-9,false,0),
|
||||
new ColumnDfn(7,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(7,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(7,"ItemId",4,4,false,10),
|
||||
new ColumnDfn(7,"SportId",4,4,false,10),
|
||||
new ColumnDfn(7,"ItemSportData",0,-9,false,0),
|
||||
new ColumnDfn(7,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(7,"Flags",3,5,false,5),
|
||||
new ColumnDfn(7,"Status",0,12,false,3),
|
||||
@@ -702,16 +715,15 @@ 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,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(8,"Name",0,-9,false,100),
|
||||
new ColumnDfn(8,"OrganisationType",0,12,false,3),
|
||||
new ColumnDfn(8,"OrganisationCategory",0,12,false,3),
|
||||
new ColumnDfn(8,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(8,"RegionIdCountry",4,4,false,10),
|
||||
new ColumnDfn(8,"EventAt",9,93,false,16),
|
||||
new ColumnDfn(8,"EventTypeCode",0,12,false,3),
|
||||
new ColumnDfn(8,"Summary",0,-9,false,200),
|
||||
new ColumnDfn(8,"Details",0,-9,false,2000),
|
||||
new ColumnDfn(8,"EventData",0,-9,false,0),
|
||||
new ColumnDfn(8,"PublishedAt",9,93,false,16),
|
||||
new ColumnDfn(8,"ExpiresAt",9,93,false,16),
|
||||
new ColumnDfn(8,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(8,"About",0,-9,false,2000),
|
||||
new ColumnDfn(8,"Facilities",0,-9,false,2000),
|
||||
new ColumnDfn(8,"ContactData",0,-9,false,0),
|
||||
new ColumnDfn(8,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(8,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(8,"Flags",3,5,false,5),
|
||||
new ColumnDfn(8,"Status",0,12,false,3),
|
||||
@@ -724,11 +736,12 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(9,"Id",4,4,true,10),
|
||||
new ColumnDfn(9,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(9,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(9,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(9,"OpportunityTypeCode",0,12,false,3),
|
||||
new ColumnDfn(9,"Position",0,-9,false,200),
|
||||
new ColumnDfn(9,"Outline",0,-9,false,2000),
|
||||
new ColumnDfn(9,"OpportunityData",0,-9,false,0),
|
||||
new ColumnDfn(9,"RegionIdCountry",4,4,false,10),
|
||||
new ColumnDfn(9,"EventAt",9,93,false,16),
|
||||
new ColumnDfn(9,"EventTypeCode",0,12,false,3),
|
||||
new ColumnDfn(9,"Summary",0,-9,false,200),
|
||||
new ColumnDfn(9,"Details",0,-9,false,2000),
|
||||
new ColumnDfn(9,"EventData",0,-9,false,0),
|
||||
new ColumnDfn(9,"PublishedAt",9,93,false,16),
|
||||
new ColumnDfn(9,"ExpiresAt",9,93,false,16),
|
||||
new ColumnDfn(9,"Notes",0,-9,false,2000),
|
||||
@@ -741,12 +754,15 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(9,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(9,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(10,"Id",4,4,true,10),
|
||||
new ColumnDfn(10,"RegionType",3,5,false,5),
|
||||
new ColumnDfn(10,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(10,"Name",0,-9,false,100),
|
||||
new ColumnDfn(10,"Latitude",8,3,false,9),
|
||||
new ColumnDfn(10,"Longitude",8,3,false,9),
|
||||
new ColumnDfn(10,"RegionIdParent",4,4,false,10),
|
||||
new ColumnDfn(10,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(10,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(10,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(10,"OpportunityTypeCode",0,12,false,3),
|
||||
new ColumnDfn(10,"Position",0,-9,false,200),
|
||||
new ColumnDfn(10,"Outline",0,-9,false,2000),
|
||||
new ColumnDfn(10,"OpportunityData",0,-9,false,0),
|
||||
new ColumnDfn(10,"PublishedAt",9,93,false,16),
|
||||
new ColumnDfn(10,"ExpiresAt",9,93,false,16),
|
||||
new ColumnDfn(10,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(10,"Flags",3,5,false,5),
|
||||
new ColumnDfn(10,"Status",0,12,false,3),
|
||||
@@ -757,9 +773,12 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(10,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(10,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(11,"Id",4,4,true,10),
|
||||
new ColumnDfn(11,"SportIdParent",4,4,false,10),
|
||||
new ColumnDfn(11,"RegionType",3,5,false,5),
|
||||
new ColumnDfn(11,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(11,"Name",0,-9,false,100),
|
||||
new ColumnDfn(11,"SpecialityLabel",3,5,false,5),
|
||||
new ColumnDfn(11,"Latitude",8,3,false,9),
|
||||
new ColumnDfn(11,"Longitude",8,3,false,9),
|
||||
new ColumnDfn(11,"RegionIdParent",4,4,false,10),
|
||||
new ColumnDfn(11,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(11,"Flags",3,5,false,5),
|
||||
new ColumnDfn(11,"Status",0,12,false,3),
|
||||
@@ -770,29 +789,9 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(11,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(11,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(12,"Id",4,4,true,10),
|
||||
new ColumnDfn(12,"EmailAddress",0,-9,false,200),
|
||||
new ColumnDfn(12,"Title",0,-9,false,20),
|
||||
new ColumnDfn(12,"FirstName",0,-9,false,100),
|
||||
new ColumnDfn(12,"Initials",0,-9,false,10),
|
||||
new ColumnDfn(12,"LastName",0,-9,false,100),
|
||||
new ColumnDfn(12,"About",0,-9,false,2000),
|
||||
new ColumnDfn(12,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(12,"PhoneMobile",0,-9,false,50),
|
||||
new ColumnDfn(12,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(12,"Gender",2,-6,false,3),
|
||||
new ColumnDfn(12,"DateOfBirthDay",2,-6,false,3),
|
||||
new ColumnDfn(12,"DateOfBirthMonth",2,-6,false,3),
|
||||
new ColumnDfn(12,"DateOfBirthYear",3,5,false,5),
|
||||
new ColumnDfn(12,"RegionIdCountry",4,4,false,10),
|
||||
new ColumnDfn(12,"RegionIdProvince",4,4,false,10),
|
||||
new ColumnDfn(12,"JournalistData",0,-9,false,0),
|
||||
new ColumnDfn(12,"PasswordToken",0,12,false,32),
|
||||
new ColumnDfn(12,"PasswordHashed",0,-9,false,100),
|
||||
new ColumnDfn(12,"PasswordHistory",0,-9,false,0),
|
||||
new ColumnDfn(12,"PasswordChangedAt",9,93,false,16),
|
||||
new ColumnDfn(12,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(12,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(12,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(12,"SportIdParent",4,4,false,10),
|
||||
new ColumnDfn(12,"Name",0,-9,false,100),
|
||||
new ColumnDfn(12,"SpecialityLabel",3,5,false,5),
|
||||
new ColumnDfn(12,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(12,"Flags",3,5,false,5),
|
||||
new ColumnDfn(12,"Status",0,12,false,3),
|
||||
@@ -802,19 +801,30 @@ 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,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(13,"ItemId",5,-5,false,19),
|
||||
new ColumnDfn(13,"CurrentlyListed",1,-7,false,1),
|
||||
new ColumnDfn(13,"ListedAtFirst",9,93,false,16),
|
||||
new ColumnDfn(13,"ListedAtLast",9,93,false,16),
|
||||
new ColumnDfn(13,"ViewedAtFirst",9,93,false,16),
|
||||
new ColumnDfn(13,"ViewedAtLast",9,93,false,16),
|
||||
new ColumnDfn(13,"Reaction",3,5,false,5),
|
||||
new ColumnDfn(13,"ReactedAtFirst",9,93,false,16),
|
||||
new ColumnDfn(13,"ReactedAtLast",9,93,false,16),
|
||||
new ColumnDfn(13,"UserActivityData",0,-9,false,0),
|
||||
new ColumnDfn(13,"Id",4,4,true,10),
|
||||
new ColumnDfn(13,"EmailAddress",0,-9,false,200),
|
||||
new ColumnDfn(13,"Title",0,-9,false,20),
|
||||
new ColumnDfn(13,"FirstName",0,-9,false,100),
|
||||
new ColumnDfn(13,"Initials",0,-9,false,10),
|
||||
new ColumnDfn(13,"LastName",0,-9,false,100),
|
||||
new ColumnDfn(13,"About",0,-9,false,2000),
|
||||
new ColumnDfn(13,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(13,"PhoneMobile",0,-9,false,50),
|
||||
new ColumnDfn(13,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(13,"Gender",2,-6,false,3),
|
||||
new ColumnDfn(13,"DateOfBirthDay",2,-6,false,3),
|
||||
new ColumnDfn(13,"DateOfBirthMonth",2,-6,false,3),
|
||||
new ColumnDfn(13,"DateOfBirthYear",3,5,false,5),
|
||||
new ColumnDfn(13,"RegionIdCountry",4,4,false,10),
|
||||
new ColumnDfn(13,"RegionIdProvince",4,4,false,10),
|
||||
new ColumnDfn(13,"JournalistData",0,-9,false,0),
|
||||
new ColumnDfn(13,"PasswordToken",0,12,false,32),
|
||||
new ColumnDfn(13,"PasswordHashed",0,-9,false,100),
|
||||
new ColumnDfn(13,"PasswordHistory",0,-9,false,0),
|
||||
new ColumnDfn(13,"PasswordChangedAt",9,93,false,16),
|
||||
new ColumnDfn(13,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(13,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(13,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(13,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(13,"Flags",3,5,false,5),
|
||||
new ColumnDfn(13,"Status",0,12,false,3),
|
||||
@@ -824,29 +834,36 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(13,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(13,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(13,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(14,"Id",5,-5,true,19),
|
||||
new ColumnDfn(14,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(14,"OnlineAt",9,93,false,16),
|
||||
new ColumnDfn(15,"Id",5,-5,true,19),
|
||||
new ColumnDfn(14,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(14,"ItemId",5,-5,false,19),
|
||||
new ColumnDfn(14,"CurrentlyListed",1,-7,false,1),
|
||||
new ColumnDfn(14,"ListedAtFirst",9,93,false,16),
|
||||
new ColumnDfn(14,"ListedAtLast",9,93,false,16),
|
||||
new ColumnDfn(14,"ViewedAtFirst",9,93,false,16),
|
||||
new ColumnDfn(14,"ViewedAtLast",9,93,false,16),
|
||||
new ColumnDfn(14,"Reaction",3,5,false,5),
|
||||
new ColumnDfn(14,"ReactedAtFirst",9,93,false,16),
|
||||
new ColumnDfn(14,"ReactedAtLast",9,93,false,16),
|
||||
new ColumnDfn(14,"UserActivityData",0,-9,false,0),
|
||||
new ColumnDfn(14,"Notes",0,-9,false,2000),
|
||||
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,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(15,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(15,"OrganisationRoleCodes",0,12,false,256),
|
||||
new ColumnDfn(15,"OrganisationRoleCount",2,-6,false,3),
|
||||
new ColumnDfn(15,"AdminComment",0,-9,false,2000),
|
||||
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),
|
||||
new ColumnDfn(15,"OnlineAt",9,93,false,16),
|
||||
new ColumnDfn(16,"Id",5,-5,true,19),
|
||||
new ColumnDfn(16,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(16,"UserRoleCode",0,12,false,16),
|
||||
new ColumnDfn(16,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(16,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(16,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(16,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(16,"OrganisationRoleCodes",0,12,false,256),
|
||||
new ColumnDfn(16,"OrganisationRoleCount",2,-6,false,3),
|
||||
new ColumnDfn(16,"AdminComment",0,-9,false,2000),
|
||||
new ColumnDfn(16,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(16,"Flags",3,5,false,5),
|
||||
new ColumnDfn(16,"Status",0,12,false,3),
|
||||
@@ -856,42 +873,34 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(16,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(16,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(16,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(17,"Id",5,-5,true,19),
|
||||
new ColumnDfn(17,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(17,"ActivityIndexIds",0,-9,false,0),
|
||||
new ColumnDfn(17,"UserSessionData",0,-9,false,0),
|
||||
new ColumnDfn(17,"UserRoleCode",0,12,false,16),
|
||||
new ColumnDfn(17,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(17,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(17,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(17,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(17,"Flags",3,5,false,5),
|
||||
new ColumnDfn(17,"Status",0,12,false,3),
|
||||
new ColumnDfn(17,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(17,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(17,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(17,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(18,"Id",5,-5,true,19),
|
||||
new ColumnDfn(17,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(17,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(18,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(18,"SportId",4,4,false,10),
|
||||
new ColumnDfn(18,"About",0,-9,false,2000),
|
||||
new ColumnDfn(18,"Participation",3,5,false,5),
|
||||
new ColumnDfn(18,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(18,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(18,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(18,"ActivityIndexIds",0,-9,false,0),
|
||||
new ColumnDfn(18,"UserSessionData",0,-9,false,0),
|
||||
new ColumnDfn(18,"Flags",3,5,false,5),
|
||||
new ColumnDfn(18,"Status",0,12,false,3),
|
||||
new ColumnDfn(18,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(18,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(18,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(18,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(18,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(18,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(19,"Id",5,-5,true,19),
|
||||
new ColumnDfn(19,"UserSportId",5,-5,false,19),
|
||||
new ColumnDfn(19,"PeriodFrom",9,93,false,16),
|
||||
new ColumnDfn(19,"PeriodTo",9,93,false,16),
|
||||
new ColumnDfn(19,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(19,"OrganisationName",0,-9,false,200),
|
||||
new ColumnDfn(19,"Summary",0,-9,false,2000),
|
||||
new ColumnDfn(19,"Team",0,-9,false,64),
|
||||
new ColumnDfn(19,"League",0,-9,false,64),
|
||||
new ColumnDfn(19,"Speciality",0,-9,false,64),
|
||||
new ColumnDfn(19,"SpecialitiesOther",0,-9,false,1000),
|
||||
new ColumnDfn(19,"RegionIdNation",4,4,false,10),
|
||||
new ColumnDfn(19,"RegionIdProvince",4,4,false,10),
|
||||
new ColumnDfn(19,"UserSportExperienceData",0,-9,false,0),
|
||||
new ColumnDfn(19,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(19,"SportId",4,4,false,10),
|
||||
new ColumnDfn(19,"About",0,-9,false,2000),
|
||||
new ColumnDfn(19,"Participation",3,5,false,5),
|
||||
new ColumnDfn(19,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(19,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(19,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(19,"Flags",3,5,false,5),
|
||||
new ColumnDfn(19,"Status",0,12,false,3),
|
||||
@@ -901,6 +910,29 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(19,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(19,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(19,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(20,"Id",5,-5,true,19),
|
||||
new ColumnDfn(20,"UserSportId",5,-5,false,19),
|
||||
new ColumnDfn(20,"PeriodFrom",9,93,false,16),
|
||||
new ColumnDfn(20,"PeriodTo",9,93,false,16),
|
||||
new ColumnDfn(20,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(20,"OrganisationName",0,-9,false,200),
|
||||
new ColumnDfn(20,"Summary",0,-9,false,2000),
|
||||
new ColumnDfn(20,"Team",0,-9,false,64),
|
||||
new ColumnDfn(20,"League",0,-9,false,64),
|
||||
new ColumnDfn(20,"Speciality",0,-9,false,64),
|
||||
new ColumnDfn(20,"SpecialitiesOther",0,-9,false,1000),
|
||||
new ColumnDfn(20,"RegionIdNation",4,4,false,10),
|
||||
new ColumnDfn(20,"RegionIdProvince",4,4,false,10),
|
||||
new ColumnDfn(20,"UserSportExperienceData",0,-9,false,0),
|
||||
new ColumnDfn(20,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(20,"Flags",3,5,false,5),
|
||||
new ColumnDfn(20,"Status",0,12,false,3),
|
||||
new ColumnDfn(20,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(20,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(20,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(20,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(20,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(20,"UpdateHost",0,12,false,100),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -99,6 +99,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> AssociationTypeCodes { get { return GetCodesOfType(Sax.CodeType.AssociationType); } }
|
||||
public List<TypeCodeDesc> AddressTypeCodes { get { return GetCodesOfType(Sax.CodeType.AddressType); } }
|
||||
public List<TypeCodeDesc> ContactMethodCodes { get { return GetCodesOfType(Sax.CodeType.ContactMethod); } }
|
||||
public List<TypeCodeDesc> EventTypeCodes { get { return GetCodesOfType(Sax.CodeType.EventType); } }
|
||||
|
||||
@@ -26,6 +26,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> associationTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> addressTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> contactMethodCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> eventTypeCodes = new List<TypeCodeDesc>();
|
||||
@@ -66,6 +67,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
return new List<TypeCodeDesc>(organisationCategoryCodes);
|
||||
case Sax.CodeType.OrganisationRole:
|
||||
return new List<TypeCodeDesc>(organisationRoleCodes);
|
||||
case Sax.CodeType.AssociationType:
|
||||
return new List<TypeCodeDesc>(associationTypeCodes);
|
||||
case Sax.CodeType.AddressType:
|
||||
return new List<TypeCodeDesc>(addressTypeCodes);
|
||||
case Sax.CodeType.ContactMethod:
|
||||
@@ -205,6 +208,11 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.OpportunityAdmin, "OPA", "Opportunities");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.ArticleAdmin, "ARA", "Articles");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Association Types.
|
||||
associationTypeCodes.Add(Sax.AssociationType.Affiliate, "Affiliate", "Affiliate");
|
||||
associationTypeCodes.Add(Sax.AssociationType.Partner, "Partner", "Partner");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Address Types.
|
||||
addressTypeCodes.Add(Sax.AddressType.Location, "Location", "Location");
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
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
|
||||
{
|
||||
//=======================================================================
|
||||
// ItemSport.
|
||||
//=======================================================================
|
||||
public abstract class SaxItemAssociation : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
// Item From.
|
||||
ItemTypeFrom,
|
||||
ItemTypeFrom_Code,
|
||||
ItemTypeFrom_Desc,
|
||||
ItemIdFrom,
|
||||
ItemFrom_Caption,
|
||||
// Item To.
|
||||
ItemTypeTo,
|
||||
ItemTypeTo_Code,
|
||||
ItemTypeTo_Desc,
|
||||
ItemIdTo,
|
||||
ItemTo_Caption,
|
||||
// Association type.
|
||||
AssociationType,
|
||||
AssociationType_Code,
|
||||
AssociationType_Desc,
|
||||
// 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 ItemIdFrom { get; set; } = new ItemId();
|
||||
public ItemId ItemIdTo { get; set; } = new ItemId();
|
||||
public Sax.AssociationType AssociationType { 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 ItemIdFrom
|
||||
{
|
||||
get { return data.ItemIdFrom; }
|
||||
set { value = ItemId.InvalidOnNull(value); CheckChanged(data.ItemIdFrom, value); data.ItemIdFrom = value; }
|
||||
}
|
||||
public ItemId ItemIdTo
|
||||
{
|
||||
get { return data.ItemIdTo; }
|
||||
set { value = ItemId.InvalidOnNull(value); CheckChanged(data.ItemIdTo, value); data.ItemIdTo = value; }
|
||||
}
|
||||
public Sax.AssociationType AssociationType
|
||||
{
|
||||
get { return data.AssociationType; }
|
||||
set { CheckChanged((int)data.AssociationType, (int)value); data.AssociationType = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
ItemIdFrom = data.ItemIdFrom;
|
||||
ItemIdTo = data.ItemIdTo;
|
||||
AssociationType = data.AssociationType;
|
||||
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 ItemIdFrom { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ItemIdTo { get; set; } = ValidValue.Valid;
|
||||
public ValidValue AssociationType { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxItemAssociation(SysId id, ItemId itemIdFrom, ItemId itemIdTo, Sax.AssociationType associationType) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
ItemIdFrom = itemIdFrom;
|
||||
ItemIdTo = itemIdTo;
|
||||
AssociationType = associationType;
|
||||
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.ItemAssociation, Id);
|
||||
}
|
||||
/// <summary>Valid 'From' item types for Association type.</summary>
|
||||
public static List<Sax.DataItemType> GetValidFromItemTypesForAssociation(Sax.AssociationType associationType)
|
||||
{
|
||||
List<Sax.DataItemType> itemTypes = new List<Sax.DataItemType>();
|
||||
switch (associationType)
|
||||
{
|
||||
case Sax.AssociationType.Affiliate:
|
||||
case Sax.AssociationType.Partner:
|
||||
itemTypes.Add(Sax.DataItemType.Organisation);
|
||||
break;
|
||||
}
|
||||
return itemTypes;
|
||||
}
|
||||
/// <summary>Valid 'To' item types for Association type.</summary>
|
||||
public static List<Sax.DataItemType> GetValidToItemTypesForAssociation(Sax.AssociationType associationType)
|
||||
{
|
||||
List<Sax.DataItemType> itemTypes = new List<Sax.DataItemType>();
|
||||
switch (associationType)
|
||||
{
|
||||
case Sax.AssociationType.Affiliate:
|
||||
case Sax.AssociationType.Partner:
|
||||
itemTypes.Add(Sax.DataItemType.Organisation);
|
||||
break;
|
||||
}
|
||||
return itemTypes;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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(ItemIdFrom) && ItemIdFrom.Type != data.ItemIdFrom.Type && SysId.ToInt(ItemIdFrom.Id) != SysId.ToInt(data.ItemIdFrom.Id))
|
||||
throw new NotSupportedException(fn + " From Item Id cannot be changed");
|
||||
if (ItemId.IsValid(ItemIdTo) && ItemIdTo.Type != data.ItemIdTo.Type && SysId.ToInt(ItemIdTo.Id) != SysId.ToInt(data.ItemIdTo.Id))
|
||||
throw new NotSupportedException(fn + " To Item Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public ItemId ItemIdFrom
|
||||
{
|
||||
get { return data.ItemIdFrom; }
|
||||
protected set { data.ItemIdFrom = value; }
|
||||
}
|
||||
public ItemId ItemIdTo
|
||||
{
|
||||
get { return data.ItemIdTo; }
|
||||
protected set { data.ItemIdTo = value; }
|
||||
}
|
||||
public Sax.AssociationType AssociationType
|
||||
{
|
||||
get { return data.AssociationType; }
|
||||
protected set { data.AssociationType = 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,
|
||||
ActiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <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>();
|
||||
/// <summary>Items that can be eitehr 'From' or 'To'.</summary>
|
||||
public List<ItemId> ItemIdsIncluded { get; } = new List<ItemId>();
|
||||
/// <summary>Items that can only be the 'From' item.</summary>
|
||||
public List<ItemId> ItemIdsFromIncluded { get; } = new List<ItemId>();
|
||||
/// <summary>Items that can only be the 'To' item.</summary>
|
||||
public List<ItemId> ItemIdsToIncluded { get; } = new List<ItemId>();
|
||||
public List<Sax.AssociationType> AssociationTypesIncluded { get; } = new List<Sax.AssociationType>();
|
||||
// Common properties.
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxAssociationList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -334,6 +334,15 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
return values.Find(item => item.Id.Equals(organisationId));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Get the name of the first Organisation in list with the specified Id.
|
||||
/// </summary>
|
||||
public static String GetOrganisationName(this List<SaxOrganisation> values, SysId organisationId)
|
||||
{
|
||||
return values.Find(item => item.Id.Equals(organisationId))?.Name ?? "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
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 Sport
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxItemAssociation CreateItemAssociation(ItemId itemIdFrom, ItemId itemIdTo, Sax.AssociationType associationType);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool ItemAssociationExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxItemAssociation.Params prmItemAssociation = new SaxItemAssociation.Params();
|
||||
prmItemAssociation.IdsIncluded.Add(id);
|
||||
prmItemAssociation.StatusCat = SaxItemAssociation.StatusCat.Any;
|
||||
return GetItemAssociationCount(prmItemAssociation) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxItemAssociation GetItemAssociation(SaxItemAssociation.Params prmItemAssociation);
|
||||
public SaxItemAssociation GetItemAssociationById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxItemAssociation.Params prmItemAssociation = new SaxItemAssociation.Params();
|
||||
prmItemAssociation.IdsIncluded.Add(id);
|
||||
prmItemAssociation.StatusCat = SaxItemAssociation.StatusCat.Any;
|
||||
return GetItemAssociation(prmItemAssociation);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidItemAssociation(SaxItemAssociation itemAssociation)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (itemAssociation == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidItemAssociationData(itemAssociation.GetData(), new SaxItemAssociation.ErrField());
|
||||
}
|
||||
public virtual bool IsValidItemAssociationData(SaxItemAssociation.Data data, SaxItemAssociation.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Item Id From.
|
||||
if (errField.ItemIdFrom != SacsHierarchyItem.ValidValue.Ignore && !ItemId.IsValid(data.ItemIdFrom))
|
||||
{
|
||||
errField.ItemIdFrom = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item Id From must be specified");
|
||||
}
|
||||
// Item Id To.
|
||||
if (errField.ItemIdTo != SacsHierarchyItem.ValidValue.Ignore && !ItemId.IsValid(data.ItemIdTo))
|
||||
{
|
||||
errField.ItemIdTo = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item Id To must be specified");
|
||||
}
|
||||
// Item Ids must differ.
|
||||
if (errField.ItemIdFrom != SacsHierarchyItem.ValidValue.Ignore && errField.ItemIdTo != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (data.ItemIdFrom.Equals(data.ItemIdTo))
|
||||
{
|
||||
errField.ItemIdTo = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item Ids must differ");
|
||||
}
|
||||
}
|
||||
// Association type.
|
||||
if (errField.AssociationType != SacsHierarchyItem.ValidValue.Ignore && (int)data.AssociationType < 1)
|
||||
{
|
||||
errField.AssociationType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Association type must be specified");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAssociation_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.ItemAssociation_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxItemAssociation.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertItemAssociation(SaxItemAssociation itemAssociation, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateItemAssociation(SaxItemAssociation itemAssociation, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool ItemAssociationCanBeDeleted(SaxItemAssociation itemAssociation)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteItemAssociation(SaxItemAssociation itemAssociation, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetItemAssociationColumnDfn(SaxItemAssociation.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetItemAssociationQueryFilter(SaxItemAssociation.Params prmItemAssociation);
|
||||
public abstract long GetItemAssociationCount(SaxItemAssociation.Params prmItemAssociation);
|
||||
public abstract List<SaxItemAssociation> GetItemAssociationList(SaxItemAssociation.Params prmItemAssociation);
|
||||
public abstract DbResultSet ExecuteItemAssociationQuery(List<ColumnDfn> columns, SaxItemAssociation.Params prmItemAssociation);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <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 GetItemAssociationDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxItemAssociation.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// From item type.
|
||||
case SaxItemAssociation.Column.ItemTypeFrom_Code:
|
||||
{
|
||||
value = new DataValue(DataItemTypeCodes.GetCodeForType(values.GetLong(column.DataName)));
|
||||
}
|
||||
break;
|
||||
case SaxItemAssociation.Column.ItemTypeFrom_Desc:
|
||||
{
|
||||
value = new DataValue(DataItemTypeCodes.GetDescForType(values.GetLong(column.DataName)));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// To item type.
|
||||
case SaxItemAssociation.Column.ItemTypeTo_Code:
|
||||
{
|
||||
value = new DataValue(DataItemTypeCodes.GetCodeForType(values.GetLong(column.DataName)));
|
||||
}
|
||||
break;
|
||||
case SaxItemAssociation.Column.ItemTypeTo_Desc:
|
||||
{
|
||||
value = new DataValue(DataItemTypeCodes.GetDescForType(values.GetLong(column.DataName)));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Association type.
|
||||
case SaxItemAssociation.Column.AssociationType_Code:
|
||||
case SaxItemAssociation.Column.AssociationType_Desc:
|
||||
{
|
||||
Sax.AssociationType associationType = (Sax.AssociationType)values.GetLong(column.DataName);
|
||||
if (column.Id == (int)SaxItemAssociation.Column.AssociationType_Code)
|
||||
value = new DataValue(AssociationTypeCodes.GetCodeForType(associationType));
|
||||
else
|
||||
value = new DataValue(AssociationTypeCodes.GetDescForType(associationType));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Notes.
|
||||
case SaxItemAssociation.Column.Notes:
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxItemAssociation.Column.Status_Desc:
|
||||
case SaxItemAssociation.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxItemAssociation.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxItemAssociation.Column.Status_Ind)
|
||||
value = new DataValue(SaxItemAssociation.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -75,6 +75,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> AssociationTypeCodes { get { return Internals.AssociationTypeCodes; } }
|
||||
public List<TypeCodeDesc> AddressTypeCodes { get { return Internals.AddressTypeCodes; } }
|
||||
public List<TypeCodeDesc> ContactMethodCodes { get { return Internals.ContactMethodCodes; } }
|
||||
public List<TypeCodeDesc> EventTypeCodes { get { return Internals.EventTypeCodes; } }
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Dbas.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public class SaxItemAssociation_Dbas : SaxItemAssociation
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private ISacsDatabase database;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SaxItemAssociation_Dbas(ISacsDatabase database, SysId id, ItemId itemIdFrom, ItemId itemIdTo, Sax.AssociationType associationType, UInt16 flags) :
|
||||
base(id, itemIdFrom, itemIdTo, associationType)
|
||||
{
|
||||
this.database = database;
|
||||
Flags = flags;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Associated data.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 9-Jun-2022 17:41:18
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
internal class Association_Db : SaxDbDataItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Column definitions.
|
||||
public class ColumnsData
|
||||
{
|
||||
public ColumnDataInt16 _ItemTypeFrom { get; } = new ColumnDataInt16("ItemTypeFrom");
|
||||
public ColumnDataInt32 _ItemIdFrom { get; } = new ColumnDataInt32("ItemIdFrom");
|
||||
public ColumnDataInt16 _ItemTypeTo { get; } = new ColumnDataInt16("ItemTypeTo");
|
||||
public ColumnDataInt32 _ItemIdTo { get; } = new ColumnDataInt32("ItemIdTo");
|
||||
public ColumnDataInt16 _AssociationType { get; } = new ColumnDataInt16("AssociationType");
|
||||
public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
|
||||
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
|
||||
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
|
||||
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
|
||||
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
|
||||
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
|
||||
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
|
||||
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
|
||||
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
protected static List<String> fields { get; } = new List<String>()
|
||||
{
|
||||
"ItemTypeFrom",
|
||||
"ItemIdFrom",
|
||||
"ItemTypeTo",
|
||||
"ItemIdTo",
|
||||
"AssociationType",
|
||||
"Notes",
|
||||
"Flags",
|
||||
"Status",
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
"UpdateOn",
|
||||
"UpdateBy",
|
||||
"UpdateHost",
|
||||
};
|
||||
protected static List<String> fieldsId { get; } = new List<String>()
|
||||
{
|
||||
};
|
||||
protected static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
{
|
||||
"ItemTypeFrom",
|
||||
"ItemIdFrom",
|
||||
"ItemTypeTo",
|
||||
"ItemIdTo",
|
||||
"AssociationType",
|
||||
};
|
||||
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
{
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal Association_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public override String SchemaName { get; } = "dbo";
|
||||
public override String TableName { get; } = "Association";
|
||||
public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
|
||||
public static List<String> Fields { get { return new List<String>(fields); } }
|
||||
public static List<String> FieldsId { get { return new List<String>(fieldsId); } }
|
||||
public static List<String> FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
|
||||
// Columns.
|
||||
public ColumnsData Cols { get; } = new ColumnsData();
|
||||
public Int16 _ItemTypeFrom { get { return Cols._ItemTypeFrom.Value; } set { Cols._ItemTypeFrom.Value = value; } }
|
||||
public Int32 _ItemIdFrom { get { return Cols._ItemIdFrom.Value; } set { Cols._ItemIdFrom.Value = value; } }
|
||||
public Int16 _ItemTypeTo { get { return Cols._ItemTypeTo.Value; } set { Cols._ItemTypeTo.Value = value; } }
|
||||
public Int32 _ItemIdTo { get { return Cols._ItemIdTo.Value; } set { Cols._ItemIdTo.Value = value; } }
|
||||
public Int16 _AssociationType { get { return Cols._AssociationType.Value; } set { Cols._AssociationType.Value = value; } }
|
||||
public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
|
||||
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
|
||||
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
|
||||
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
|
||||
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
|
||||
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
|
||||
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
|
||||
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
|
||||
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
|
||||
// Existing columns - confirmed on database if table exists.
|
||||
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
|
||||
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
{
|
||||
dbDataReader.Read();
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_ItemTypeFrom = GetFieldInt16(dbDataReader, "ItemTypeFrom", _ItemTypeFrom);
|
||||
_ItemIdFrom = GetFieldInt32(dbDataReader, "ItemIdFrom", _ItemIdFrom);
|
||||
_ItemTypeTo = GetFieldInt16(dbDataReader, "ItemTypeTo", _ItemTypeTo);
|
||||
_ItemIdTo = GetFieldInt32(dbDataReader, "ItemIdTo", _ItemIdTo);
|
||||
_AssociationType = GetFieldInt16(dbDataReader, "AssociationType", _AssociationType);
|
||||
_Notes = GetFieldString(dbDataReader, "Notes", _Notes);
|
||||
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
|
||||
_Status = GetFieldString(dbDataReader, "Status", _Status);
|
||||
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
|
||||
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
|
||||
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
|
||||
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
|
||||
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
|
||||
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteInsertCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("ItemTypeFrom")) AddCommandParameter(dbCommand, "@ItemTypeFrom", _ItemTypeFrom);
|
||||
if (columnNames.ContainsCI("ItemIdFrom")) AddCommandParameter(dbCommand, "@ItemIdFrom", _ItemIdFrom);
|
||||
if (columnNames.ContainsCI("ItemTypeTo")) AddCommandParameter(dbCommand, "@ItemTypeTo", _ItemTypeTo);
|
||||
if (columnNames.ContainsCI("ItemIdTo")) AddCommandParameter(dbCommand, "@ItemIdTo", _ItemIdTo);
|
||||
if (columnNames.ContainsCI("AssociationType")) AddCommandParameter(dbCommand, "@AssociationType", _AssociationType);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
|
||||
if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
|
||||
if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||
// Execute insert command.
|
||||
bool commandSuccess = false;
|
||||
int executeNonQuery = dbCommand.ExecuteNonQuery();
|
||||
if (executeNonQuery == 1)
|
||||
{
|
||||
commandSuccess = true;
|
||||
}
|
||||
return commandSuccess;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE ItemTypeFrom=@ItemTypeFrom AND ItemIdFrom=@ItemIdFrom AND ItemTypeTo=@ItemTypeTo AND ItemIdTo=@ItemIdTo AND AssociationType=@AssociationType;";
|
||||
}
|
||||
else
|
||||
{
|
||||
query += columnNames.Concat(", ", "", "=?") + " ";
|
||||
query += "WHERE ItemTypeFrom=? AND ItemIdFrom=? AND ItemTypeTo=? AND ItemIdTo=? AND AssociationType=?;";
|
||||
}
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteUpdateCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||
AddCommandParameter(dbCommand, "@ItemTypeFrom", _ItemTypeFrom);
|
||||
AddCommandParameter(dbCommand, "@ItemIdFrom", _ItemIdFrom);
|
||||
AddCommandParameter(dbCommand, "@ItemTypeTo", _ItemTypeTo);
|
||||
AddCommandParameter(dbCommand, "@ItemIdTo", _ItemIdTo);
|
||||
AddCommandParameter(dbCommand, "@AssociationType", _AssociationType);
|
||||
int executeNonQueryResult = dbCommand.ExecuteNonQuery();
|
||||
return (executeNonQueryResult == 1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
internal class ItemAssociation_Db : SaxDbDataItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Column definitions.
|
||||
public class ColumnsData
|
||||
{
|
||||
public ColumnDataInt64 _Id { get; } = new ColumnDataInt64("Id", true);
|
||||
public ColumnDataInt16 _ItemTypeFrom { get; } = new ColumnDataInt16("ItemTypeFrom");
|
||||
public ColumnDataInt32 _ItemIdFrom { get; } = new ColumnDataInt32("ItemIdFrom");
|
||||
public ColumnDataInt16 _ItemTypeTo { get; } = new ColumnDataInt16("ItemTypeTo");
|
||||
public ColumnDataInt32 _ItemIdTo { get; } = new ColumnDataInt32("ItemIdTo");
|
||||
public ColumnDataInt16 _AssociationType { get; } = new ColumnDataInt16("AssociationType");
|
||||
public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
|
||||
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
|
||||
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
|
||||
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
|
||||
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
|
||||
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
|
||||
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
|
||||
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
|
||||
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
protected static List<String> fields { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
"ItemTypeFrom",
|
||||
"ItemIdFrom",
|
||||
"ItemTypeTo",
|
||||
"ItemIdTo",
|
||||
"AssociationType",
|
||||
"Notes",
|
||||
"Flags",
|
||||
"Status",
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
"UpdateOn",
|
||||
"UpdateBy",
|
||||
"UpdateHost",
|
||||
};
|
||||
protected static List<String> fieldsId { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
protected static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
{
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal ItemAssociation_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public override String SchemaName { get; } = "dbo";
|
||||
public override String TableName { get; } = "ItemAssociation";
|
||||
public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
|
||||
public static List<String> Fields { get { return new List<String>(fields); } }
|
||||
public static List<String> FieldsId { get { return new List<String>(fieldsId); } }
|
||||
public static List<String> FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
|
||||
// Columns.
|
||||
public ColumnsData Cols { get; } = new ColumnsData();
|
||||
public Int64 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } }
|
||||
public Int16 _ItemTypeFrom { get { return Cols._ItemTypeFrom.Value; } set { Cols._ItemTypeFrom.Value = value; } }
|
||||
public Int32 _ItemIdFrom { get { return Cols._ItemIdFrom.Value; } set { Cols._ItemIdFrom.Value = value; } }
|
||||
public Int16 _ItemTypeTo { get { return Cols._ItemTypeTo.Value; } set { Cols._ItemTypeTo.Value = value; } }
|
||||
public Int32 _ItemIdTo { get { return Cols._ItemIdTo.Value; } set { Cols._ItemIdTo.Value = value; } }
|
||||
public Int16 _AssociationType { get { return Cols._AssociationType.Value; } set { Cols._AssociationType.Value = value; } }
|
||||
public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
|
||||
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
|
||||
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
|
||||
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
|
||||
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
|
||||
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
|
||||
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
|
||||
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
|
||||
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
|
||||
// Existing columns - confirmed on database if table exists.
|
||||
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
|
||||
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
{
|
||||
dbDataReader.Read();
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt64(dbDataReader, "Id", _Id);
|
||||
_ItemTypeFrom = GetFieldInt16(dbDataReader, "ItemTypeFrom", _ItemTypeFrom);
|
||||
_ItemIdFrom = GetFieldInt32(dbDataReader, "ItemIdFrom", _ItemIdFrom);
|
||||
_ItemTypeTo = GetFieldInt16(dbDataReader, "ItemTypeTo", _ItemTypeTo);
|
||||
_ItemIdTo = GetFieldInt32(dbDataReader, "ItemIdTo", _ItemIdTo);
|
||||
_AssociationType = GetFieldInt16(dbDataReader, "AssociationType", _AssociationType);
|
||||
_Notes = GetFieldString(dbDataReader, "Notes", _Notes);
|
||||
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
|
||||
_Status = GetFieldString(dbDataReader, "Status", _Status);
|
||||
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
|
||||
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
|
||||
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
|
||||
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
|
||||
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
|
||||
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Avoid insert if Identity field is already valid.
|
||||
if (_Id != 0) throw new Exception("Invalid for Insert - item already has a valid Id");
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
query += "Output Inserted.Id ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteInsertCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("ItemTypeFrom")) AddCommandParameter(dbCommand, "@ItemTypeFrom", _ItemTypeFrom);
|
||||
if (columnNames.ContainsCI("ItemIdFrom")) AddCommandParameter(dbCommand, "@ItemIdFrom", _ItemIdFrom);
|
||||
if (columnNames.ContainsCI("ItemTypeTo")) AddCommandParameter(dbCommand, "@ItemTypeTo", _ItemTypeTo);
|
||||
if (columnNames.ContainsCI("ItemIdTo")) AddCommandParameter(dbCommand, "@ItemIdTo", _ItemIdTo);
|
||||
if (columnNames.ContainsCI("AssociationType")) AddCommandParameter(dbCommand, "@AssociationType", _AssociationType);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
|
||||
if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
|
||||
if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||
// Execute insert command.
|
||||
bool commandSuccess = false;
|
||||
int executeNonQuery = dbCommand.ExecuteNonQuery();
|
||||
if (executeNonQuery == 1)
|
||||
{
|
||||
dbCommand.CommandText = "SELECT Max(Id) FROM " + TableNameFmt + ";";
|
||||
_Id = Convert.ToInt64(dbCommand.ExecuteScalar());
|
||||
commandSuccess = (_Id > 0);
|
||||
}
|
||||
return commandSuccess;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Avoid update if Identity field isn't valid.
|
||||
if (_Id == 0) throw new Exception("Invalid for Update - item has an invalid Id");
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
{
|
||||
query += columnNames.Concat(", ", "", "=?") + " ";
|
||||
query += "WHERE Id=?;";
|
||||
}
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteUpdateCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("ItemTypeFrom")) AddCommandParameter(dbCommand, "@ItemTypeFrom", _ItemTypeFrom);
|
||||
if (columnNames.ContainsCI("ItemIdFrom")) AddCommandParameter(dbCommand, "@ItemIdFrom", _ItemIdFrom);
|
||||
if (columnNames.ContainsCI("ItemTypeTo")) AddCommandParameter(dbCommand, "@ItemTypeTo", _ItemTypeTo);
|
||||
if (columnNames.ContainsCI("ItemIdTo")) AddCommandParameter(dbCommand, "@ItemIdTo", _ItemIdTo);
|
||||
if (columnNames.ContainsCI("AssociationType")) AddCommandParameter(dbCommand, "@AssociationType", _AssociationType);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||
AddCommandParameter(dbCommand, "@Id", _Id);
|
||||
int executeNonQueryResult = dbCommand.ExecuteNonQuery();
|
||||
return (executeNonQueryResult == 1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Jun-2022 09:36:43
|
||||
// Code generated by Sarand Database Utilities Fri 10-Jun-2022 07:59:42
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -0,0 +1,603 @@
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
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.Dbas.Bus;
|
||||
using Saxonite.Net.Standard.Dbas.Internal;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Text;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System.Linq;
|
||||
|
||||
namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxItemDataMgr_Dbas
|
||||
{
|
||||
//*******************************************************************
|
||||
// Item Data Mgr - Item Sport
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
private List<StringPair> GetLogProperties(SaxItemAssociation itemAssociation)
|
||||
{
|
||||
return new List<StringPair>()
|
||||
{
|
||||
new StringPair("ItemIdFrom", (Sax.DataItemType)itemAssociation.ItemIdFrom.Type + ": " + itemAssociation.ItemIdFrom.Id),
|
||||
new StringPair("ItemIdTo", (Sax.DataItemType)itemAssociation.ItemIdTo.Type + ": " + itemAssociation.ItemIdTo.Id),
|
||||
new StringPair("AssociationType",itemAssociation.AssociationType.ToString()),
|
||||
new StringPair("Status",itemAssociation.StatusCode)
|
||||
};
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public override SaxItemAssociation CreateItemAssociation(ItemId itemIdFrom, ItemId itemIdTo, Sax.AssociationType associationType)
|
||||
{
|
||||
ClearErrorState();
|
||||
return new SaxItemAssociation_Dbas(CoreDatabase, null, itemIdFrom, itemIdTo, associationType, 0);
|
||||
}
|
||||
private SaxItemAssociation_Dbas CreateItemAssociation(ItemAssociation_Db dbItemAssociation)
|
||||
{
|
||||
ClearErrorState();
|
||||
ItemId itemIdFrom = new ItemId(dbItemAssociation._ItemTypeFrom, new SysId(dbItemAssociation._ItemIdFrom));
|
||||
ItemId itemIdTo = new ItemId(dbItemAssociation._ItemTypeTo, new SysId(dbItemAssociation._ItemIdTo));
|
||||
SaxItemAssociation_Dbas itemAssociation = new SaxItemAssociation_Dbas(CoreDatabase, new SysId(dbItemAssociation._Id), itemIdFrom, itemIdTo, (Sax.AssociationType)dbItemAssociation._AssociationType, (ushort)dbItemAssociation._Flags);
|
||||
PopulateFrom(dbItemAssociation, itemAssociation);
|
||||
return itemAssociation;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get item.
|
||||
public override SaxItemAssociation GetItemAssociation(SaxItemAssociation.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetItemAssociation(GetItemAssociationQueryFilter(prm).Concat(" And ", "(", ")"));
|
||||
}
|
||||
private SaxItemAssociation GetItemAssociation(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
long count = GetItemAssociationCount(filter);
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple items found");
|
||||
return null;
|
||||
}
|
||||
SaxItemAssociation itemAssociation = null;
|
||||
// Query data.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
ItemAssociation_Db dbItemAssociation = new ItemAssociation_Db(CoreDbInfo);
|
||||
dbItemAssociation.PopulateFrom(dbCommand, aliasItemAssociation, filter);
|
||||
itemAssociation = CreateItemAssociation(dbItemAssociation);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SaLogger.Warn(GetType().Name + ".GetItemAssociation\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
}
|
||||
return itemAssociation;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item.
|
||||
public override bool IsValidItemAssociationData(SaxItemAssociation.Data data, SaxItemAssociation.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.IsValidItemAssociationData(data, errField)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert item.
|
||||
public override bool InsertItemAssociation(SaxItemAssociation itemAssociation, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertItemAssociation";
|
||||
ClearErrorState();
|
||||
if (!IsValidItemAssociation(itemAssociation)) return false;
|
||||
if (SysId.IsValid(itemAssociation.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
ItemAssociation_Db dbItemAssociation = new ItemAssociation_Db(CoreDbInfo);
|
||||
PopulateTo(dbItemAssociation, itemAssociation, dbUpdateInfo);
|
||||
if (ItemAssociation_Db.FieldsNonId.Contains("Id"))
|
||||
{
|
||||
// Generate next Id.
|
||||
dbItemAssociation._Id = CoreDatabase.GetNextIdFromTable("ItemAssociation");
|
||||
}
|
||||
dbItemAssociation.ExecuteInsertCommand(dbCommand);
|
||||
itemAssociation.Id = new SysId(dbItemAssociation._Id);
|
||||
itemAssociation.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(itemAssociation).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update item.
|
||||
public override bool UpdateItemAssociation(SaxItemAssociation itemAssociation, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateItemAssociation";
|
||||
ClearErrorState();
|
||||
if (!IsValidItemAssociation(itemAssociation)) return false;
|
||||
if (!SysId.IsValid(itemAssociation.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!itemAssociation.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(itemAssociation).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
ItemAssociation_Db dbItemAssociation = new ItemAssociation_Db(CoreDbInfo);
|
||||
dbItemAssociation.PopulateFrom(dbCommand, aliasItemAssociation, "Id=" + SysId.ToString(itemAssociation.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_ItemAssociation updateLogMonitor = new SaxUpdateLogItemMonitor_ItemAssociation(SessionContext, CreateItemAssociation(dbItemAssociation), dbUpdateInfo);
|
||||
// Update item.
|
||||
PopulateTo(dbItemAssociation, itemAssociation, dbUpdateInfo);
|
||||
dbItemAssociation.ExecuteUpdateCommand(dbCommand);
|
||||
itemAssociation.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(itemAssociation).Concat(": ").Concat("", "\n\t"));
|
||||
// Record updates.
|
||||
// ToDo updateLogMonitor.RecordUpdatedValues(itemAssociation);
|
||||
// ToDo updateLogMonitor.LogUpdates();
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Delete item.
|
||||
public override bool ItemAssociationCanBeDeleted(SaxItemAssociation itemAssociation)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.ItemAssociationCanBeDeleted(itemAssociation)) return false;
|
||||
return true;
|
||||
}
|
||||
public override bool DeleteItemAssociation(SaxItemAssociation itemAssociation, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteItemAssociation";
|
||||
ClearErrorState();
|
||||
if (!ItemAssociationCanBeDeleted(itemAssociation)) return false;
|
||||
|
||||
// Item Sports are logically deleted by changing the status.
|
||||
itemAssociation.Status = SaStatus.Deleted;
|
||||
return UpdateItemAssociation(itemAssociation, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
ItemAssociation_Db dbItemAssociation = new ItemAssociation_Db(CoreDbInfo);
|
||||
dbItemAssociation.PopulateFrom(dbCommand, aliasItemAssociation, "Id=" + itemAssociation.Id.ToString());
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemAssociation) + " WHERE Id=" + SysId.ToString(itemAssociation.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
itemAssociation.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(itemAssociation).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from database.
|
||||
private void PopulateTo(ItemAssociation_Db dbItemAssociation, SaxItemAssociation itemAssociation, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
dbItemAssociation._Id = SysId.ToInt(itemAssociation.Id);
|
||||
dbItemAssociation._ItemTypeFrom = itemAssociation.ItemIdFrom.Type;
|
||||
dbItemAssociation._ItemIdFrom = SysId.ToInt(itemAssociation.ItemIdFrom.Id);
|
||||
dbItemAssociation._ItemTypeTo = itemAssociation.ItemIdTo.Type;
|
||||
dbItemAssociation._ItemIdTo = SysId.ToInt(itemAssociation.ItemIdTo.Id);
|
||||
dbItemAssociation._AssociationType = (short)itemAssociation.AssociationType;
|
||||
// Common.
|
||||
dbItemAssociation._Notes = itemAssociation.Notes;
|
||||
dbItemAssociation._Status = SacsSystem.GetStatusCode(itemAssociation.Status);
|
||||
dbItemAssociation._Flags = (short)itemAssociation.Flags;
|
||||
if (!SysId.IsValid(itemAssociation.Id))
|
||||
{
|
||||
dbItemAssociation._CreateOn = DateTime.Now;
|
||||
dbItemAssociation._CreateBy = dbUpdateInfo.UserId.ToInt();
|
||||
dbItemAssociation._CreateHost = dbUpdateInfo.Host;
|
||||
}
|
||||
dbItemAssociation._UpdateOn = DateTime.Now;
|
||||
dbItemAssociation._UpdateBy = dbUpdateInfo.UserId.ToInt();
|
||||
dbItemAssociation._UpdateHost = dbUpdateInfo.Host;
|
||||
}
|
||||
private void PopulateFrom(ItemAssociation_Db dbItemAssociation, SaxItemAssociation itemAssociation)
|
||||
{
|
||||
//itemAssociation.Id = new SysId(dbItemAssociation._Id);
|
||||
//itemAssociation.ItemIdFrom = new ItemId(dbItemAssociation._ItemTypeFrom, new SysId(dbItemAssociation._ItemIdFrom);
|
||||
//itemAssociation.ItemIdTo = new ItemId(dbItemAssociation._ItemTypeTo, new SysId(dbItemAssociation._ItemIdTo);
|
||||
//itemAssociation.AssociationType = (Sax.AssociationType)dbItemAssociation._AssociationType;
|
||||
// Common.
|
||||
itemAssociation.Notes = dbItemAssociation._Notes;
|
||||
itemAssociation.Status = SacsSystem.GetStatusForCode(dbItemAssociation._Status);
|
||||
itemAssociation.SetCreateStamp(dbItemAssociation._CreateOn, new SysId(dbItemAssociation._CreateBy), dbItemAssociation._CreateHost);
|
||||
itemAssociation.SetUpdateStamp(dbItemAssociation._UpdateOn, new SysId(dbItemAssociation._UpdateBy), dbItemAssociation._UpdateHost);
|
||||
itemAssociation.AcceptChanges();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item column definitions.
|
||||
private static readonly String aliasItemAssociation = "ItmAss";
|
||||
private void SetItemAssociationColDfn
|
||||
(ColumnDfn col, String caption, int width, SaxDbDfn_Core.ColumnIdx dbCol,
|
||||
ColumnAlignment align = ColumnAlignment.Default, DataValue.DataType dataType = DataValue.DataType.String,
|
||||
String alias = "", String prefix = "")
|
||||
{
|
||||
if (String.IsNullOrEmpty(alias) && SaxDbDfn_Core.GetTableForColumn(dbCol) == SaxDbDfn_Core.TableIdx.ItemAssociation)
|
||||
alias = aliasItemAssociation;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SaxDbDfn_Core.GetColumnName(dbCol, false), SaxDbDfn_Core.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SaxDbDfn_Core.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SaxDbDfn_Core.GetColTextLen(dbCol);
|
||||
}
|
||||
public override ColumnDfn GetItemAssociationColumnDfn(SaxItemAssociation.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||
switch (columnId)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
case SaxItemAssociation.Column.Pos:
|
||||
SetItemAssociationColDfn(columnDfn, "Pos", 60, SaxDbDfn_Core.ColumnIdx.Unknown, ColumnAlignment.Right);
|
||||
columnDfn.SortMode = ColumnDfn.ColumnSortMode.Off;
|
||||
columnDfn.ReadOnly = true;
|
||||
columnDfn.Resizable = false;
|
||||
break;
|
||||
case SaxItemAssociation.Column.Id:
|
||||
SetItemAssociationColDfn(columnDfn, "Id", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_Id, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// 'From' Item Id.
|
||||
case SaxItemAssociation.Column.ItemTypeFrom:
|
||||
SetItemAssociationColDfn(columnDfn, "From item type", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemTypeFrom, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAssociation.Column.ItemTypeFrom_Code:
|
||||
SetItemAssociationColDfn(columnDfn, "From item type", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemTypeFrom, ColumnAlignment.Center);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAssociation.Column.ItemTypeFrom_Desc:
|
||||
SetItemAssociationColDfn(columnDfn, "From item type", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemTypeFrom, ColumnAlignment.Center);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAssociation.Column.ItemIdFrom:
|
||||
SetItemAssociationColDfn(columnDfn, "From item Id", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemIdFrom, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// 'To' Item Id.
|
||||
case SaxItemAssociation.Column.ItemTypeTo:
|
||||
SetItemAssociationColDfn(columnDfn, "To item type", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemTypeTo, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAssociation.Column.ItemTypeTo_Code:
|
||||
SetItemAssociationColDfn(columnDfn, "To item type", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemTypeTo, ColumnAlignment.Center);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAssociation.Column.ItemTypeTo_Desc:
|
||||
SetItemAssociationColDfn(columnDfn, "To item type", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemTypeTo, ColumnAlignment.Center);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAssociation.Column.ItemIdTo:
|
||||
SetItemAssociationColDfn(columnDfn, "To item Id", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemIdTo, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Association type.
|
||||
case SaxItemAssociation.Column.AssociationType:
|
||||
SetItemAssociationColDfn(columnDfn, "Type", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_AssociationType, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAssociation.Column.AssociationType_Code:
|
||||
SetItemAssociationColDfn(columnDfn, "Type", 100, SaxDbDfn_Core.ColumnIdx.ItemAssociation_AssociationType, ColumnAlignment.Center);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAssociation.Column.AssociationType_Desc:
|
||||
SetItemAssociationColDfn(columnDfn, "Type", 120, SaxDbDfn_Core.ColumnIdx.ItemAssociation_AssociationType, ColumnAlignment.Center);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Derived properties.
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Common properties.
|
||||
case SaxItemAssociation.Column.Notes:
|
||||
SetItemAssociationColDfn(columnDfn, "Notes", 240, SaxDbDfn_Core.ColumnIdx.ItemAssociation_Notes);
|
||||
break;
|
||||
case SaxItemAssociation.Column.Flags:
|
||||
SetItemAssociationColDfn(columnDfn, "Flags", 60, SaxDbDfn_Core.ColumnIdx.ItemAssociation_Flags, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
break;
|
||||
case SaxItemAssociation.Column.Status:
|
||||
SetItemAssociationColDfn(columnDfn, "Status", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_Status, ColumnAlignment.Center);
|
||||
break;
|
||||
case SaxItemAssociation.Column.Status_Desc:
|
||||
SetItemAssociationColDfn(columnDfn, "Status", 90, SaxDbDfn_Core.ColumnIdx.ItemAssociation_Status, ColumnAlignment.Center);
|
||||
break;
|
||||
case SaxItemAssociation.Column.Status_Ind:
|
||||
SetItemAssociationColDfn(columnDfn, "Status", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_Status, ColumnAlignment.Center, DataValue.DataType.TriState);
|
||||
columnDfn.TriStateFormat = ColumnTriStateFormat.Lights;
|
||||
break;
|
||||
case SaxItemAssociation.Column.CreateOn_Date:
|
||||
SetItemAssociationColDfn(columnDfn, "Created", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_CreateOn, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAssociation.Column.UpdateOn_Date:
|
||||
SetItemAssociationColDfn(columnDfn, "Updated", 80, SaxDbDfn_Core.ColumnIdx.ItemAssociation_UpdateOn, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
if (!String.IsNullOrEmpty(caption))
|
||||
columnDfn.Caption = caption;
|
||||
if (width > 0)
|
||||
columnDfn.Width = width;
|
||||
return columnDfn;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item query filter.
|
||||
public override List<string> GetItemAssociationQueryFilter(SaxItemAssociation.Params prm)
|
||||
{
|
||||
List<String> filter = new List<String>();
|
||||
|
||||
// Item Ids.
|
||||
String idsIncluded = prm.IdsIncluded.Concat(",");
|
||||
if (!idsIncluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_Id, aliasItemAssociation) + " IN (" + idsIncluded + ")");
|
||||
String idsExcluded = prm.IdsExcluded.Concat(",");
|
||||
if (!idsExcluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_Id, aliasItemAssociation) + " NOT IN (" + idsExcluded + ")");
|
||||
|
||||
// Item Ids - can be either 'From' or 'To'.
|
||||
if (!prm.ItemIdsIncluded.IsEmpty())
|
||||
{
|
||||
List<String> itemIdFilters = new List<string>();
|
||||
foreach (ItemId itemId in prm.ItemIdsIncluded)
|
||||
{
|
||||
if (!ItemId.IsValid(itemId)) continue;
|
||||
String itemIdFilter =
|
||||
SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemTypeFrom, aliasItemAssociation) + "=" + itemId.Type +
|
||||
" AND " + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemIdFrom, aliasItemAssociation) + "=" + SysId.ToInt(itemId.Id);
|
||||
itemIdFilters.Add(itemIdFilter);
|
||||
itemIdFilter =
|
||||
SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemTypeTo, aliasItemAssociation) + "=" + itemId.Type +
|
||||
" AND " + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemIdTo, aliasItemAssociation) + "=" + SysId.ToInt(itemId.Id);
|
||||
itemIdFilters.Add(itemIdFilter);
|
||||
}
|
||||
if (!itemIdFilters.IsEmpty())
|
||||
filter.Add(itemIdFilters.Concat(" OR ", "(", ")"));
|
||||
}
|
||||
|
||||
// 'From' Item Ids.
|
||||
if (!prm.ItemIdsFromIncluded.IsEmpty())
|
||||
{
|
||||
List<String> itemIdFilters = new List<string>();
|
||||
foreach (ItemId itemId in prm.ItemIdsFromIncluded)
|
||||
{
|
||||
if (!ItemId.IsValid(itemId)) continue;
|
||||
String itemIdFilter =
|
||||
SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemTypeFrom, aliasItemAssociation) + "=" + itemId.Type +
|
||||
" AND " + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemIdFrom, aliasItemAssociation) + "=" + SysId.ToInt(itemId.Id);
|
||||
itemIdFilters.Add(itemIdFilter);
|
||||
}
|
||||
if (!itemIdFilters.IsEmpty())
|
||||
filter.Add(itemIdFilters.Concat(" OR ", "(", ")"));
|
||||
}
|
||||
|
||||
// 'To' Item Ids.
|
||||
if (!prm.ItemIdsToIncluded.IsEmpty())
|
||||
{
|
||||
List<String> itemIdFilters = new List<string>();
|
||||
foreach (ItemId itemId in prm.ItemIdsToIncluded)
|
||||
{
|
||||
if (!ItemId.IsValid(itemId)) continue;
|
||||
String itemIdFilter =
|
||||
SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemTypeTo, aliasItemAssociation) + "=" + itemId.Type +
|
||||
" AND " + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemIdTo, aliasItemAssociation) + "=" + SysId.ToInt(itemId.Id);
|
||||
itemIdFilters.Add(itemIdFilter);
|
||||
}
|
||||
if (!itemIdFilters.IsEmpty())
|
||||
filter.Add(itemIdFilters.Concat(" OR ", "(", ")"));
|
||||
}
|
||||
|
||||
// Association types.
|
||||
if (!prm.AssociationTypesIncluded.IsEmpty())
|
||||
{
|
||||
String associationTypes = prm.AssociationTypesIncluded.Select(ItemAddressCanBeDeleted => ((int)ItemAddressCanBeDeleted).ToString()).ToList().Concat(",");
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_AssociationType, aliasItemAssociation) + " IN (" + associationTypes + ")");
|
||||
}
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat != SaxItemAssociation.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_Status, aliasItemAssociation) + GetItemAssociationStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetItemAssociationStatusCatFilterCondition(SaxItemAssociation.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxItemAssociation.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxItemAssociation.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxItemAssociation.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxItemAssociation.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetItemAssociationSortColumns(SaxItemAssociation.Params prm)
|
||||
{
|
||||
// Sort sequence:
|
||||
List<String> sortColumnNames = new List<String>();
|
||||
foreach (var columnDfn in prm.SortColumns)
|
||||
{
|
||||
// Need to ensure correct alias used for ItemAssociation columns in case of conflict.
|
||||
String sortCol = String.Empty;
|
||||
if (SaxDbDfn_Core.GetTableForColumn((SaxDbDfn_Core.ColumnIdx)columnDfn.DbColumn) == SaxDbDfn_Core.TableIdx.ItemAssociation)
|
||||
{
|
||||
sortCol = SaxDbDfn_Core.GetColumnNameQual((SaxDbDfn_Core.ColumnIdx)columnDfn.DbColumn, aliasItemAssociation);
|
||||
}
|
||||
else
|
||||
{
|
||||
sortCol = columnDfn.DataName;
|
||||
if (!StringUtil.IsEmpty(columnDfn.SortDataName))
|
||||
sortCol = columnDfn.SortDataName;
|
||||
}
|
||||
if (!sortCol.IsEmpty())
|
||||
{
|
||||
DbOrderByNullMode orderByNullMode = DbOrderByNullMode.Default; // eSaOrderByDemoteNulls, eSaOrderByPromoteNulls
|
||||
sortColumnNames.Add(DbQuery.FormatForOrderBy(sortCol, columnDfn.SortAscending, orderByNullMode).Concat(", "));
|
||||
}
|
||||
}
|
||||
sortColumnNames.RemoveBlanks();
|
||||
if (sortColumnNames.IsEmpty())
|
||||
{
|
||||
// Default sort columns.
|
||||
sortColumnNames.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_Id, aliasItemAssociation) + " ASC");
|
||||
}
|
||||
return sortColumnNames;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item count.
|
||||
private long GetItemAssociationCount(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
return CoreDatabase.GetRowCount(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemAssociation) + " As " + aliasItemAssociation, filter);
|
||||
}
|
||||
public override long GetItemAssociationCount(SaxItemAssociation.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetItemAssociationCount(GetItemAssociationQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public override List<SaxItemAssociation> GetItemAssociationList(SaxItemAssociation.Params prm)
|
||||
{
|
||||
List<SaxItemAssociation> itemAssociations = new List<SaxItemAssociation>();
|
||||
DbQuery qry = new DbQuery(CoreDatabase.DbmsType);
|
||||
qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemAssociation), aliasItemAssociation);
|
||||
ItemAssociation_Db dbItemAssociation = new ItemAssociation_Db(CoreDbInfo);
|
||||
qry.Columns.AddRange(dbItemAssociation.ExistingColumnNames);
|
||||
qry.Filters.AddRange(GetItemAssociationQueryFilter(prm));
|
||||
qry.OrderBy.AddRange(GetItemAssociationSortColumns(prm));
|
||||
// Query data.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
dbCommand.CommandText = qry.BuildQuery(prm.ResultsPaging);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
{
|
||||
while (dbDataReader.Read())
|
||||
{
|
||||
dbItemAssociation = new ItemAssociation_Db(CoreDbInfo);
|
||||
dbItemAssociation.PopulateFrom(dbDataReader);
|
||||
itemAssociations.Add(CreateItemAssociation(dbItemAssociation));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(GetType().Name + ".GetItemAssociationList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
}
|
||||
return itemAssociations;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item query execution.
|
||||
public override DbResultSet ExecuteItemAssociationQuery(List<ColumnDfn> columns, SaxItemAssociation.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Construct query.
|
||||
DbQuery query = new DbQuery(CoreDatabase.DbmsType);
|
||||
query.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemAssociation), aliasItemAssociation);
|
||||
|
||||
// Add columns as defined in query list.
|
||||
if (columns.HasId(SaxItemAssociation.Column.Id))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_Id, aliasItemAssociation));
|
||||
if (columns.HasId(SaxItemAssociation.Column.ItemTypeFrom) || columns.HasId(SaxItemAssociation.Column.ItemTypeFrom_Code) || columns.HasId(SaxItemAssociation.Column.ItemTypeFrom_Desc))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemTypeFrom, aliasItemAssociation));
|
||||
if (columns.HasId(SaxItemAssociation.Column.ItemIdFrom))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemIdFrom, aliasItemAssociation));
|
||||
if (columns.HasId(SaxItemAssociation.Column.ItemTypeTo) || columns.HasId(SaxItemAssociation.Column.ItemTypeTo_Code) || columns.HasId(SaxItemAssociation.Column.ItemTypeTo_Desc))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemTypeTo, aliasItemAssociation));
|
||||
if (columns.HasId(SaxItemAssociation.Column.ItemIdTo))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_ItemIdTo, aliasItemAssociation));
|
||||
if (columns.HasId(SaxItemAssociation.Column.AssociationType) || columns.HasId(SaxItemAssociation.Column.AssociationType_Code) || columns.HasId(SaxItemAssociation.Column.AssociationType_Desc))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_AssociationType, aliasItemAssociation));
|
||||
// Common properties.
|
||||
if (columns.HasId(SaxItemAssociation.Column.Notes))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_Notes, aliasItemAssociation));
|
||||
if (columns.HasId(SaxItemAssociation.Column.Flags))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_Flags, aliasItemAssociation));
|
||||
if (columns.HasId(SaxItemAssociation.Column.Status) || columns.HasId(SaxItemAssociation.Column.Status_Desc) || columns.HasId(SaxItemAssociation.Column.Status_Ind))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_Status, aliasItemAssociation));
|
||||
if (columns.HasId(SaxItemAssociation.Column.CreateOn_Date))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_CreateOn, aliasItemAssociation));
|
||||
if (columns.HasId(SaxItemAssociation.Column.UpdateOn_Date))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAssociation_UpdateOn, aliasItemAssociation));
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Populate filter.
|
||||
query.Filters.AddRange(GetItemAssociationQueryFilter(prm));
|
||||
|
||||
if (prm.IdsIncluded.Count != 1)
|
||||
{
|
||||
// Configure sort sequence.
|
||||
foreach (String sortColumn in GetItemAssociationSortColumns(prm))
|
||||
query.OrderBy.Add(sortColumn);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
//return new DbResultSet_DataTableReader(db, query.BuildQuery(prm.ResultsPaging));
|
||||
return DbResultSet_DataReader.ExecuteQuery(CoreDatabase, query.BuildQuery(prm.ResultsPaging));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -232,7 +232,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
private void PopulateFrom(ItemSport_Db dbItemSport, SaxItemSport itemSport)
|
||||
{
|
||||
itemSport.Id = new SysId(dbItemSport._Id);
|
||||
//itemSport.Id = new SysId(dbItemSport._Id);
|
||||
//itemSport.ItemId = new ItemId(dbItemSport._ItemType, new SysId(dbItemSport._ItemId);
|
||||
//itemSport.SportId = new SysId(dbItemSport._SportId);
|
||||
itemSport.ItemSportData = dbItemSport._ItemSportData;
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>6</UniqueValues>
|
||||
<UniqueValues>7</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
@@ -1609,6 +1609,380 @@
|
||||
</DbDfnIndex>
|
||||
</Indices>
|
||||
</DbDfnTable>
|
||||
<DbDfnTable>
|
||||
<Schema>dbo</Schema>
|
||||
<Name>ItemAssociation</Name>
|
||||
<Remarks />
|
||||
<Columns>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>1</Pos>
|
||||
<Name>Id</Name>
|
||||
<DataType>BigInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-5</DataTypeNative>
|
||||
<DataTypeNameNative>bigint</DataTypeNameNative>
|
||||
<IsIdentity>true</IsIdentity>
|
||||
<Size>19</Size>
|
||||
<BufferLen>8</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>2</Pos>
|
||||
<Name>ItemTypeFrom</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>5</DataTypeNative>
|
||||
<DataTypeNameNative>smallint</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>3</Pos>
|
||||
<Name>ItemIdFrom</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>4</DataTypeNative>
|
||||
<DataTypeNameNative>int</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>4</Pos>
|
||||
<Name>ItemTypeTo</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>5</DataTypeNative>
|
||||
<DataTypeNameNative>smallint</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>5</Pos>
|
||||
<Name>ItemIdTo</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>4</DataTypeNative>
|
||||
<DataTypeNameNative>int</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>6</Pos>
|
||||
<Name>AssociationType</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>5</DataTypeNative>
|
||||
<DataTypeNameNative>smallint</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>7</Pos>
|
||||
<Name>Notes</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>2000</Size>
|
||||
<BufferLen>4000</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>8</Pos>
|
||||
<Name>Flags</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>5</DataTypeNative>
|
||||
<DataTypeNameNative>smallint</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>9</Pos>
|
||||
<Name>Status</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>12</DataTypeNative>
|
||||
<DataTypeNameNative>varchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>3</Size>
|
||||
<BufferLen>3</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>10</Pos>
|
||||
<Name>CreateOn</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>93</DataTypeNative>
|
||||
<DataTypeNameNative>datetime</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>11</Pos>
|
||||
<Name>CreateBy</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>4</DataTypeNative>
|
||||
<DataTypeNameNative>int</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>12</Pos>
|
||||
<Name>CreateHost</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>12</DataTypeNative>
|
||||
<DataTypeNameNative>varchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>100</Size>
|
||||
<BufferLen>100</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>13</Pos>
|
||||
<Name>UpdateOn</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>93</DataTypeNative>
|
||||
<DataTypeNameNative>datetime</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>14</Pos>
|
||||
<Name>UpdateBy</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>4</DataTypeNative>
|
||||
<DataTypeNameNative>int</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Pos>15</Pos>
|
||||
<Name>UpdateHost</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>12</DataTypeNative>
|
||||
<DataTypeNameNative>varchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>100</Size>
|
||||
<BufferLen>100</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
</Columns>
|
||||
<Indices>
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Name>PK_ItemAssociation</Name>
|
||||
<IndexType>1</IndexType>
|
||||
<Unique>true</Unique>
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>1</Seq>
|
||||
<Name>Id</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
</Columns>
|
||||
</DbDfnIndex>
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Name>IDX_ItemAssociation_ItemFrom_ItemTo_Type</Name>
|
||||
<IndexType>3</IndexType>
|
||||
<Unique>true</Unique>
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>1</Seq>
|
||||
<Name>ItemTypeFrom</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>2</Seq>
|
||||
<Name>ItemIdFrom</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>3</Seq>
|
||||
<Name>ItemTypeTo</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>4</Seq>
|
||||
<Name>ItemIdTo</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>5</Seq>
|
||||
<Name>AssociationType</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
</Columns>
|
||||
</DbDfnIndex>
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Name>IDX_ItemAssociation_ItemFrom</Name>
|
||||
<IndexType>3</IndexType>
|
||||
<Unique>false</Unique>
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>1</Seq>
|
||||
<Name>ItemTypeFrom</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>2</Seq>
|
||||
<Name>ItemIdFrom</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
</Columns>
|
||||
</DbDfnIndex>
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAssociation</Table>
|
||||
<Name>IDX_ItemAssociation_ItemTo</Name>
|
||||
<IndexType>3</IndexType>
|
||||
<Unique>false</Unique>
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>1</Seq>
|
||||
<Name>ItemTypeTo</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>2</Seq>
|
||||
<Name>ItemIdTo</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
</Columns>
|
||||
</DbDfnIndex>
|
||||
</Indices>
|
||||
</DbDfnTable>
|
||||
<DbDfnTable>
|
||||
<Schema>dbo</Schema>
|
||||
<Name>ItemImage</Name>
|
||||
@@ -2000,7 +2374,7 @@
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>31</UniqueValues>
|
||||
<UniqueValues>33</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
|
||||
Reference in New Issue
Block a user