v1.1.1.0
This commit is contained in:
@@ -98,6 +98,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> AddressTypeCodes { get { return Internals.AddressTypeCodes; } }
|
||||
public List<TypeCodeDesc> OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } }
|
||||
public List<TypeCodeDesc> ActivityReactionCodes { get { return Internals.ActivityReactionCodes; } }
|
||||
// Email.
|
||||
|
||||
@@ -7,6 +7,7 @@ using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using Saxonite.Net.Standard.Base.Consoles;
|
||||
using Saxonite.Net.Standard.Base.Mgr;
|
||||
using System;
|
||||
@@ -43,6 +44,14 @@ namespace Saxonite.Net.Core.Web.Base.Models
|
||||
public bool DebugMode { get { return SaxSystem.DebugMode; } }
|
||||
public SaxLocaliser Localiser { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Page configuration.
|
||||
public bool OK { get { return !HasMessages(); } }
|
||||
public virtual bool ProhibitCache { get; set; } = true;
|
||||
public String PageCaption { get; set; }
|
||||
public String InstanceVersion { get { return !StringUtil.IsEmpty(App.SessionConfig.Instance) ? App.SessionConfig.Instance + " v" + Sax.Version.GetFullVersion() : "v" + Sax.Version.GetAppVersion(); } }
|
||||
public bool IncludeGoogleAnalytics { get; set; } = false;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Business components.
|
||||
protected SaxInternals Internals { get { if (internals == null) internals = new SaxInternals(SessionContext); return internals; } }
|
||||
@@ -63,16 +72,30 @@ 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> AddressTypeCodes { get { return Internals.AddressTypeCodes; } }
|
||||
public List<TypeCodeDesc> OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } }
|
||||
public List<TypeCodeDesc> ActivityReactionCodes { get { return Internals.ActivityReactionCodes; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Page configuration.
|
||||
public bool OK { get { return !HasMessages(); } }
|
||||
public virtual bool ProhibitCache { get; set; } = true;
|
||||
public String PageCaption { get; set; }
|
||||
public String InstanceVersion { get { return !StringUtil.IsEmpty(App.SessionConfig.Instance) ? App.SessionConfig.Instance + " v" + Sax.Version.GetFullVersion() : "v" + Sax.Version.GetAppVersion(); } }
|
||||
public bool IncludeGoogleAnalytics { get; set; } = false;
|
||||
// Common data components.
|
||||
// User Accounts.
|
||||
public SaxUserAccount GetUserAccount(SysId userAccountId)
|
||||
{
|
||||
return Internals.GetUserAccount(userAccountId);
|
||||
}
|
||||
public String GetUserAccountDisplayName(SysId userAccountId)
|
||||
{
|
||||
return Internals.GetUserAccountDisplayName(userAccountId);
|
||||
}
|
||||
// User Accounts.
|
||||
public SaxOrganisation GetOrganisation(SysId organisationId)
|
||||
{
|
||||
return Internals.GetOrganisation(organisationId);
|
||||
}
|
||||
public String GetOrganisationName(SysId organisationId)
|
||||
{
|
||||
return Internals.GetOrganisationName(organisationId);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security.
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Sport.
|
||||
public long SportId { get; set; }
|
||||
public String SportName { get; set; }
|
||||
// Region.
|
||||
public long RegionId { get; set; }
|
||||
public String RegionName { get; set; }
|
||||
// Region - country.
|
||||
public long RegionIdCountry { get; set; }
|
||||
public String RegionNameCountry { get; set; }
|
||||
// Common properties.
|
||||
public String StatusCode { get; set; }
|
||||
public String StatusDesc { get; set; }
|
||||
@@ -57,9 +57,9 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
using (SaxSport sport = ReferenceMgr.GetSportById(organisation.SportIdPrimary))
|
||||
data.SportName = sport?.Name ?? "";
|
||||
// Region.
|
||||
data.RegionId = SysId.ToLong(organisation.RegionIdPrimary);
|
||||
data.RegionIdCountry = SysId.ToLong(organisation.RegionIdPrimary);
|
||||
using (SaxRegion region = ReferenceMgr.GetRegionById(organisation.RegionIdPrimary))
|
||||
data.RegionName = region?.Name ?? "";
|
||||
data.RegionNameCountry = region?.Name ?? "";
|
||||
// Common properties.
|
||||
data.StatusCode = organisation.StatusCode;
|
||||
data.StatusDesc = organisation.StatusDesc;
|
||||
@@ -154,8 +154,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
MemberCount = StringUtil.ToLong(values.GetString(colMemberCount.DataName)),
|
||||
SportId = values.GetLong(colSportId.DataName),
|
||||
SportName = values.GetString(colSportName.DataName),
|
||||
RegionId = values.GetLong(colRegionId.DataName),
|
||||
RegionName = values.GetString(colRegionName.DataName),
|
||||
RegionIdCountry = values.GetLong(colRegionId.DataName),
|
||||
RegionNameCountry = values.GetString(colRegionName.DataName),
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||
};
|
||||
@@ -257,8 +257,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
organisation.OrganisationCategory = model.OrganisationCategory;
|
||||
if (model.OrganisationSportId != null)
|
||||
organisation.SportIdPrimary = model.OrganisationSportId.ToSysId();
|
||||
if (model.OrganisationRegionId != null)
|
||||
organisation.RegionIdPrimary = model.OrganisationRegionId.ToSysId();
|
||||
if (model.OrganisationRegionIdCountry != null)
|
||||
organisation.RegionIdPrimary = model.OrganisationRegionIdCountry.ToSysId();
|
||||
// Common properties.
|
||||
if (model.OrganisationStatusCode != null)
|
||||
organisation.Status = model.OrganisationStatus;
|
||||
|
||||
@@ -53,12 +53,20 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
public String OrganisationCategoryValue { get; set; }
|
||||
public Sax.OrganisationCategory OrganisationCategory { get { return (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(OrganisationCategoryValue); } }
|
||||
public String OrganisationSportId { get; set; }
|
||||
public String OrganisationRegionId { get; set; }
|
||||
public String OrganisationRegionIdCountry { get; set; }
|
||||
// Common properties.
|
||||
public String OrganisationNotes { get; set; }
|
||||
public String OrganisationStatusCode { get; set; }
|
||||
public SaStatus OrganisationStatus { get { return SacsSystem.GetStatusForCode(OrganisationStatusCode); } }
|
||||
|
||||
// Utilities.
|
||||
public bool IsSportMandatory()
|
||||
{
|
||||
if (OrganisationCategory == Sax.OrganisationCategory.Club) return true;
|
||||
if (OrganisationCategory == Sax.OrganisationCategory.Association) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validation.
|
||||
//-------------------------------------------------------------------
|
||||
@@ -89,6 +97,44 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
responseData.SetControlError(nameof(OrganisationCategoryValue), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
// Organisation sport.
|
||||
if (OrganisationSportId != null)
|
||||
{
|
||||
if (SysId.IsValid(OrganisationSportId.ToSysId()) || IsSportMandatory())
|
||||
{
|
||||
using (SaxSport sport = ReferenceMgr.GetSportById(OrganisationSportId.ToSysId()))
|
||||
{
|
||||
if (sport == null)
|
||||
responseData.SetControlError(nameof(OrganisationSportId), Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Organisation country.
|
||||
if (OrganisationRegionIdCountry != null)
|
||||
{
|
||||
using (SaxRegion region = ReferenceMgr.GetRegionById(OrganisationRegionIdCountry.ToSysId()))
|
||||
{
|
||||
if (region == null)
|
||||
responseData.SetControlError(nameof(OrganisationRegionIdCountry), Localiser["msg.validation.invalid.value"]);
|
||||
else if (region.RegionType != Sax.RegionType.Country)
|
||||
responseData.SetControlError(nameof(OrganisationRegionIdCountry), "Organisation region must be a country");
|
||||
}
|
||||
|
||||
if (!StringUtil.IsEmpty(OrganisationName))
|
||||
{
|
||||
// Name must be unqiue within region.
|
||||
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||
if (SysId.IsValid(OrganisationId.ToSysId()))
|
||||
prmOrganisation.IdsExcluded.Add(OrganisationId.ToSysId());
|
||||
prmOrganisation.NameFull = OrganisationName;
|
||||
prmOrganisation.RegionIdsIncluded.Add(OrganisationRegionIdCountry.ToSysId());
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.Any;
|
||||
if (AccountMgr.GetOrganisationCount(prmOrganisation) > 0)
|
||||
responseData.SetControlError(nameof(OrganisationName), Localiser["msg.validation.duplicate.value"]);
|
||||
}
|
||||
}
|
||||
|
||||
// Organisation status.
|
||||
if (OrganisationStatusCode != null)
|
||||
{
|
||||
|
||||
@@ -90,8 +90,6 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
// User title.
|
||||
if (UserTitle != null)
|
||||
{
|
||||
if (StringUtil.IsEmpty(UserTitle))
|
||||
responseData.SetControlError(nameof(UserTitle), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
// User first name.
|
||||
|
||||
@@ -165,6 +165,12 @@
|
||||
<data name="label.columns" xml:space="preserve">
|
||||
<value>Columns</value>
|
||||
</data>
|
||||
<data name="label.country" xml:space="preserve">
|
||||
<value>Country</value>
|
||||
</data>
|
||||
<data name="label.county" xml:space="preserve">
|
||||
<value>County</value>
|
||||
</data>
|
||||
<data name="label.create" xml:space="preserve">
|
||||
<value>Create</value>
|
||||
</data>
|
||||
@@ -231,6 +237,9 @@
|
||||
<data name="label.no" xml:space="preserve">
|
||||
<value>No</value>
|
||||
</data>
|
||||
<data name="label.not.specified" xml:space="preserve">
|
||||
<value>Not specified</value>
|
||||
</data>
|
||||
<data name="label.ok" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
@@ -252,6 +261,9 @@
|
||||
<data name="label.previous" xml:space="preserve">
|
||||
<value>Previous</value>
|
||||
</data>
|
||||
<data name="label.province" xml:space="preserve">
|
||||
<value>Province</value>
|
||||
</data>
|
||||
<data name="label.reference" xml:space="preserve">
|
||||
<value>Reference</value>
|
||||
</data>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
@* Organisation sport *@
|
||||
<div class="sax-form-control OrganisationSportId">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationSportId"><span><span class="required">*</span> @Localiser["label.sport"]</span></label>
|
||||
<label for="ifOrganisationSportCaption"><span><span class="required">*</span> @Localiser["label.sport"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
@Html.HiddenFor(model => model.OrganisationSportId, new { @id = "ifOrganisationSportId", @class = "OrganisationSportId" })
|
||||
@@ -67,13 +67,13 @@
|
||||
</div>
|
||||
|
||||
@* Organisation region *@
|
||||
<div class="sax-form-control OrganisationRegionId">
|
||||
<div class="sax-form-control OrganisationRegionIdCountry">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationRegionId"><span><span class="required">*</span> @Localiser["label.region"]</span></label>
|
||||
<label for="ifOrganisationRegionCaptionCountry"><span><span class="required">*</span> @Localiser["label.country"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
@Html.HiddenFor(model => model.OrganisationRegionId, new { @id = "ifOrganisationRegionId", @class = "OrganisationRegionId" })
|
||||
<div class="col"><input type="text" id="ifOrganisationRegionCaption" class="OrganisationRegionCaption sax-input" readonly="readonly" ondblclick="sax.selectRegion()" /> </div>
|
||||
@Html.HiddenFor(model => model.OrganisationRegionIdCountry, new { @id = "ifOrganisationRegionIdCountry", @class = "OrganisationRegionIdCountry" })
|
||||
<div class="col"><input type="text" id="ifOrganisationRegionCaptionCountry" class="OrganisationRegionCaptionCountry sax-input" readonly="readonly" ondblclick="sax.selectRegion()" /> </div>
|
||||
<div class="fixed"><button id="pbSelectRegion" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectRegion()">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<label for="cbUserTitle"><span><span class="required"></span> @Localiser["label.title"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.DropDownListFor(model => model.UserTitle, Model.TitlesForSelect, Localiser["label.select"], new { @id = "cbUserTitle", @class = "UserTitle sax-select" })
|
||||
@Html.DropDownListFor(model => model.UserTitle, Model.TitlesForSelect, Localiser["label.not.specified"], new { @id = "cbUserTitle", @class = "UserTitle sax-select" })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
let $frm = sax.$frm.organisation;
|
||||
$('.OrganisationSportId', $frm).val(rgn.id);
|
||||
$('.OrganisationSportCaption', $frm).val(rgn.name);
|
||||
sax.clearControlError($('.OrganisationSportCaption', $frm));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -115,15 +116,16 @@
|
||||
{
|
||||
//sax.debug('onRegionSelected', rgn);
|
||||
let $frm = sax.$frm.organisation;
|
||||
$('.OrganisationRegionId', $frm).val(rgn.id);
|
||||
$('.OrganisationRegionCaption', $frm).val(rgn.name);
|
||||
$('.OrganisationRegionIdCountry', $frm).val(rgn.id);
|
||||
$('.OrganisationRegionCaptionCountry', $frm).val(rgn.name);
|
||||
sax.clearControlError($('.OrganisationRegionCaptionCountry', $frm));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.createItem = function ()
|
||||
{
|
||||
let $frm = sax.$frm.organisation;
|
||||
$('.OrganisationId,.OrganisationSportId,.OrganisationRegionId,input[type="text"],textarea,select', $frm).val('');
|
||||
$('.OrganisationId,.OrganisationSportId,.OrganisationRegionIdCountry,input[type="text"],textarea,select', $frm).val('');
|
||||
$('.OrganisationStatus', $frm).val(sax.data.defaultStatusCode);
|
||||
sax.clearControlErrors();
|
||||
sax.$dlg.organisation.dialog('option', 'title', sax.dlg.title.createOrganisation);
|
||||
@@ -154,8 +156,8 @@
|
||||
$('.OrganisationCategory', $frm).val(item.categoryCode);
|
||||
$('.OrganisationSportId', $frm).val(item.sportId);
|
||||
$('.OrganisationSportCaption', $frm).val(item.sportName);
|
||||
$('.OrganisationRegionId', $frm).val(item.regionId);
|
||||
$('.OrganisationRegionCaption', $frm).val(item.regionName);
|
||||
$('.OrganisationRegionIdCountry', $frm).val(item.regionIdCountry);
|
||||
$('.OrganisationRegionCaptionCountry', $frm).val(item.regionNameCountry);
|
||||
$('.OrganisationStatus', $frm).val(item.statusCode);
|
||||
sax.clearControlErrors();
|
||||
sax.$dlg.organisation.dialog('option', 'title', sax.dlg.title.updateOrganisation);
|
||||
@@ -206,6 +208,7 @@
|
||||
$('.sax-panel-filter .sax-action.sax-item-create').on('click', function () { sax.createItem(); });
|
||||
$('.sax-panel-filter .sax-action.sax-results-refresh').on('click', function () { sax.refreshResults(); });
|
||||
$('.sax-input').on('input', function () { sax.clearControlError(this); });
|
||||
$('.sax-select').on('change', function () { sax.clearControlError(this); });
|
||||
|
||||
sax.$frm.filter = $('#frmOrganisationFilter');
|
||||
$('.FilterOrganisation', sax.$frm.filter).on('input', function () { sax.refreshResults(250); });
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
<data name="label.article" xml:space="preserve">
|
||||
<value>Article</value>
|
||||
</data>
|
||||
<data name="label.Calendar" xml:space="preserve">
|
||||
<data name="label.calendar" xml:space="preserve">
|
||||
<value>Calendar</value>
|
||||
</data>
|
||||
<data name="label.cancel" xml:space="preserve">
|
||||
@@ -462,12 +462,15 @@
|
||||
<data name="organisation.caption.opportunity.update" xml:space="preserve">
|
||||
<value>Update Opportunity</value>
|
||||
</data>
|
||||
<data name="organisation.caption.organisation.request" xml:space="preserve">
|
||||
<value>Request Organisation</value>
|
||||
</data>
|
||||
<data name="organisation.caption.organisation.select" xml:space="preserve">
|
||||
<value>Select Organisation</value>
|
||||
</data>
|
||||
<data name="organisation.caption.organisations" xml:space="preserve">
|
||||
<value>Organisations</value>
|
||||
</data>
|
||||
<data name="organisation.caption.select.organisation" xml:space="preserve">
|
||||
<value>Select Organisation</value>
|
||||
</data>
|
||||
<data name="policies.caption.privacy" xml:space="preserve">
|
||||
<value>Privacy</value>
|
||||
</data>
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public short ItemType { get; set; }
|
||||
public String ItemTypeClass { get; set; }
|
||||
public long ItemIdx { get; set; }
|
||||
public String Organisation { get; set; }
|
||||
public String Author { get; set; }
|
||||
public String Caption { get; set; }
|
||||
public String Blurb { get; set; }
|
||||
public String Sport { get; set; }
|
||||
@@ -49,6 +51,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
public ActivityResponseData_Article(SaxController_Online controller, SaxModel_Online model, SaxJournalistArticle article)
|
||||
{
|
||||
Author = model.GetUserAccountDisplayName(article.UserAccountIdJournalist);
|
||||
Headline = article.Headline;
|
||||
Summary = article.Summary;
|
||||
Sport = model.GetSportCaption(article.SportIdPrimary);
|
||||
@@ -58,6 +61,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
foreach (SaxJournalistArticle.ContentData.SegmentData segment in content.Segments)
|
||||
Content.Segments.Add(new ContentData.SegmentData(controller, segment));
|
||||
}
|
||||
public String Organisation { get; set; }
|
||||
public String Author { get; set; }
|
||||
public String Headline { get; set; }
|
||||
public String Summary { get; set; }
|
||||
public String Sport { get; set; }
|
||||
@@ -100,12 +105,15 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
public ActivityResponseData_Opportunity(SaxModel_Online model, SaxOrganisationOpportunity opportunity)
|
||||
{
|
||||
Organisation = model.GetOrganisationName(opportunity.OrganisationId);
|
||||
Position = opportunity.Position;
|
||||
Outline = opportunity.Outline;
|
||||
Sport = model.GetSportCaption(opportunity.SportIdPrimary);
|
||||
Region = model.GetRegionCaption(opportunity.RegionIdPrimary);
|
||||
PublishedOnFmt = model.Localiser.FormatDate(opportunity.PublishedAt);
|
||||
}
|
||||
public String Organisation { get; set; }
|
||||
public String Author { get; set; }
|
||||
public String Position { get; set; }
|
||||
public String Outline { get; set; }
|
||||
public String Sport { get; set; }
|
||||
|
||||
@@ -26,38 +26,6 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
base(localiser, logger)
|
||||
{}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Regions
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_RegionList : AjaxResponse_Base
|
||||
{
|
||||
public List<SaxModel_Online.RegionData> Regions { get; } = new List<SaxModel_Online.RegionData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Reference/Ajax/GetRegions")]
|
||||
public IActionResult Ajax_GetRegionList(Model_Reference model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetRegionList";
|
||||
String messageTitle = Localiser["reference.caption.regions"];
|
||||
AjaxResponse_RegionList responseData = new AjaxResponse_RegionList();
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Populate regions.
|
||||
foreach (SaxModel_Online.RegionData regionData in model.GetRegionDataList_Active())
|
||||
responseData.Regions.Add(regionData);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Sports
|
||||
//-------------------------------------------------------------------
|
||||
@@ -77,8 +45,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
// User doesn't have to be logged in, eg. to register organisation.
|
||||
//if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Populate sports.
|
||||
foreach (SaxModel_Online.SportData sportData in model.GetSportDataList_Active())
|
||||
@@ -90,6 +58,38 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Regions
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_RegionList : AjaxResponse_Base
|
||||
{
|
||||
public List<SaxModel_Online.RegionData> Regions { get; } = new List<SaxModel_Online.RegionData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Reference/Ajax/GetRegions")]
|
||||
public IActionResult Ajax_GetRegionList(Model_Reference model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetRegionList";
|
||||
String messageTitle = Localiser["reference.caption.regions"];
|
||||
AjaxResponse_RegionList responseData = new AjaxResponse_RegionList();
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
// User doesn't have to be logged in, eg. to register organisation.
|
||||
//if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Populate regions.
|
||||
foreach (SaxModel_Online.RegionData regionData in model.GetRegionDataList_Active())
|
||||
responseData.Regions.Add(regionData);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -5,6 +5,7 @@ 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.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -37,6 +38,13 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation properties.
|
||||
public String OrganisationName { get; set; }
|
||||
public String OrganisationTypeValue { get; set; }
|
||||
public Sax.OrganisationType OrganisationType { get { return (Sax.OrganisationType)OrganisationTypeCodes.GetTypeForCode(OrganisationTypeValue); } }
|
||||
public String OrganisationCategoryValue { get; set; }
|
||||
public Sax.OrganisationCategory OrganisationCategory { get { return (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(OrganisationCategoryValue); } }
|
||||
public String OrganisationSportId { get; set; }
|
||||
public String OrganisationRegionId { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validation.
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
sax.dlg.title.selectRegion = '@Localiser.GetJavascriptText("reference.caption.region.select")';
|
||||
sax.dlg.title.selectSport = '@Localiser.GetJavascriptText("reference.caption.sport.select")';
|
||||
</script>
|
||||
<partial name="~/Views/Common/SelectRegion.cshtml" />
|
||||
<partial name="~/Views/Common/SelectSport.cshtml" />
|
||||
<partial name="~/Views/Common/RegionSelect.cshtml" />
|
||||
<partial name="~/Views/Common/SportSelect.cshtml" />
|
||||
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
@model SaxModel_Online
|
||||
@inject SaxLocaliser Localiser
|
||||
|
||||
<script type="text/javascript">
|
||||
sax.orgReq = {};
|
||||
sax.orgReq.dlgTitleRequestOrganisation = '@Localiser.GetJavascriptText("organisation.caption.organisation.request")';
|
||||
</script>
|
||||
|
||||
<div id="dlgOrganisationRequest" class="sax-dialog sax-form">
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOrganisationRequest", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
|
||||
@* Organisation name *@
|
||||
<div class="sax-form-control OrganisationName">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationName"><span><span class="required">*</span> @Localiser["label.name"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
<input type="text" id="ifOrganisationName" name="OrganisationName" class="OrganisationName sax-input" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name)" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation type *@
|
||||
<div class="sax-form-control OrganisationType">
|
||||
<div class="sax-label">
|
||||
<label for="cbOrganisationType"><span><span class="required">*</span> @Localiser["label.type"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.DropDownList("", Model.OrganisationTypesForSelect, Localiser["label.select"], new { @id = "cbOrganisationType", @name = "OrganisationTypeValue", @class = "OrganisationType sax-select" })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation category *@
|
||||
<div class="sax-form-control OrganisationCategory">
|
||||
<div class="sax-label">
|
||||
<label for="cbOrganisationCategory"><span><span class="required">*</span> @Localiser["label.category"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.DropDownList("", Model.OrganisationCategoriesForSelect, Localiser["label.select"], new { @id = "cbOrganisationCategory", @name = "OrganisationCategoryValue", @class = "OrganisationCategory sax-select" })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation sport *@
|
||||
<div class="sax-form-control OrganisationSportId">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationSportId"><span><span class="required">*</span> @Localiser["label.sport"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
<input type="hidden" id="ifOrganisationSportId" name="" OrganisationSportId"" class="OrganisationSportId" />
|
||||
<div class="col"><input type="text" id="ifOrganisationSportCaption" class="OrganisationSportCaption sax-input" readonly="readonly" ondblclick="sax.selectSport()" /> </div>
|
||||
<div class="fixed"><button id="pbSelectSport" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectOrgSport()">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation region *@
|
||||
<div class="sax-form-control OrganisationRegionId">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationRegionId"><span><span class="required">*</span> @Localiser["label.region"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
<input type="hidden" id="ifOrganisationRegionId" name="" OrganisationRegionId"" class="OrganisationRegionId" />
|
||||
<div class="col"><input type="text" id="ifOrganisationRegionCaption" class="OrganisationRegionCaption sax-input" readonly="readonly" ondblclick="sax.selectRegion()" /> </div>
|
||||
<div class="fixed"><button id="pbSelectRegion" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectOrgRegion()">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
<script src="~/js/sax-org-req.js?@Model.HrefVersion"></script>
|
||||
<partial name="~/Views/Common/SportSelect.cshtml" />
|
||||
<partial name="~/Views/Common/RegionSelect.cshtml" />
|
||||
+5
-3
@@ -1,10 +1,10 @@
|
||||
@model SaxModel_Online
|
||||
@inject SaxLocaliser Localiser
|
||||
|
||||
<link rel="stylesheet" href="~/css/sax-selectOrganisation.css?@Model.HrefVersion" />
|
||||
<script src="~/js/sax-selectOrganisation.js?@Model.HrefVersion"></script>
|
||||
<link rel="stylesheet" href="~/css/sax-org-sel.css?@Model.HrefVersion" />
|
||||
<script type="text/javascript">
|
||||
sax.selectOrganisation.dlgTitleSelectOrganisation = '@Localiser.GetJavascriptText("organisation.caption.select.organisation")';
|
||||
sax.selectOrganisation = {};
|
||||
sax.selectOrganisation.dlgTitleSelectOrganisation = '@Localiser.GetJavascriptText("organisation.caption.organisation.select")';
|
||||
</script>
|
||||
|
||||
<div id="dlgSelectOrganisation" class="sax-dialog sax-form">
|
||||
@@ -44,3 +44,5 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="~/js/sax-org-sel.js?@Model.HrefVersion"></script>
|
||||
+6
-3
@@ -1,7 +1,10 @@
|
||||
@model SaxModel_Online
|
||||
@inject SaxLocaliser Localiser
|
||||
|
||||
<link rel="stylesheet" href="~/css/sax-selectRegion.css?@Model.HrefVersion" />
|
||||
<link rel="stylesheet" href="~/css/sax-reg-sel.css?@Model.HrefVersion" />
|
||||
<script type="text/javascript">
|
||||
sax.data.selectRegion = {};
|
||||
</script>
|
||||
|
||||
<div id="dlgSelectRegion" class="sax-dialog sax-form">
|
||||
|
||||
@@ -44,6 +47,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="~/js/sax-selectRegion.js?@Model.HrefVersion"></script>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="~/js/sax-reg-sel.js?@Model.HrefVersion"></script>
|
||||
+11
-8
@@ -1,7 +1,10 @@
|
||||
@model SaxModel_Online
|
||||
@inject SaxLocaliser Localiser
|
||||
|
||||
<link rel="stylesheet" href="~/css/sax-selectSport.css?@Model.HrefVersion" />
|
||||
<link rel="stylesheet" href="~/css/sax-spt-sel.css?@Model.HrefVersion" />
|
||||
<script type="text/javascript">
|
||||
sax.data.selectSport = {};
|
||||
</script>
|
||||
|
||||
<div id="dlgSelectSport" class="sax-dialog sax-form">
|
||||
|
||||
@@ -38,12 +41,12 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-item-template">
|
||||
<div class="sax-panel-item Sport">
|
||||
<div class="SportName"></div>
|
||||
</div>
|
||||
<div class="sax-panel-item-template">
|
||||
<div class="sax-panel-item Sport">
|
||||
<div class="SportName"></div>
|
||||
</div>
|
||||
|
||||
<script src="~/js/sax-selectSport.js?@Model.HrefVersion"></script>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="~/js/sax-spt-sel.js?@Model.HrefVersion"></script>
|
||||
@@ -6,12 +6,30 @@
|
||||
|
||||
@if (Model.AwaitingLogin)
|
||||
{
|
||||
@* No user session *@
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">@Localiser["home.caption.welcome"]</h1>
|
||||
</div>
|
||||
<div class="spacer8"></div>
|
||||
|
||||
@* Register Organisation *@
|
||||
@if (false)
|
||||
{
|
||||
<div class="sax-panel-info">
|
||||
<div class="sax-content">
|
||||
<div class="sax-para">Do you belong to a club or association that would benefit from participating on this platform?</div>
|
||||
<div class="sax-para">Sign-up now with a few details and we'll let you know when you can login and get going.</div>
|
||||
<div class="sax-para center"><div class="sax-button-cta" onclick="sax.orgReq.fn.requestOrganisation()">Register Your Organisation</div></div>
|
||||
</div>
|
||||
</div>
|
||||
<partial name="~/Views/Common/OrganisationRequest.cshtml" />
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@* User logged in *@
|
||||
|
||||
@* Activity filter *@
|
||||
<div class="sax-panel-filter">
|
||||
<div class="sax-header row">
|
||||
<div class="col"><div class="sax-caption">@Localiser["home.caption.activities"]</div></div>
|
||||
@@ -29,6 +47,7 @@ else
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Activities *@
|
||||
<div class="sax-panel-results">
|
||||
<div class="sax-panel-messages"></div>
|
||||
<div class="sax-panel-item-list"></div>
|
||||
@@ -79,6 +98,7 @@ else
|
||||
<div class="sax-panel-item Article">
|
||||
<div class="ArticleHeadline"></div>
|
||||
<div class="ArticleSummary"></div>
|
||||
<div class="ArticleAuthor"></div>
|
||||
<div class="ArticleContent">
|
||||
<div class="ArticleContentSegments"></div>
|
||||
</div>
|
||||
|
||||
@@ -74,21 +74,21 @@
|
||||
</div>
|
||||
|
||||
@* Publication *@
|
||||
<div class="sax-form-control ArticlePublication">
|
||||
<div class="sax-label">
|
||||
<label for="ifArticleRegionId"><span>@Localiser["label.publication"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
<div class="row ArticlePublish">
|
||||
<div class="fixed"><div class="pl16 pt4 pr8">@Html.CheckBoxFor(model => model.ArticlePublish, new { @id = "chkArticlePublish", @class = "ArticlePublish" }) <span class="" onclick="$('#chkArticlePublish').click()">@Localiser["label.publish"]</span></div></div>
|
||||
<div class="col">@Html.TextBoxFor(model => model.ArticlePublishOn, new { @id = "ifArticlePublishOn", @class = "sax-input sax-calendar ArticlePublishOn", @readonly = "readonly" })</div>
|
||||
<div class="sax-form-control ArticlePublication">
|
||||
<div class="sax-label">
|
||||
<label for="ifArticleRegionId"><span>@Localiser["label.publication"]</span></label>
|
||||
</div>
|
||||
<div class="row ArticlePublished">
|
||||
<div class="col"><div class="pl16">@Localiser["label.published"]: <span class="ArticlePublishedOn"></span></div></div>
|
||||
<div class="sax-control">
|
||||
<div class="row ArticlePublish">
|
||||
<div class="fixed"><div class="pl16 pt4 pr8">@Html.CheckBoxFor(model => model.ArticlePublish, new { @id = "chkArticlePublish", @class = "ArticlePublish" }) <span class="" onclick="$('#chkArticlePublish').click()">@Localiser["label.publish"]</span></div></div>
|
||||
<div class="col">@Html.TextBoxFor(model => model.ArticlePublishOn, new { @id = "ifArticlePublishOn", @class = "sax-input sax-calendar ArticlePublishOn", @readonly = "readonly" })</div>
|
||||
</div>
|
||||
<div class="row ArticlePublished">
|
||||
<div class="col"><div class="pl16">@Localiser["label.published"]: <span class="ArticlePublishedOn"></span></div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
sax.msg.uploadFileTypeInvalid = '@Localiser.GetJavascriptText("msg.upload.file.type.invalid","{0}")';
|
||||
sax.msg.uploadingFile = '@Localiser.GetJavascriptText("msg.upload.file.uploading","{0}")';
|
||||
</script>
|
||||
<partial name="~/Views/Common/SelectRegion.cshtml" />
|
||||
<partial name="~/Views/Common/SelectSport.cshtml" />
|
||||
<partial name="~/Views/Common/SportSelect.cshtml" />
|
||||
<partial name="~/Views/Common/RegionSelect.cshtml" />
|
||||
|
||||
</div>
|
||||
|
||||
@@ -65,5 +65,5 @@
|
||||
</div>
|
||||
|
||||
<partial name="Panel-OpportunityDialog.cshtml" />
|
||||
<partial name="~/Views/Common/SelectOrganisation.cshtml" />
|
||||
<partial name="~/Views/Common/OrganisationSelect.cshtml" />
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
}
|
||||
|
||||
<partial name="~/Views/Common/SelectRegion.cshtml" />
|
||||
<partial name="~/Views/Common/SelectSport.cshtml" />
|
||||
<partial name="~/Views/Common/RegionSelect.cshtml" />
|
||||
<partial name="~/Views/Common/SportSelect.cshtml" />
|
||||
|
||||
</div>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
sax.links.facebook = '@Model.Links.Facebook';
|
||||
sax.links.linkedin = '@Model.Links.LinkedIn';
|
||||
sax.form.calendarDateFormat = '@(Model.CalendarDateFormat)';
|
||||
sax.lbl.calendar='@Localiser.GetJavascriptText("label.Calendar")';
|
||||
sax.lbl.calendar='@Localiser.GetJavascriptText("label.calendar")';
|
||||
sax.dlg.title.alert = '@Localiser.GetJavascriptText("dialog.title.alert")';
|
||||
sax.dlg.title.confirm = '@Localiser.GetJavascriptText("dialog.title.confirm")';
|
||||
sax.dlg.title.progress = '@Localiser.GetJavascriptText("dialog.title.progress")';
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
{
|
||||
margin: 2px 1px 0 1px;
|
||||
background-color: #a0a0a0;
|
||||
opacity:0.8;
|
||||
opacity: 0.8;
|
||||
box-shadow: 0 0 0 1px #40404080 inset;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,36 +47,46 @@
|
||||
#dlgActivity .sax-panel-item.Article .ArticleHeadline,
|
||||
#dlgActivity .sax-panel-item.Opportunity .OpportunityOrganisation
|
||||
{
|
||||
margin: 0 0 8px 0;
|
||||
padding: 0 0 8px 0;
|
||||
margin: 0;
|
||||
padding: 8px 8px;
|
||||
font-size: 2rem;
|
||||
font-weight: bold;
|
||||
border-bottom: 1px solid #b0b0b0;
|
||||
}
|
||||
|
||||
#dlgActivity .sax-panel-item.Article .ArticleSummary,
|
||||
#dlgActivity .sax-panel-item.Article .ArticleAuthor,
|
||||
#dlgActivity .sax-panel-item.Opportunity .OpportunityOrganisation,
|
||||
#dlgActivity .sax-panel-item.Opportunity .OpportunityPosition,
|
||||
#dlgActivity .sax-panel-item.Opportunity .OpportunityOutline
|
||||
{
|
||||
margin: 0 0 8px 0;
|
||||
padding: 0 0 8px 0;
|
||||
margin: 0;
|
||||
padding: 8px 8px;
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
border-bottom: 1px solid #b0b0b0;
|
||||
}
|
||||
|
||||
#dlgActivity .sax-panel-item.Article .ArticleAuthor
|
||||
{
|
||||
padding: 4px 8px;
|
||||
font-size: .9rem;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
#dlgActivity .sax-panel-item.Opportunity
|
||||
{
|
||||
}
|
||||
|
||||
#dlgActivity .sax-panel-item.Article .ArticleContentSegment
|
||||
{
|
||||
margin:4px 0;
|
||||
}
|
||||
|
||||
#dlgActivity .sax-panel-item.Article .ArticleContentSegmentImage img
|
||||
{
|
||||
max-width:75%;
|
||||
max-height:400px;
|
||||
max-width: 75%;
|
||||
max-height: 400px;
|
||||
}
|
||||
|
||||
.ui-dialog.sax-dialog-activity button.ActivityReaction
|
||||
|
||||
@@ -113,6 +113,13 @@ button.accept-policy
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
/* Information */
|
||||
|
||||
.sax-para
|
||||
{
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
|
||||
a, a:hover
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
let $segs = $('.ArticleContentSegments', $itm);
|
||||
$('.ArticleHeadline', $itm).text(item.headline);
|
||||
$('.ArticleSummary', $itm).text(item.summary).toggle(!!item.summary);
|
||||
$('.ArticleAuthor', $itm).text(item.author).toggle(!!item.author);
|
||||
let segs = item.content.segments;
|
||||
for (let segIdx = 0; segIdx < segs.length; segIdx++)
|
||||
{
|
||||
|
||||
@@ -311,7 +311,7 @@
|
||||
}
|
||||
sax.onUpdateItem = function (response)
|
||||
{
|
||||
sax.debug('onUpdateItem', response);
|
||||
//sax.debug('onUpdateItem', response);
|
||||
sax.clearItem();
|
||||
if (!response.success) return;
|
||||
let $frm = sax.$frm.article;
|
||||
@@ -347,17 +347,6 @@
|
||||
$('.sax-article').removeClass('ArticleHeader').addClass('ArticleContent');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectRegion = function ()
|
||||
{
|
||||
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('#ifArticleRegionId').val(), fnCallback: sax.onSelectRegion })
|
||||
}
|
||||
sax.onSelectRegion = function (region)
|
||||
{
|
||||
sax.clearControlError($('#ifArticleRegionId').val(region.id));
|
||||
$('#ifArticleRegionCaption').val(region ? region.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectSport = function ()
|
||||
{
|
||||
@@ -369,6 +358,17 @@
|
||||
$('#ifArticleSportCaption').val(sport ? sport.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectRegion = function ()
|
||||
{
|
||||
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('#ifArticleRegionId').val(), fnCallback: sax.onSelectRegion })
|
||||
}
|
||||
sax.onSelectRegion = function (region)
|
||||
{
|
||||
sax.clearControlError($('#ifArticleRegionId').val(region.id));
|
||||
$('#ifArticleRegionCaption').val(region ? region.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.storeItem = function ()
|
||||
{
|
||||
@@ -377,7 +377,7 @@
|
||||
}
|
||||
sax.onStoreItem = function (response)
|
||||
{
|
||||
sax.debug('onStoreItem', response);
|
||||
//sax.debug('onStoreItem', response);
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
if (!response.success) return;
|
||||
sax.$dlg.article.dialog('close');
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Organisation Request.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let or = sax.orgReq;
|
||||
or.fn = {}; or.ajax = {};
|
||||
|
||||
//--------------------------------------------------------------
|
||||
or.fn.requestOrganisation = function ()
|
||||
{
|
||||
or.fn.init();
|
||||
sax.openDialog(or.$dlg, 640, 760);
|
||||
}
|
||||
or.fn.storeOrganisation = function ()
|
||||
{
|
||||
//sax.debug('refreshResults');
|
||||
or.ajax.registerOrg = or.ajax.registerOrg || { url: sax.url.base + 'Organisation/Ajax/requestOrganisation', formId: 'frmOrganisationRequest', callbackFn: or.fn.handleRequestOrganisationResponse };
|
||||
sax.doAjaxRequest(or.ajax.registerOrg, 50);
|
||||
}
|
||||
or.fn.handleRequestOrganisationResponse = function (response)
|
||||
{
|
||||
sax.debug('or.handleRequestOrganisationResponse', response);
|
||||
if (!response.success) return;
|
||||
|
||||
}
|
||||
or.fn.cleanUp = function ()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectOrgSport = function ()
|
||||
{
|
||||
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('.OrganisationSportId', or.$frm).val(), fnCallback: sax.onSelectOrgSport })
|
||||
}
|
||||
sax.onSelectOrgSport = function (sport)
|
||||
{
|
||||
sax.clearControlError($('.OrganisationSportId', or.$frm).val(sport.id));
|
||||
$('.OrganisationSportCaption', or.$frm).val(sport ? sport.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectOrgRegion = function ()
|
||||
{
|
||||
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.OrganisationRegionId', or.$frm).val(), typesInc:[30], fnCallback: sax.onSelectOrgRegion })
|
||||
}
|
||||
sax.onSelectOrgRegion = function (region)
|
||||
{
|
||||
sax.clearControlError($('.OrganisationRegionId', or.$frm).val(region.id));
|
||||
$('.OrganisationRegionCaption', or.$frm).val(region ? region.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
or.fn.init = function ()
|
||||
{
|
||||
if (or.$dlg) return;
|
||||
var opt = sax.dlgOpts();
|
||||
opt.title = sax.orgReq.dlgTitleRequestOrganisation;
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { or.fn.storeOrganisation(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { or.fn.cleanUp(); $(this).dialog('close'); };
|
||||
or.$dlg = $('#dlgOrganisationRequest').dialog(opt);
|
||||
or.$frm = $('#frmOrganisationRequest', or.$dlg);
|
||||
}
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
+5
-3
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Admin - User page scripts.
|
||||
* Organisation selection.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let so = sax.selectOrganisation = sax.selectOrganisation || { data: {}, fn: {}, $dlg: {}, itemIdPrefix: 'Org_' };
|
||||
let so = sax.selectOrganisation;
|
||||
so.data = {}; so.fn = {}; so.itemIdPrefix = 'Org_';
|
||||
|
||||
//--------------------------------------------------------------
|
||||
/*
|
||||
@@ -92,6 +93,7 @@
|
||||
so.fn.cleanUp = function ()
|
||||
{
|
||||
//sax.debug('confirmSelection', so.data.item);
|
||||
$('.sax-input.FilterOrganisation', so.$filter).val('');
|
||||
so.$results.empty();
|
||||
delete so.cfg;
|
||||
delete so.data.item;
|
||||
@@ -101,7 +103,7 @@
|
||||
//--------------------------------------------------------------
|
||||
so.fn.init = function ()
|
||||
{
|
||||
if (!so.$dlg) return;
|
||||
if (so.$dlg) return;
|
||||
var opt = sax.dlgOpts();
|
||||
opt.open = function () { so.fn.refreshResults(200); };
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { so.fn.confirmSelection(); };
|
||||
+12
-4
@@ -5,13 +5,16 @@
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let sr = sax.data.selectRegion = sax.data.selectRegion || { regions: {}, fn: {}, $dlg: {}, itemIdPrefix: 'Rgn_' };
|
||||
let sr = sax.data.selectRegion;
|
||||
sr.regions = {}; sr.fn = {}; sr.ajax = {}; sr.itemIdPrefix = 'Rgn_';
|
||||
|
||||
//--------------------------------------------------------------
|
||||
/*
|
||||
* Region selection config:
|
||||
* - caption - dialog title.
|
||||
* - regionId - currently selected region.
|
||||
* - typesInc[] - included region types.
|
||||
* - typesExc[] - excluded region types.
|
||||
* - fnCallback - method to call on completion to store selected region.
|
||||
*/
|
||||
sr.fn.selectRegion = function (cfg)
|
||||
@@ -22,14 +25,15 @@
|
||||
if (sr.regions.length) sr.fn.showSelectRegion();
|
||||
else
|
||||
{
|
||||
sax.ajaxRegions = sax.ajaxRegions || { url: sax.url.base + 'Reference/Ajax/GetRegions', formId: 'frmNavigate', callbackFn: sr.fn.refreshRegionsAndSelect };
|
||||
sax.doAjaxRequest(sax.ajaxRegions, 20);
|
||||
sr.ajax.regions = sr.ajax.regions || { url: sax.url.base + 'Reference/Ajax/GetRegions', formId: 'frmNavigate', callbackFn: sr.fn.refreshRegionsAndSelect };
|
||||
sax.doAjaxRequest(sr.ajax.regions, 20);
|
||||
}
|
||||
}
|
||||
sr.fn.refreshRegionsAndSelect = function (response)
|
||||
{
|
||||
if (!response || !response.success) return;
|
||||
sr.regions = response.regions;
|
||||
sax.debug(sr.cfg);
|
||||
sr.fn.showSelectRegion();
|
||||
}
|
||||
sr.fn.showSelectRegion = function ()
|
||||
@@ -57,12 +61,16 @@
|
||||
let $regionsAvail = $('.sax-selectRegion-regions.AvailableRegions', sr.$dlg).empty();
|
||||
let $regionTmpl = $('.sax-panel-item-template .sax-panel-item.Region', sr.$dlg);
|
||||
let regions = [...sr.regions];
|
||||
let typesInc = sr.cfg.typesInc||[];
|
||||
let typesExc = sr.cfg.typesExc||[];
|
||||
regions.sort(sr.fn.compareRegions);
|
||||
for (let rgnIdx = 0; rgnIdx < regions.length; rgnIdx++)
|
||||
{
|
||||
let region = regions[rgnIdx];
|
||||
let id = region.id;
|
||||
if (filter && !region.name.match(reFilter)) continue;
|
||||
if (typesInc.length && !typesInc.includes(region.regionType)) continue;
|
||||
if (typesExc.length && typesExc.includes(region.regionType)) continue;
|
||||
let $region = $regionTmpl.clone();
|
||||
$region.prop('id', sr.itemIdPrefix + id).on('click', function () { sr.fn.onClickRegion(id); }).on('dblclick', function () { sr.fn.onDblClickRegion(id); }).find('.RegionName').text(region.name).end();
|
||||
if (id == sr.regionId) $region.addClass('sel');
|
||||
@@ -120,7 +128,7 @@
|
||||
//--------------------------------------------------------------
|
||||
sr.fn.init = function ()
|
||||
{
|
||||
if (!sr.$dlg) return;
|
||||
if (sr.$dlg) return;
|
||||
var opt = sax.dlgOpts();
|
||||
opt.open = function (evt, ui) { sr.fn.onDlgSize(); };
|
||||
opt.resize = function (evt, ui) { sr.fn.onDlgSize(); };
|
||||
@@ -15,8 +15,8 @@
|
||||
rp.paging = paging = paging || {};
|
||||
rp.$rp.toggle(paging.paged);
|
||||
$('.sax-paging-info', rp.$rp).text(sax.resultsPaging.msg.pageInfo.format(paging.pageNo, paging.pageCount));
|
||||
$('.sax-paging-first,.sax-paging-prev', rp.$rp).toggle(paging.pageNo > 1);
|
||||
$('.sax-paging-next,.sax-paging-last', rp.$rp).toggle(paging.pageNo < paging.pageCount);
|
||||
//$('.sax-paging-first,.sax-paging-prev', rp.$rp).toggle(paging.pageNo > 1);
|
||||
//$('.sax-paging-next,.sax-paging-last', rp.$rp).toggle(paging.pageNo < paging.pageCount);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
+5
-4
@@ -5,7 +5,8 @@
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let ss = sax.data.selectSport = sax.data.selectSport || { sports: {}, fn: {}, $dlg: {}, itemIdPrefix: 'Spt_' };
|
||||
let ss = sax.data.selectSport;
|
||||
ss.sports = {}; ss.fn = {}; ss.ajax = {}; ss.itemIdPrefix = 'Spt_';
|
||||
|
||||
//--------------------------------------------------------------
|
||||
/*
|
||||
@@ -23,8 +24,8 @@
|
||||
if (ss.sports.length) ss.fn.showSelectSport();
|
||||
else
|
||||
{
|
||||
sax.ajaxSports = sax.ajaxSports || { url: sax.url.base + 'Reference/Ajax/GetSports', formId: 'frmNavigate', callbackFn: ss.fn.refreshSportsAndSelect };
|
||||
sax.doAjaxRequest(sax.ajaxSports, 20);
|
||||
ss.ajax.sports = ss.ajax.sports || { url: sax.url.base + 'Reference/Ajax/GetSports', formId: 'frmNavigate', callbackFn: ss.fn.refreshSportsAndSelect };
|
||||
sax.doAjaxRequest(ss.ajax.sports, 20);
|
||||
}
|
||||
}
|
||||
ss.fn.refreshSportsAndSelect = function (response)
|
||||
@@ -122,7 +123,7 @@
|
||||
//--------------------------------------------------------------
|
||||
ss.fn.init = function ()
|
||||
{
|
||||
if (!ss.$dlg) return;
|
||||
if (ss.$dlg) return;
|
||||
var opt = sax.dlgOpts();
|
||||
opt.open = function (evt, ui) { ss.fn.onDlgSize(); };
|
||||
opt.resize = function (evt, ui) { ss.fn.onDlgSize(); };
|
||||
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.1.0.0";
|
||||
private static String version { get; } = "1.1.1.0";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
@@ -40,6 +40,11 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Version history.
|
||||
//-------------------------------------------------------------------
|
||||
// 1.1.2 ??-Jul-2021 Organisation Request.
|
||||
// - Online Organisation Request.
|
||||
// 1.1.1 2-Jul-2021 Add User fix.
|
||||
// - Admin fix Internals Region cache issue on null value.
|
||||
// - Optional user title.
|
||||
// 1.1.0 25-Jun-2021 Article publication. Admin Regions.
|
||||
// - Online Articles publication date and paging.
|
||||
// - Admin Region paging and parent selection.
|
||||
|
||||
@@ -98,6 +98,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
OrganisationType,
|
||||
OrganisationCategory,
|
||||
OrganisationRole,
|
||||
AddressType,
|
||||
OpportunityType,
|
||||
ActivityReaction,
|
||||
};
|
||||
@@ -149,6 +150,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
OrganisationEvent = 225,
|
||||
// Item link components.
|
||||
ItemImage = 400,
|
||||
ItemAddress = 405,
|
||||
ItemSport = 420,
|
||||
}
|
||||
|
||||
@@ -279,6 +281,17 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
OpportunityAdmin,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public enum AddressType
|
||||
{
|
||||
Unknown = 0,
|
||||
/* Do not change the numeric values - tied to database. */
|
||||
Location = 10,
|
||||
Home = 20,
|
||||
Office = 50,
|
||||
Delivery = 60,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Opportunity Type</summary>
|
||||
public enum OpportunityType
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -18,6 +18,7 @@ namespace Saxonite.Base.App
|
||||
{
|
||||
Unknown = 0,
|
||||
ActivityIndex,
|
||||
ItemAddress,
|
||||
ItemImage,
|
||||
ItemSport,
|
||||
JournalistArticle,
|
||||
@@ -52,6 +53,38 @@ namespace Saxonite.Base.App
|
||||
ActivityIndex_UpdateOn,
|
||||
ActivityIndex_UpdateBy,
|
||||
ActivityIndex_UpdateHost,
|
||||
ItemAddress_Id,
|
||||
ItemAddress_ItemType,
|
||||
ItemAddress_ItemId,
|
||||
ItemAddress_AddressType,
|
||||
ItemAddress_Caption,
|
||||
ItemAddress_Line1,
|
||||
ItemAddress_Line2,
|
||||
ItemAddress_Line3,
|
||||
ItemAddress_Town,
|
||||
ItemAddress_Province,
|
||||
ItemAddress_RegionIdProvince,
|
||||
ItemAddress_Country,
|
||||
ItemAddress_RegionIdCountry,
|
||||
ItemAddress_PostalCode,
|
||||
ItemAddress_PhoneMain,
|
||||
ItemAddress_LocationSource,
|
||||
ItemAddress_LocationStoredAt,
|
||||
ItemAddress_LocationUpdateRequired,
|
||||
ItemAddress_LocationData,
|
||||
ItemAddress_LocationFormattedAddress,
|
||||
ItemAddress_LocationLatitude,
|
||||
ItemAddress_LocationLongitude,
|
||||
ItemAddress_LocationAltitude,
|
||||
ItemAddress_Notes,
|
||||
ItemAddress_Flags,
|
||||
ItemAddress_Status,
|
||||
ItemAddress_CreateOn,
|
||||
ItemAddress_CreateBy,
|
||||
ItemAddress_CreateHost,
|
||||
ItemAddress_UpdateOn,
|
||||
ItemAddress_UpdateBy,
|
||||
ItemAddress_UpdateHost,
|
||||
ItemImage_Id,
|
||||
ItemImage_ItemType,
|
||||
ItemImage_ItemId,
|
||||
@@ -270,8 +303,8 @@ namespace Saxonite.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 14;
|
||||
private static readonly int columnCount = 228;
|
||||
private static readonly int tableCount = 15;
|
||||
private static readonly int columnCount = 260;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -418,6 +451,7 @@ namespace Saxonite.Base.App
|
||||
private static readonly String[] tables =
|
||||
{
|
||||
"ActivityIndex",
|
||||
"ItemAddress",
|
||||
"ItemImage",
|
||||
"ItemSport",
|
||||
"JournalistArticle",
|
||||
@@ -474,30 +508,48 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(2,"Id",5,-5,true,19),
|
||||
new ColumnDfn(2,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(2,"ItemId",4,4,false,10),
|
||||
new ColumnDfn(2,"ImageType",3,5,false,5),
|
||||
new ColumnDfn(2,"ImageSeq",2,-6,false,3),
|
||||
new ColumnDfn(2,"SessionUid",5,-5,false,19),
|
||||
new ColumnDfn(2,"ImageUid",4,4,false,10),
|
||||
new ColumnDfn(2,"Filename",0,-9,false,1024),
|
||||
new ColumnDfn(2,"Mime",0,12,false,64),
|
||||
new ColumnDfn(2,"ContentType",0,12,false,128),
|
||||
new ColumnDfn(2,"Width",4,4,false,10),
|
||||
new ColumnDfn(2,"Height",4,4,false,10),
|
||||
new ColumnDfn(2,"ImageData",10,-3,false,0),
|
||||
new ColumnDfn(2,"AddressType",3,5,false,5),
|
||||
new ColumnDfn(2,"Caption",0,-9,false,200),
|
||||
new ColumnDfn(2,"Line1",0,-9,false,200),
|
||||
new ColumnDfn(2,"Line2",0,-9,false,200),
|
||||
new ColumnDfn(2,"Line3",0,-9,false,200),
|
||||
new ColumnDfn(2,"Town",0,-9,false,100),
|
||||
new ColumnDfn(2,"Province",0,-9,false,100),
|
||||
new ColumnDfn(2,"RegionIdProvince",4,4,false,10),
|
||||
new ColumnDfn(2,"Country",0,-9,false,100),
|
||||
new ColumnDfn(2,"RegionIdCountry",4,4,false,10),
|
||||
new ColumnDfn(2,"PostalCode",0,-9,false,32),
|
||||
new ColumnDfn(2,"PhoneMain",0,-9,false,100),
|
||||
new ColumnDfn(2,"LocationSource",0,12,false,100),
|
||||
new ColumnDfn(2,"LocationStoredAt",9,93,false,16),
|
||||
new ColumnDfn(2,"LocationUpdateRequired",1,-7,false,1),
|
||||
new ColumnDfn(2,"LocationData",0,-9,false,4000),
|
||||
new ColumnDfn(2,"LocationFormattedAddress",0,-9,false,4000),
|
||||
new ColumnDfn(2,"LocationLatitude",8,3,false,9),
|
||||
new ColumnDfn(2,"LocationLongitude",8,3,false,9),
|
||||
new ColumnDfn(2,"LocationAltitude",8,3,false,9),
|
||||
new ColumnDfn(2,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(2,"Flags",3,5,false,5),
|
||||
new ColumnDfn(2,"Status",0,12,false,3),
|
||||
new ColumnDfn(2,"Status",0,1,false,3),
|
||||
new ColumnDfn(2,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(2,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(2,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(2,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(2,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(2,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(3,"Id",4,4,true,10),
|
||||
new ColumnDfn(3,"Id",5,-5,true,19),
|
||||
new ColumnDfn(3,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(3,"ItemId",4,4,false,10),
|
||||
new ColumnDfn(3,"SportId",4,4,false,10),
|
||||
new ColumnDfn(3,"ItemSportData",0,-9,false,0),
|
||||
new ColumnDfn(3,"ImageType",3,5,false,5),
|
||||
new ColumnDfn(3,"ImageSeq",2,-6,false,3),
|
||||
new ColumnDfn(3,"SessionUid",5,-5,false,19),
|
||||
new ColumnDfn(3,"ImageUid",4,4,false,10),
|
||||
new ColumnDfn(3,"Filename",0,-9,false,1024),
|
||||
new ColumnDfn(3,"Mime",0,12,false,64),
|
||||
new ColumnDfn(3,"ContentType",0,12,false,128),
|
||||
new ColumnDfn(3,"Width",4,4,false,10),
|
||||
new ColumnDfn(3,"Height",4,4,false,10),
|
||||
new ColumnDfn(3,"ImageData",10,-3,false,0),
|
||||
new ColumnDfn(3,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(3,"Flags",3,5,false,5),
|
||||
new ColumnDfn(3,"Status",0,12,false,3),
|
||||
@@ -508,13 +560,10 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(3,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(3,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(4,"Id",4,4,true,10),
|
||||
new ColumnDfn(4,"UserAccountIdJournalist",4,4,false,10),
|
||||
new ColumnDfn(4,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(4,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(4,"Headline",0,-9,false,200),
|
||||
new ColumnDfn(4,"Summary",0,-9,false,2000),
|
||||
new ColumnDfn(4,"BodyData",0,-9,false,0),
|
||||
new ColumnDfn(4,"PublishedAt",9,93,false,16),
|
||||
new ColumnDfn(4,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(4,"ItemId",4,4,false,10),
|
||||
new ColumnDfn(4,"SportId",4,4,false,10),
|
||||
new ColumnDfn(4,"ItemSportData",0,-9,false,0),
|
||||
new ColumnDfn(4,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(4,"Flags",3,5,false,5),
|
||||
new ColumnDfn(4,"Status",0,12,false,3),
|
||||
@@ -525,14 +574,13 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(4,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(4,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(5,"Id",4,4,true,10),
|
||||
new ColumnDfn(5,"Name",0,-9,false,100),
|
||||
new ColumnDfn(5,"OrganisationType",0,12,false,3),
|
||||
new ColumnDfn(5,"OrganisationCategory",0,12,false,3),
|
||||
new ColumnDfn(5,"UserAccountIdJournalist",4,4,false,10),
|
||||
new ColumnDfn(5,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(5,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(5,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(5,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(5,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(5,"Headline",0,-9,false,200),
|
||||
new ColumnDfn(5,"Summary",0,-9,false,2000),
|
||||
new ColumnDfn(5,"BodyData",0,-9,false,0),
|
||||
new ColumnDfn(5,"PublishedAt",9,93,false,16),
|
||||
new ColumnDfn(5,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(5,"Flags",3,5,false,5),
|
||||
new ColumnDfn(5,"Status",0,12,false,3),
|
||||
@@ -543,15 +591,14 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(5,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(5,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(6,"Id",4,4,true,10),
|
||||
new ColumnDfn(6,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(6,"Name",0,-9,false,100),
|
||||
new ColumnDfn(6,"OrganisationType",0,12,false,3),
|
||||
new ColumnDfn(6,"OrganisationCategory",0,12,false,3),
|
||||
new ColumnDfn(6,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(6,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(6,"OpportunityTypeCode",0,12,false,3),
|
||||
new ColumnDfn(6,"Position",0,-9,false,200),
|
||||
new ColumnDfn(6,"Outline",0,-9,false,2000),
|
||||
new ColumnDfn(6,"OpportunityData",0,-9,false,0),
|
||||
new ColumnDfn(6,"PublishedAt",9,93,false,16),
|
||||
new ColumnDfn(6,"ExpiresAt",9,93,false,16),
|
||||
new ColumnDfn(6,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(6,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(6,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(6,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(6,"Flags",3,5,false,5),
|
||||
new ColumnDfn(6,"Status",0,12,false,3),
|
||||
@@ -562,12 +609,15 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(6,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(6,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(7,"Id",4,4,true,10),
|
||||
new ColumnDfn(7,"RegionType",3,5,false,5),
|
||||
new ColumnDfn(7,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(7,"Name",0,-9,false,100),
|
||||
new ColumnDfn(7,"Latitude",8,3,false,9),
|
||||
new ColumnDfn(7,"Longitude",8,3,false,9),
|
||||
new ColumnDfn(7,"RegionIdParent",4,4,false,10),
|
||||
new ColumnDfn(7,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(7,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(7,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(7,"OpportunityTypeCode",0,12,false,3),
|
||||
new ColumnDfn(7,"Position",0,-9,false,200),
|
||||
new ColumnDfn(7,"Outline",0,-9,false,2000),
|
||||
new ColumnDfn(7,"OpportunityData",0,-9,false,0),
|
||||
new ColumnDfn(7,"PublishedAt",9,93,false,16),
|
||||
new ColumnDfn(7,"ExpiresAt",9,93,false,16),
|
||||
new ColumnDfn(7,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(7,"Flags",3,5,false,5),
|
||||
new ColumnDfn(7,"Status",0,12,false,3),
|
||||
@@ -578,7 +628,12 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(7,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(7,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(8,"Id",4,4,true,10),
|
||||
new ColumnDfn(8,"RegionType",3,5,false,5),
|
||||
new ColumnDfn(8,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(8,"Name",0,-9,false,100),
|
||||
new ColumnDfn(8,"Latitude",8,3,false,9),
|
||||
new ColumnDfn(8,"Longitude",8,3,false,9),
|
||||
new ColumnDfn(8,"RegionIdParent",4,4,false,10),
|
||||
new ColumnDfn(8,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(8,"Flags",3,5,false,5),
|
||||
new ColumnDfn(8,"Status",0,12,false,3),
|
||||
@@ -589,24 +644,7 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(8,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(8,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(9,"Id",4,4,true,10),
|
||||
new ColumnDfn(9,"EmailAddress",0,-9,false,200),
|
||||
new ColumnDfn(9,"Title",0,-9,false,20),
|
||||
new ColumnDfn(9,"FirstName",0,-9,false,100),
|
||||
new ColumnDfn(9,"Initials",0,-9,false,10),
|
||||
new ColumnDfn(9,"LastName",0,-9,false,100),
|
||||
new ColumnDfn(9,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(9,"PhoneMobile",0,-9,false,50),
|
||||
new ColumnDfn(9,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(9,"DateOfBirth",9,93,false,16),
|
||||
new ColumnDfn(9,"RegionIdCountry",4,4,false,10),
|
||||
new ColumnDfn(9,"RegionIdProvince",4,4,false,10),
|
||||
new ColumnDfn(9,"PasswordToken",0,12,false,32),
|
||||
new ColumnDfn(9,"PasswordHashed",0,-9,false,100),
|
||||
new ColumnDfn(9,"PasswordHistory",0,-9,false,0),
|
||||
new ColumnDfn(9,"PasswordChangedAt",9,93,false,16),
|
||||
new ColumnDfn(9,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(9,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(9,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(9,"Name",0,-9,false,100),
|
||||
new ColumnDfn(9,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(9,"Flags",3,5,false,5),
|
||||
new ColumnDfn(9,"Status",0,12,false,3),
|
||||
@@ -616,19 +654,25 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(9,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(9,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(9,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(10,"Id",5,-5,true,19),
|
||||
new ColumnDfn(10,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(10,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(10,"ItemId",5,-5,false,19),
|
||||
new ColumnDfn(10,"CurrentlyListed",1,-7,false,1),
|
||||
new ColumnDfn(10,"ListedAtFirst",9,93,false,16),
|
||||
new ColumnDfn(10,"ListedAtLast",9,93,false,16),
|
||||
new ColumnDfn(10,"ViewedAtFirst",9,93,false,16),
|
||||
new ColumnDfn(10,"ViewedAtLast",9,93,false,16),
|
||||
new ColumnDfn(10,"Reaction",3,5,false,5),
|
||||
new ColumnDfn(10,"ReactedAtFirst",9,93,false,16),
|
||||
new ColumnDfn(10,"ReactedAtLast",9,93,false,16),
|
||||
new ColumnDfn(10,"UserActivityData",0,-9,false,0),
|
||||
new ColumnDfn(10,"Id",4,4,true,10),
|
||||
new ColumnDfn(10,"EmailAddress",0,-9,false,200),
|
||||
new ColumnDfn(10,"Title",0,-9,false,20),
|
||||
new ColumnDfn(10,"FirstName",0,-9,false,100),
|
||||
new ColumnDfn(10,"Initials",0,-9,false,10),
|
||||
new ColumnDfn(10,"LastName",0,-9,false,100),
|
||||
new ColumnDfn(10,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(10,"PhoneMobile",0,-9,false,50),
|
||||
new ColumnDfn(10,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(10,"DateOfBirth",9,93,false,16),
|
||||
new ColumnDfn(10,"RegionIdCountry",4,4,false,10),
|
||||
new ColumnDfn(10,"RegionIdProvince",4,4,false,10),
|
||||
new ColumnDfn(10,"PasswordToken",0,12,false,32),
|
||||
new ColumnDfn(10,"PasswordHashed",0,-9,false,100),
|
||||
new ColumnDfn(10,"PasswordHistory",0,-9,false,0),
|
||||
new ColumnDfn(10,"PasswordChangedAt",9,93,false,16),
|
||||
new ColumnDfn(10,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(10,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(10,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(10,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(10,"Flags",3,5,false,5),
|
||||
new ColumnDfn(10,"Status",0,12,false,3),
|
||||
@@ -640,9 +684,17 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(10,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(11,"Id",5,-5,true,19),
|
||||
new ColumnDfn(11,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(11,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(11,"OrganisationRoleCodes",0,12,false,256),
|
||||
new ColumnDfn(11,"OrganisationRoleCount",2,-6,false,3),
|
||||
new ColumnDfn(11,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(11,"ItemId",5,-5,false,19),
|
||||
new ColumnDfn(11,"CurrentlyListed",1,-7,false,1),
|
||||
new ColumnDfn(11,"ListedAtFirst",9,93,false,16),
|
||||
new ColumnDfn(11,"ListedAtLast",9,93,false,16),
|
||||
new ColumnDfn(11,"ViewedAtFirst",9,93,false,16),
|
||||
new ColumnDfn(11,"ViewedAtLast",9,93,false,16),
|
||||
new ColumnDfn(11,"Reaction",3,5,false,5),
|
||||
new ColumnDfn(11,"ReactedAtFirst",9,93,false,16),
|
||||
new ColumnDfn(11,"ReactedAtLast",9,93,false,16),
|
||||
new ColumnDfn(11,"UserActivityData",0,-9,false,0),
|
||||
new ColumnDfn(11,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(11,"Flags",3,5,false,5),
|
||||
new ColumnDfn(11,"Status",0,12,false,3),
|
||||
@@ -654,7 +706,9 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(11,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(12,"Id",5,-5,true,19),
|
||||
new ColumnDfn(12,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(12,"UserRoleCode",0,12,false,16),
|
||||
new ColumnDfn(12,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(12,"OrganisationRoleCodes",0,12,false,256),
|
||||
new ColumnDfn(12,"OrganisationRoleCount",2,-6,false,3),
|
||||
new ColumnDfn(12,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(12,"Flags",3,5,false,5),
|
||||
new ColumnDfn(12,"Status",0,12,false,3),
|
||||
@@ -664,27 +718,39 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(12,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(12,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(12,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(13,"Id",5,-5,true,19),
|
||||
new ColumnDfn(13,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(13,"ActivityIndexIds",0,-9,false,0),
|
||||
new ColumnDfn(13,"UserSessionData",0,-9,false,0),
|
||||
new ColumnDfn(13,"UserRoleCode",0,12,false,16),
|
||||
new ColumnDfn(13,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(13,"Flags",3,5,false,5),
|
||||
new ColumnDfn(13,"Status",0,12,false,3),
|
||||
new ColumnDfn(13,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(13,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(13,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(13,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(14,"Id",4,4,true,10),
|
||||
new ColumnDfn(13,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(13,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(14,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(14,"SportId",4,4,false,10),
|
||||
new ColumnDfn(14,"Participation",3,5,false,5),
|
||||
new ColumnDfn(14,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(14,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(14,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(14,"ActivityIndexIds",0,-9,false,0),
|
||||
new ColumnDfn(14,"UserSessionData",0,-9,false,0),
|
||||
new ColumnDfn(14,"Flags",3,5,false,5),
|
||||
new ColumnDfn(14,"Status",0,12,false,3),
|
||||
new ColumnDfn(14,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(14,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(14,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(14,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(14,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(14,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(15,"Id",4,4,true,10),
|
||||
new ColumnDfn(15,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(15,"SportId",4,4,false,10),
|
||||
new ColumnDfn(15,"Participation",3,5,false,5),
|
||||
new ColumnDfn(15,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(15,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(15,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(15,"Flags",3,5,false,5),
|
||||
new ColumnDfn(15,"Status",0,12,false,3),
|
||||
new ColumnDfn(15,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(15,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(15,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(15,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(15,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(15,"UpdateHost",0,12,false,100),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -95,6 +95,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public List<TypeCodeDesc> OrganisationTypeCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationType); } }
|
||||
public List<TypeCodeDesc> OrganisationCategoryCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } }
|
||||
public List<TypeCodeDesc> OrganisationRoleCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } }
|
||||
public List<TypeCodeDesc> AddressTypeCodes { get { return GetCodesOfType(Sax.CodeType.AddressType); } }
|
||||
public List<TypeCodeDesc> OpportunityTypeCodes { get { return GetCodesOfType(Sax.CodeType.OpportunityType); } }
|
||||
public List<TypeCodeDesc> ActivityReactionCodes { get { return GetCodesOfType(Sax.CodeType.ActivityReaction); } }
|
||||
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
|
||||
@@ -210,6 +211,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
QueryRegionsToCache(regionIds);
|
||||
foreach (SysId regionId in regionIds)
|
||||
{
|
||||
if (!SysId.IsValid(regionId)) continue;
|
||||
SaxRegion region = GetRegion(regionCache.GetValue(regionId, null));
|
||||
if (region != null)
|
||||
regions.Add(region);
|
||||
@@ -284,6 +286,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
QuerySportsToCache(sportIds);
|
||||
foreach (SysId sportId in sportIds)
|
||||
{
|
||||
if (!SysId.IsValid(sportId)) continue;
|
||||
SaxSport sport = GetSport(sportCache.GetValue(sportId, null));
|
||||
if (sport != null)
|
||||
sports.Add(sport);
|
||||
@@ -298,6 +301,50 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
return sport;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Common Data Components
|
||||
//-------------------------------------------------------------------
|
||||
// User Accounts.
|
||||
private readonly Dictionary<SysId, SaxUserAccount> userAccountCache = new Dictionary<SysId, SaxUserAccount>();
|
||||
public SaxUserAccount GetUserAccount(SysId userAccountId)
|
||||
{
|
||||
if (!SysId.IsValid(userAccountId)) return null;
|
||||
if (!userAccountCache.ContainsKey(userAccountId))
|
||||
userAccountCache.Add(userAccountId, AccountMgr.GetUserAccountById(userAccountId));
|
||||
return userAccountCache.GetValue(userAccountId, null);
|
||||
}
|
||||
public String GetUserAccountEmailAddress(SysId userAccountId)
|
||||
{
|
||||
SaxUserAccount userAccount = GetUserAccount(userAccountId);
|
||||
return userAccount?.EmailAddress ?? "";
|
||||
}
|
||||
public String GetUserAccountDisplayName(SysId userAccountId)
|
||||
{
|
||||
SaxUserAccount userAccount = GetUserAccount(userAccountId);
|
||||
return userAccount?.GetDisplayName() ?? "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User Accounts.
|
||||
private readonly Dictionary<SysId, SaxOrganisation> organisationCache = new Dictionary<SysId, SaxOrganisation>();
|
||||
public SaxOrganisation GetOrganisation(SysId organisationId)
|
||||
{
|
||||
if (!SysId.IsValid(organisationId)) return null;
|
||||
if (!organisationCache.ContainsKey(organisationId))
|
||||
organisationCache.Add(organisationId, AccountMgr.GetOrganisationById(organisationId));
|
||||
return organisationCache.GetValue(organisationId, null);
|
||||
}
|
||||
public String GetOrganisationName(SysId organisationId)
|
||||
{
|
||||
SaxOrganisation organisation = GetOrganisation(organisationId);
|
||||
return organisation?.Name ?? "";
|
||||
}
|
||||
public SysId GetOrganisationRegionId(SysId organisationId)
|
||||
{
|
||||
SaxOrganisation organisation = GetOrganisation(organisationId);
|
||||
return organisation?.RegionIdPrimary ?? new SysId();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
private static readonly List<TypeCodeDesc> organisationTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> organisationCategoryCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> organisationRoleCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> addressTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> opportunityTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> activityReactionCodes = new List<TypeCodeDesc>();
|
||||
|
||||
@@ -140,7 +141,14 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
opportunityTypeCodes.Add(Sax.OpportunityType.Board, "BRD", "Board");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Opportunity types.
|
||||
// Address Types.
|
||||
addressTypeCodes.Add(Sax.AddressType.Location, "Location", "Location");
|
||||
addressTypeCodes.Add(Sax.AddressType.Home, "Home", "Home");
|
||||
addressTypeCodes.Add(Sax.AddressType.Office, "Office", "Office");
|
||||
addressTypeCodes.Add(Sax.AddressType.Delivery, "Delivery", "Delivery");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Activity Reactions.
|
||||
activityReactionCodes.Add(Sax.ActivityReaction.Good, "Good", "Good");
|
||||
activityReactionCodes.Add(Sax.ActivityReaction.VeryGood, "VeryGood", "Very Good");
|
||||
activityReactionCodes.Add(Sax.ActivityReaction.Exceptional, "Exceptional", "Exceptional");
|
||||
|
||||
@@ -58,6 +58,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
return new List<TypeCodeDesc>(organisationCategoryCodes);
|
||||
case Sax.CodeType.OrganisationRole:
|
||||
return new List<TypeCodeDesc>(organisationRoleCodes);
|
||||
case Sax.CodeType.AddressType:
|
||||
return new List<TypeCodeDesc>(addressTypeCodes);
|
||||
case Sax.CodeType.OpportunityType:
|
||||
return new List<TypeCodeDesc>(opportunityTypeCodes);
|
||||
case Sax.CodeType.ActivityReaction:
|
||||
|
||||
@@ -0,0 +1,471 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
// ItemAddress.
|
||||
//=======================================================================
|
||||
public abstract class SaxItemAddress : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
// Item.
|
||||
ItemType,
|
||||
ItemType_Code,
|
||||
ItemType_Desc,
|
||||
ItemId,
|
||||
Item_Caption,
|
||||
// Address.
|
||||
AddressType,
|
||||
AddressType_Code,
|
||||
AddressType_Desc,
|
||||
Caption,
|
||||
Line1,
|
||||
Line2,
|
||||
Line3,
|
||||
Town,
|
||||
Province,
|
||||
Country,
|
||||
PostalCode,
|
||||
PhoneMain,
|
||||
// Regions.
|
||||
RegionIdProvince,
|
||||
RegionProvince_Name,
|
||||
RegionIdCountry,
|
||||
RegionCountry_Name,
|
||||
// Location.
|
||||
// Associated data.
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Desc,
|
||||
Status_Ind,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public ItemId ItemId { get; set; }
|
||||
public Sax.AddressType AddressType { get; set; }
|
||||
public String Caption { get; set; }
|
||||
public String Line1 { get; set; }
|
||||
public String Line2 { get; set; }
|
||||
public String Line3 { get; set; }
|
||||
public String Town { get; set; }
|
||||
public String Province { get; set; }
|
||||
public SysId RegionIdProvince { get; set; }
|
||||
public String Country { get; set; }
|
||||
public SysId RegionIdCountry { get; set; }
|
||||
public String PostalCode { get; set; }
|
||||
public String PhoneMain { get; set; }
|
||||
// Location.
|
||||
public String LocationSource { get; set; }
|
||||
public DateTime LocationStoredAt { get; set; }
|
||||
public bool LocationUpdateRequired { get; set; }
|
||||
public String LocationData { get; set; }
|
||||
public String LocationFormattedAddress { get; set; }
|
||||
public Decimal LocationLatitude { get; set; }
|
||||
public Decimal LocationLongitude { get; set; }
|
||||
public Decimal LocationAltitude { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public ItemId ItemId
|
||||
{
|
||||
get { return data.ItemId; }
|
||||
set { CheckChanged(data.ItemId, value); data.ItemId = value; }
|
||||
}
|
||||
public Sax.AddressType AddressType
|
||||
{
|
||||
get { return data.AddressType; }
|
||||
set { CheckChanged((short)data.AddressType, (short)value); data.AddressType = value; }
|
||||
}
|
||||
public String Caption
|
||||
{
|
||||
get { return data.Caption; }
|
||||
set { CheckChanged(data.Caption, value); data.Caption = value; }
|
||||
}
|
||||
public String Line1
|
||||
{
|
||||
get { return data.Line1; }
|
||||
set { CheckChanged(data.Line1, value); data.Line1 = value; }
|
||||
}
|
||||
public String Line2
|
||||
{
|
||||
get { return data.Line2; }
|
||||
set { CheckChanged(data.Line2, value); data.Line2 = value; }
|
||||
}
|
||||
public String Line3
|
||||
{
|
||||
get { return data.Line3; }
|
||||
set { CheckChanged(data.Line3, value); data.Line3 = value; }
|
||||
}
|
||||
public String Town
|
||||
{
|
||||
get { return data.Town; }
|
||||
set { CheckChanged(data.Town, value); data.Town = value; }
|
||||
}
|
||||
public String PostalCode
|
||||
{
|
||||
get { return data.PostalCode; }
|
||||
set { CheckChanged(data.PostalCode, value); data.PostalCode = value; }
|
||||
}
|
||||
public String Province
|
||||
{
|
||||
get { return data.Province; }
|
||||
set { CheckChanged(data.Province, value); data.Province = value; }
|
||||
}
|
||||
public SysId RegionIdProvince
|
||||
{
|
||||
get { return data.RegionIdProvince; }
|
||||
set { CheckChanged(data.RegionIdProvince, value); data.RegionIdProvince = value; }
|
||||
}
|
||||
public String Country
|
||||
{
|
||||
get { return data.Country; }
|
||||
set { CheckChanged(data.Country, value); data.Country = value; }
|
||||
}
|
||||
public SysId RegionIdCountry
|
||||
{
|
||||
get { return data.RegionIdCountry; }
|
||||
set { CheckChanged(data.RegionIdCountry, value); data.RegionIdCountry = value; }
|
||||
}
|
||||
public String PhoneMain
|
||||
{
|
||||
get { return data.PhoneMain; }
|
||||
set { CheckChanged(data.PhoneMain, value); data.PhoneMain = value; }
|
||||
}
|
||||
|
||||
// Location.
|
||||
public String LocationSource
|
||||
{
|
||||
get { return data.LocationSource; }
|
||||
set { CheckChanged(data.LocationSource, value); data.LocationSource = value; }
|
||||
}
|
||||
public DateTime LocationStoredAt
|
||||
{
|
||||
get { return data.LocationStoredAt; }
|
||||
set { CheckChanged(data.LocationStoredAt, value); data.LocationStoredAt = value; }
|
||||
}
|
||||
public bool LocationUpdateRequired
|
||||
{
|
||||
get { return data.LocationUpdateRequired; }
|
||||
set { CheckChanged(data.LocationUpdateRequired, value); data.LocationUpdateRequired = value; }
|
||||
}
|
||||
public String LocationData
|
||||
{
|
||||
get { return data.LocationData; }
|
||||
set { CheckChanged(data.LocationData, value); data.LocationData = value; }
|
||||
}
|
||||
public String LocationFormattedAddress
|
||||
{
|
||||
get { return data.LocationFormattedAddress; }
|
||||
set { CheckChanged(data.LocationFormattedAddress, value); data.LocationFormattedAddress = value; }
|
||||
}
|
||||
public Decimal LocationLatitude
|
||||
{
|
||||
get { return data.LocationLatitude; }
|
||||
set { CheckChanged(data.LocationLatitude, value); data.LocationLatitude = value; }
|
||||
}
|
||||
public Decimal LocationLongitude
|
||||
{
|
||||
get { return data.LocationLongitude; }
|
||||
set { CheckChanged(data.LocationLongitude, value); data.LocationLongitude = value; }
|
||||
}
|
||||
public Decimal LocationAltitude
|
||||
{
|
||||
get { return data.LocationAltitude; }
|
||||
set { CheckChanged(data.LocationAltitude, value); data.LocationAltitude = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
ItemId = data.ItemId;
|
||||
AddressType = data.AddressType;
|
||||
Caption = data.Caption;
|
||||
Line1 = data.Line1;
|
||||
Line2 = data.Line2;
|
||||
Line3 = data.Line3;
|
||||
Town = data.Town;
|
||||
RegionIdProvince = data.RegionIdProvince;
|
||||
Province = data.Province;
|
||||
RegionIdCountry = data.RegionIdCountry;
|
||||
Country = data.Country;
|
||||
PostalCode = data.PostalCode;
|
||||
PhoneMain = data.PhoneMain;
|
||||
// Location.
|
||||
LocationSource = data.LocationSource;
|
||||
LocationStoredAt = data.LocationStoredAt;
|
||||
LocationUpdateRequired = data.LocationUpdateRequired;
|
||||
LocationData = data.LocationData;
|
||||
LocationFormattedAddress = data.LocationFormattedAddress;
|
||||
LocationLatitude = data.LocationLatitude;
|
||||
LocationLongitude = data.LocationLongitude;
|
||||
LocationAltitude = data.LocationAltitude;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Error field - identify properties with validation error.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
// Identifies the field that has invalid data.
|
||||
public ValidValue ItemId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue AddressType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Caption { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Line1 { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Line2 { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Line3 { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Town { get; set; } = ValidValue.Valid;
|
||||
public ValidValue RegionIdProvince { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Province { get; set; } = ValidValue.Valid;
|
||||
public ValidValue RegionIdCountry { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Country { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PostalCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PhoneMain { get; set; } = ValidValue.Valid;
|
||||
// Location.
|
||||
public ValidValue LocationSource { get; set; } = ValidValue.Valid;
|
||||
public ValidValue LocationStoredAt { get; set; } = ValidValue.Valid;
|
||||
public ValidValue LocationUpdateRequired { get; set; } = ValidValue.Valid;
|
||||
public ValidValue LocationData { get; set; } = ValidValue.Valid;
|
||||
public ValidValue LocationFormattedAddress { get; set; } = ValidValue.Valid;
|
||||
public ValidValue LocationLatitude { get; set; } = ValidValue.Valid;
|
||||
public ValidValue LocationLongitude { get; set; } = ValidValue.Valid;
|
||||
public ValidValue LocationAltitude { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxItemAddress(SysId id, ItemId itemId, Sax.AddressType addressType) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
ItemId = itemId;
|
||||
AddressType = addressType;
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> validStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Active,
|
||||
SaStatus.Inactive,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(validStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
if (status == SaStatus.Active) return DataValue.TriStateType.Green;
|
||||
if (status == SaStatus.Inactive) return DataValue.TriStateType.Red;
|
||||
if (status == SaStatus.Deleted) return DataValue.TriStateType.Purple;
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
public ItemId GetItemId()
|
||||
{
|
||||
return new ItemId((short)Sax.DataItemType.ItemAddress, Id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
if (ItemId.IsValid(ItemId) && ItemId.Type != data.ItemId.Type && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
|
||||
throw new NotSupportedException(fn + " Item Id cannot be changed");
|
||||
if (SysId.IsValid(RegionIdProvince) && SysId.ToInt(RegionIdProvince) != SysId.ToInt(data.RegionIdProvince))
|
||||
throw new NotSupportedException(fn + " Address Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public ItemId ItemId
|
||||
{
|
||||
get { return data.ItemId; }
|
||||
protected set { data.ItemId = value; }
|
||||
}
|
||||
public Sax.AddressType AddressType
|
||||
{
|
||||
get { return data.AddressType; }
|
||||
set { data.AddressType = value; }
|
||||
}
|
||||
public String Caption
|
||||
{
|
||||
get { return data.Caption; }
|
||||
set { data.Caption = value; }
|
||||
}
|
||||
public String Line1
|
||||
{
|
||||
get { return data.Line1; }
|
||||
set { data.Line1 = value; }
|
||||
}
|
||||
public String Line2
|
||||
{
|
||||
get { return data.Line2; }
|
||||
set { data.Line2 = value; }
|
||||
}
|
||||
public String Line3
|
||||
{
|
||||
get { return data.Line3; }
|
||||
set { data.Line3 = value; }
|
||||
}
|
||||
public String Town
|
||||
{
|
||||
get { return data.Town; }
|
||||
set { data.Town = value; }
|
||||
}
|
||||
public String Province
|
||||
{
|
||||
get { return data.Province; }
|
||||
set { data.Province = value; }
|
||||
}
|
||||
public SysId RegionIdProvince
|
||||
{
|
||||
get { return data.RegionIdProvince; }
|
||||
set { data.RegionIdProvince = value; }
|
||||
}
|
||||
public String Country
|
||||
{
|
||||
get { return data.Country; }
|
||||
set { data.Country = value; }
|
||||
}
|
||||
public SysId RegionIdCountry
|
||||
{
|
||||
get { return data.RegionIdCountry; }
|
||||
set { data.RegionIdCountry = value; }
|
||||
}
|
||||
public String PostalCode
|
||||
{
|
||||
get { return data.PostalCode; }
|
||||
set { data.PostalCode = value; }
|
||||
}
|
||||
public String PhoneMain
|
||||
{
|
||||
get { return data.PhoneMain; }
|
||||
set { data.PhoneMain = value; }
|
||||
}
|
||||
|
||||
// Location.
|
||||
public String LocationSource
|
||||
{
|
||||
get { return data.LocationSource; }
|
||||
set { data.LocationSource = value; }
|
||||
}
|
||||
public DateTime LocationStoredAt
|
||||
{
|
||||
get { return data.LocationStoredAt; }
|
||||
set { data.LocationStoredAt = value; }
|
||||
}
|
||||
public bool LocationUpdateRequired
|
||||
{
|
||||
get { return data.LocationUpdateRequired; }
|
||||
set { data.LocationUpdateRequired = value; }
|
||||
}
|
||||
public String LocationData
|
||||
{
|
||||
get { return data.LocationData; }
|
||||
set { data.LocationData = value; }
|
||||
}
|
||||
public String LocationFormattedAddress
|
||||
{
|
||||
get { return data.LocationFormattedAddress; }
|
||||
set { data.LocationFormattedAddress = value; }
|
||||
}
|
||||
public Decimal LocationLatitude
|
||||
{
|
||||
get { return data.LocationLatitude; }
|
||||
set { data.LocationLatitude = value; }
|
||||
}
|
||||
public Decimal LocationLongitude
|
||||
{
|
||||
get { return data.LocationLongitude; }
|
||||
set { data.LocationLongitude = value; }
|
||||
}
|
||||
public Decimal LocationAltitude
|
||||
{
|
||||
get { return data.LocationAltitude; }
|
||||
set { data.LocationAltitude = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags - positions 1-16 available.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
/// </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public List<ItemId> ItemIdsIncluded { get; } = new List<ItemId>();
|
||||
public String AddressPartial { get; set; }
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxItemAddressList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -155,7 +155,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
{
|
||||
if (!ReferenceMgr.SportExistsById(data.SportIdPrimary))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
errField.SportIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid sport specified");
|
||||
}
|
||||
}
|
||||
@@ -163,11 +163,34 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
// Region.
|
||||
if (errField.RegionIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.RegionIdPrimary))
|
||||
{
|
||||
if (!ReferenceMgr.RegionExistsById(data.RegionIdPrimary))
|
||||
SaxRegion region = ReferenceMgr.GetRegionById(data.RegionIdPrimary);
|
||||
if (region == null)
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
errField.RegionIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid region specified");
|
||||
}
|
||||
if (region.RegionType != App.Sax.RegionType.Country)
|
||||
{
|
||||
errField.RegionIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Region must be a country");
|
||||
}
|
||||
}
|
||||
|
||||
// Region & name must be unique.
|
||||
if (errField.Name != SacsHierarchyItem.ValidValue.Ignore && !StringUtil.IsEmpty(data.Name) && errField.RegionIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.RegionIdPrimary))
|
||||
{
|
||||
// Name must be unique within region.
|
||||
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||
if (SysId.IsValid(data.Id))
|
||||
prmOrganisation.IdsExcluded.Add(data.Id);
|
||||
prmOrganisation.NameFull = data.Name;
|
||||
prmOrganisation.RegionIdsIncluded.Add(data.RegionIdPrimary);
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.Any;
|
||||
if (AccountMgr.GetOrganisationCount(prmOrganisation) > 0)
|
||||
{
|
||||
errField.Name = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Name must be unique within region");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,259 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxItemDataMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// Item Data Mgr - Item Address
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxItemAddress CreateItemAddress(ItemId itemId, Sax.AddressType addressType);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool ItemAddressExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxItemAddress.Params prmItemAddress = new SaxItemAddress.Params();
|
||||
prmItemAddress.IdsIncluded.Add(id);
|
||||
prmItemAddress.StatusCat = SaxItemAddress.StatusCat.Any;
|
||||
return GetItemAddressCount(prmItemAddress) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxItemAddress GetItemAddress(SaxItemAddress.Params prmItemAddress);
|
||||
public SaxItemAddress GetItemAddressById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxItemAddress.Params prmItemAddress = new SaxItemAddress.Params();
|
||||
prmItemAddress.IdsIncluded.Add(id);
|
||||
prmItemAddress.StatusCat = SaxItemAddress.StatusCat.Any;
|
||||
return GetItemAddress(prmItemAddress);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidItemAddress(SaxItemAddress itemAddress)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (itemAddress == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidItemAddressData(itemAddress.GetData(), new SaxItemAddress.ErrField());
|
||||
}
|
||||
public virtual bool IsValidItemAddressData(SaxItemAddress.Data data, SaxItemAddress.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Item Id.
|
||||
if (errField.ItemId != SacsHierarchyItem.ValidValue.Ignore && !ItemId.IsValid(data.ItemId))
|
||||
{
|
||||
errField.ItemId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item Id must be specified");
|
||||
}
|
||||
// Address.
|
||||
if (errField.Caption != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Caption, "caption", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Caption)))
|
||||
{
|
||||
errField.Caption = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Line1 != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Line1, "line 1", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line1)))
|
||||
{
|
||||
errField.Line1 = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Line2 != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Line2, "line 2", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line2)))
|
||||
{
|
||||
errField.Line2 = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Line3 != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Line3, "line 3", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line3)))
|
||||
{
|
||||
errField.Line3 = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Town != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Town, "town", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town), true))
|
||||
{
|
||||
errField.Town = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.RegionIdProvince != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.RegionIdProvince))
|
||||
{
|
||||
// Province is not mandatory.
|
||||
}
|
||||
if (errField.Province != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Province, "province", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Province)))
|
||||
{
|
||||
errField.Province = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.RegionIdCountry != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.RegionIdCountry))
|
||||
{
|
||||
errField.RegionIdCountry = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Country region must be specified");
|
||||
}
|
||||
if (errField.Country != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Country, "country", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Country), true))
|
||||
{
|
||||
errField.Country = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.PostalCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PostalCode, "postal code", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_PostalCode)))
|
||||
{
|
||||
errField.PostalCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.PhoneMain != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PhoneMain, "country", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_PhoneMain)))
|
||||
{
|
||||
errField.PhoneMain = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Location.
|
||||
if (errField.LocationSource != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.LocationSource, "location source", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_LocationSource)))
|
||||
{
|
||||
errField.LocationSource = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.LocationData != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.LocationData, "location data", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_LocationData)))
|
||||
{
|
||||
errField.LocationData = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.LocationFormattedAddress != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.LocationFormattedAddress, "location source", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_LocationFormattedAddress)))
|
||||
{
|
||||
errField.LocationFormattedAddress = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(data.StatusCode, "status", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.ItemAddress_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxItemAddress.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Associated data.
|
||||
if (data.Status != SaStatus.Deleted)
|
||||
{
|
||||
// Item must exists.
|
||||
if (errField.ItemId != SacsHierarchyItem.ValidValue.Ignore && ItemId.IsValid(data.ItemId))
|
||||
{
|
||||
switch ((Sax.DataItemType)data.ItemId.Type)
|
||||
{
|
||||
case Sax.DataItemType.Organisation:
|
||||
if (!AccountMgr.OrganisationExistsById(data.ItemId.Id))
|
||||
return SetErrorState("Invalid organisation specified");
|
||||
break;
|
||||
default:
|
||||
return SetErrorState("Invalid Item Type specified");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertItemAddress(SaxItemAddress itemAddress, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateItemAddress(SaxItemAddress itemAddress, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool ItemAddressCanBeDeleted(SaxItemAddress itemAddress)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteItemAddress(SaxItemAddress itemAddress, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetItemAddressColumnDfn(SaxItemAddress.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetItemAddressQueryFilter(SaxItemAddress.Params prmItemAddress);
|
||||
public abstract long GetItemAddressCount(SaxItemAddress.Params prmItemAddress);
|
||||
public abstract List<SaxItemAddress> GetItemAddressList(SaxItemAddress.Params prmItemAddress);
|
||||
public abstract DbResultSet ExecuteItemAddressQuery(List<ColumnDfn> columns, SaxItemAddress.Params prmItemAddress);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Extract and format result set data value where specific handling is required.
|
||||
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
|
||||
/// </summary>
|
||||
public virtual DataValue GetItemAddressDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxItemAddress.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Data item type.
|
||||
case SaxItemAddress.Column.ItemType_Code:
|
||||
{
|
||||
value = new DataValue(DataItemTypeCodes.GetCodeForType(values.GetLong(column.DataName)));
|
||||
}
|
||||
break;
|
||||
case SaxItemAddress.Column.ItemType_Desc:
|
||||
{
|
||||
value = new DataValue(DataItemTypeCodes.GetDescForType(values.GetLong(column.DataName)));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Notes.
|
||||
case SaxItemAddress.Column.Notes:
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxItemAddress.Column.Status_Desc:
|
||||
case SaxItemAddress.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxItemAddress.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxItemAddress.Column.Status_Ind)
|
||||
value = new DataValue(SaxItemAddress.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -74,6 +74,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
public List<TypeCodeDesc> OrganisationTypeCodes { get { return Internals.OrganisationTypeCodes; } }
|
||||
public List<TypeCodeDesc> OrganisationCategoryCodes { get { return Internals.OrganisationCategoryCodes; } }
|
||||
public List<TypeCodeDesc> OrganisationRoleCodes { get { return Internals.OrganisationRoleCodes; } }
|
||||
public List<TypeCodeDesc> AddressTypeCodes { get { return Internals.AddressTypeCodes; } }
|
||||
public List<TypeCodeDesc> OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } }
|
||||
public List<TypeCodeDesc> ActivityReactionCodes { get { return Internals.ActivityReactionCodes; } }
|
||||
|
||||
|
||||
@@ -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 SaxItemAddress_Dbas : SaxItemAddress
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private ISacsDatabase database;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SaxItemAddress_Dbas(ISacsDatabase database, SysId id, ItemId itemId, Sax.AddressType addressType, UInt16 flags) :
|
||||
base(id, itemId, addressType)
|
||||
{
|
||||
this.database = database;
|
||||
Flags = flags;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Associated data.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -0,0 +1,332 @@
|
||||
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 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
internal class ItemAddress_Db : SaxDbDataItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Column definitions.
|
||||
public class ColumnsData
|
||||
{
|
||||
public ColumnDataInt64 _Id { get; } = new ColumnDataInt64("Id", true);
|
||||
public ColumnDataInt16 _ItemType { get; } = new ColumnDataInt16("ItemType");
|
||||
public ColumnDataInt32 _ItemId { get; } = new ColumnDataInt32("ItemId");
|
||||
public ColumnDataInt16 _AddressType { get; } = new ColumnDataInt16("AddressType");
|
||||
public ColumnDataString _Caption { get; } = new ColumnDataString("Caption");
|
||||
public ColumnDataString _Line1 { get; } = new ColumnDataString("Line1");
|
||||
public ColumnDataString _Line2 { get; } = new ColumnDataString("Line2");
|
||||
public ColumnDataString _Line3 { get; } = new ColumnDataString("Line3");
|
||||
public ColumnDataString _Town { get; } = new ColumnDataString("Town");
|
||||
public ColumnDataString _Province { get; } = new ColumnDataString("Province");
|
||||
public ColumnDataInt32 _RegionIdProvince { get; } = new ColumnDataInt32("RegionIdProvince");
|
||||
public ColumnDataString _Country { get; } = new ColumnDataString("Country");
|
||||
public ColumnDataInt32 _RegionIdCountry { get; } = new ColumnDataInt32("RegionIdCountry");
|
||||
public ColumnDataString _PostalCode { get; } = new ColumnDataString("PostalCode");
|
||||
public ColumnDataString _PhoneMain { get; } = new ColumnDataString("PhoneMain");
|
||||
public ColumnDataString _LocationSource { get; } = new ColumnDataString("LocationSource");
|
||||
public ColumnDataDateTime _LocationStoredAt { get; } = new ColumnDataDateTime("LocationStoredAt");
|
||||
public ColumnDataBoolean _LocationUpdateRequired { get; } = new ColumnDataBoolean("LocationUpdateRequired");
|
||||
public ColumnDataString _LocationData { get; } = new ColumnDataString("LocationData");
|
||||
public ColumnDataString _LocationFormattedAddress { get; } = new ColumnDataString("LocationFormattedAddress");
|
||||
public ColumnDataDecimal _LocationLatitude { get; } = new ColumnDataDecimal("LocationLatitude");
|
||||
public ColumnDataDecimal _LocationLongitude { get; } = new ColumnDataDecimal("LocationLongitude");
|
||||
public ColumnDataDecimal _LocationAltitude { get; } = new ColumnDataDecimal("LocationAltitude");
|
||||
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",
|
||||
"ItemType",
|
||||
"ItemId",
|
||||
"AddressType",
|
||||
"Caption",
|
||||
"Line1",
|
||||
"Line2",
|
||||
"Line3",
|
||||
"Town",
|
||||
"Province",
|
||||
"RegionIdProvince",
|
||||
"Country",
|
||||
"RegionIdCountry",
|
||||
"PostalCode",
|
||||
"PhoneMain",
|
||||
"LocationSource",
|
||||
"LocationStoredAt",
|
||||
"LocationUpdateRequired",
|
||||
"LocationData",
|
||||
"LocationFormattedAddress",
|
||||
"LocationLatitude",
|
||||
"LocationLongitude",
|
||||
"LocationAltitude",
|
||||
"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 ItemAddress_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public override String SchemaName { get; } = "dbo";
|
||||
public override String TableName { get; } = "ItemAddress";
|
||||
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 _ItemType { get { return Cols._ItemType.Value; } set { Cols._ItemType.Value = value; } }
|
||||
public Int32 _ItemId { get { return Cols._ItemId.Value; } set { Cols._ItemId.Value = value; } }
|
||||
public Int16 _AddressType { get { return Cols._AddressType.Value; } set { Cols._AddressType.Value = value; } }
|
||||
public String _Caption { get { return Cols._Caption.Value; } set { Cols._Caption.Value = value; } }
|
||||
public String _Line1 { get { return Cols._Line1.Value; } set { Cols._Line1.Value = value; } }
|
||||
public String _Line2 { get { return Cols._Line2.Value; } set { Cols._Line2.Value = value; } }
|
||||
public String _Line3 { get { return Cols._Line3.Value; } set { Cols._Line3.Value = value; } }
|
||||
public String _Town { get { return Cols._Town.Value; } set { Cols._Town.Value = value; } }
|
||||
public String _Province { get { return Cols._Province.Value; } set { Cols._Province.Value = value; } }
|
||||
public Int32 _RegionIdProvince { get { return Cols._RegionIdProvince.Value; } set { Cols._RegionIdProvince.Value = value; } }
|
||||
public String _Country { get { return Cols._Country.Value; } set { Cols._Country.Value = value; } }
|
||||
public Int32 _RegionIdCountry { get { return Cols._RegionIdCountry.Value; } set { Cols._RegionIdCountry.Value = value; } }
|
||||
public String _PostalCode { get { return Cols._PostalCode.Value; } set { Cols._PostalCode.Value = value; } }
|
||||
public String _PhoneMain { get { return Cols._PhoneMain.Value; } set { Cols._PhoneMain.Value = value; } }
|
||||
public String _LocationSource { get { return Cols._LocationSource.Value; } set { Cols._LocationSource.Value = value; } }
|
||||
public DateTime _LocationStoredAt { get { return Cols._LocationStoredAt.Value; } set { Cols._LocationStoredAt.Value = value; } }
|
||||
public Boolean _LocationUpdateRequired { get { return Cols._LocationUpdateRequired.Value; } set { Cols._LocationUpdateRequired.Value = value; } }
|
||||
public String _LocationData { get { return Cols._LocationData.Value; } set { Cols._LocationData.Value = value; } }
|
||||
public String _LocationFormattedAddress { get { return Cols._LocationFormattedAddress.Value; } set { Cols._LocationFormattedAddress.Value = value; } }
|
||||
public Decimal _LocationLatitude { get { return Cols._LocationLatitude.Value; } set { Cols._LocationLatitude.Value = value; } }
|
||||
public Decimal _LocationLongitude { get { return Cols._LocationLongitude.Value; } set { Cols._LocationLongitude.Value = value; } }
|
||||
public Decimal _LocationAltitude { get { return Cols._LocationAltitude.Value; } set { Cols._LocationAltitude.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);
|
||||
_ItemType = GetFieldInt16(dbDataReader, "ItemType", _ItemType);
|
||||
_ItemId = GetFieldInt32(dbDataReader, "ItemId", _ItemId);
|
||||
_AddressType = GetFieldInt16(dbDataReader, "AddressType", _AddressType);
|
||||
_Caption = GetFieldString(dbDataReader, "Caption", _Caption);
|
||||
_Line1 = GetFieldString(dbDataReader, "Line1", _Line1);
|
||||
_Line2 = GetFieldString(dbDataReader, "Line2", _Line2);
|
||||
_Line3 = GetFieldString(dbDataReader, "Line3", _Line3);
|
||||
_Town = GetFieldString(dbDataReader, "Town", _Town);
|
||||
_Province = GetFieldString(dbDataReader, "Province", _Province);
|
||||
_RegionIdProvince = GetFieldInt32(dbDataReader, "RegionIdProvince", _RegionIdProvince);
|
||||
_Country = GetFieldString(dbDataReader, "Country", _Country);
|
||||
_RegionIdCountry = GetFieldInt32(dbDataReader, "RegionIdCountry", _RegionIdCountry);
|
||||
_PostalCode = GetFieldString(dbDataReader, "PostalCode", _PostalCode);
|
||||
_PhoneMain = GetFieldString(dbDataReader, "PhoneMain", _PhoneMain);
|
||||
_LocationSource = GetFieldString(dbDataReader, "LocationSource", _LocationSource);
|
||||
_LocationStoredAt = GetFieldDateTime(dbDataReader, "LocationStoredAt", _LocationStoredAt);
|
||||
_LocationUpdateRequired = GetFieldBoolean(dbDataReader, "LocationUpdateRequired", _LocationUpdateRequired);
|
||||
_LocationData = GetFieldString(dbDataReader, "LocationData", _LocationData);
|
||||
_LocationFormattedAddress = GetFieldString(dbDataReader, "LocationFormattedAddress", _LocationFormattedAddress);
|
||||
_LocationLatitude = GetFieldDecimal(dbDataReader, "LocationLatitude", _LocationLatitude);
|
||||
_LocationLongitude = GetFieldDecimal(dbDataReader, "LocationLongitude", _LocationLongitude);
|
||||
_LocationAltitude = GetFieldDecimal(dbDataReader, "LocationAltitude", _LocationAltitude);
|
||||
_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("ItemType")) AddCommandParameter(dbCommand, "@ItemType", _ItemType);
|
||||
if (columnNames.ContainsCI("ItemId")) AddCommandParameter(dbCommand, "@ItemId", _ItemId);
|
||||
if (columnNames.ContainsCI("AddressType")) AddCommandParameter(dbCommand, "@AddressType", _AddressType);
|
||||
if (columnNames.ContainsCI("Caption")) AddCommandParameter(dbCommand, "@Caption", _Caption);
|
||||
if (columnNames.ContainsCI("Line1")) AddCommandParameter(dbCommand, "@Line1", _Line1);
|
||||
if (columnNames.ContainsCI("Line2")) AddCommandParameter(dbCommand, "@Line2", _Line2);
|
||||
if (columnNames.ContainsCI("Line3")) AddCommandParameter(dbCommand, "@Line3", _Line3);
|
||||
if (columnNames.ContainsCI("Town")) AddCommandParameter(dbCommand, "@Town", _Town);
|
||||
if (columnNames.ContainsCI("Province")) AddCommandParameter(dbCommand, "@Province", _Province);
|
||||
if (columnNames.ContainsCI("RegionIdProvince")) AddCommandParameter(dbCommand, "@RegionIdProvince", _RegionIdProvince);
|
||||
if (columnNames.ContainsCI("Country")) AddCommandParameter(dbCommand, "@Country", _Country);
|
||||
if (columnNames.ContainsCI("RegionIdCountry")) AddCommandParameter(dbCommand, "@RegionIdCountry", _RegionIdCountry);
|
||||
if (columnNames.ContainsCI("PostalCode")) AddCommandParameter(dbCommand, "@PostalCode", _PostalCode);
|
||||
if (columnNames.ContainsCI("PhoneMain")) AddCommandParameter(dbCommand, "@PhoneMain", _PhoneMain);
|
||||
if (columnNames.ContainsCI("LocationSource")) AddCommandParameter(dbCommand, "@LocationSource", _LocationSource);
|
||||
if (columnNames.ContainsCI("LocationStoredAt")) AddCommandParameter(dbCommand, "@LocationStoredAt", _LocationStoredAt);
|
||||
if (columnNames.ContainsCI("LocationUpdateRequired")) AddCommandParameter(dbCommand, "@LocationUpdateRequired", _LocationUpdateRequired);
|
||||
if (columnNames.ContainsCI("LocationData")) AddCommandParameter(dbCommand, "@LocationData", _LocationData);
|
||||
if (columnNames.ContainsCI("LocationFormattedAddress")) AddCommandParameter(dbCommand, "@LocationFormattedAddress", _LocationFormattedAddress);
|
||||
if (columnNames.ContainsCI("LocationLatitude")) AddCommandParameter(dbCommand, "@LocationLatitude", _LocationLatitude);
|
||||
if (columnNames.ContainsCI("LocationLongitude")) AddCommandParameter(dbCommand, "@LocationLongitude", _LocationLongitude);
|
||||
if (columnNames.ContainsCI("LocationAltitude")) AddCommandParameter(dbCommand, "@LocationAltitude", _LocationAltitude);
|
||||
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("ItemType")) AddCommandParameter(dbCommand, "@ItemType", _ItemType);
|
||||
if (columnNames.ContainsCI("ItemId")) AddCommandParameter(dbCommand, "@ItemId", _ItemId);
|
||||
if (columnNames.ContainsCI("AddressType")) AddCommandParameter(dbCommand, "@AddressType", _AddressType);
|
||||
if (columnNames.ContainsCI("Caption")) AddCommandParameter(dbCommand, "@Caption", _Caption);
|
||||
if (columnNames.ContainsCI("Line1")) AddCommandParameter(dbCommand, "@Line1", _Line1);
|
||||
if (columnNames.ContainsCI("Line2")) AddCommandParameter(dbCommand, "@Line2", _Line2);
|
||||
if (columnNames.ContainsCI("Line3")) AddCommandParameter(dbCommand, "@Line3", _Line3);
|
||||
if (columnNames.ContainsCI("Town")) AddCommandParameter(dbCommand, "@Town", _Town);
|
||||
if (columnNames.ContainsCI("Province")) AddCommandParameter(dbCommand, "@Province", _Province);
|
||||
if (columnNames.ContainsCI("RegionIdProvince")) AddCommandParameter(dbCommand, "@RegionIdProvince", _RegionIdProvince);
|
||||
if (columnNames.ContainsCI("Country")) AddCommandParameter(dbCommand, "@Country", _Country);
|
||||
if (columnNames.ContainsCI("RegionIdCountry")) AddCommandParameter(dbCommand, "@RegionIdCountry", _RegionIdCountry);
|
||||
if (columnNames.ContainsCI("PostalCode")) AddCommandParameter(dbCommand, "@PostalCode", _PostalCode);
|
||||
if (columnNames.ContainsCI("PhoneMain")) AddCommandParameter(dbCommand, "@PhoneMain", _PhoneMain);
|
||||
if (columnNames.ContainsCI("LocationSource")) AddCommandParameter(dbCommand, "@LocationSource", _LocationSource);
|
||||
if (columnNames.ContainsCI("LocationStoredAt")) AddCommandParameter(dbCommand, "@LocationStoredAt", _LocationStoredAt);
|
||||
if (columnNames.ContainsCI("LocationUpdateRequired")) AddCommandParameter(dbCommand, "@LocationUpdateRequired", _LocationUpdateRequired);
|
||||
if (columnNames.ContainsCI("LocationData")) AddCommandParameter(dbCommand, "@LocationData", _LocationData);
|
||||
if (columnNames.ContainsCI("LocationFormattedAddress")) AddCommandParameter(dbCommand, "@LocationFormattedAddress", _LocationFormattedAddress);
|
||||
if (columnNames.ContainsCI("LocationLatitude")) AddCommandParameter(dbCommand, "@LocationLatitude", _LocationLatitude);
|
||||
if (columnNames.ContainsCI("LocationLongitude")) AddCommandParameter(dbCommand, "@LocationLongitude", _LocationLongitude);
|
||||
if (columnNames.ContainsCI("LocationAltitude")) AddCommandParameter(dbCommand, "@LocationAltitude", _LocationAltitude);
|
||||
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 Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 22-Jun-2021 08:56:11
|
||||
// Code generated by Sarand Database Utilities Fri 2-Jul-2021 07:46:23
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -0,0 +1,598 @@
|
||||
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;
|
||||
|
||||
namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxItemDataMgr_Dbas
|
||||
{
|
||||
//*******************************************************************
|
||||
// Item Data Mgr - Item Address
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
private List<StringPair> GetLogProperties(SaxItemAddress itemAddress)
|
||||
{
|
||||
return new List<StringPair>()
|
||||
{
|
||||
new StringPair("Id",SysId.ToString(itemAddress.Id)),
|
||||
new StringPair("ItemId", (Sax.DataItemType)itemAddress.ItemId.Type + ": " + itemAddress.ItemId.Id),
|
||||
new StringPair("Town",itemAddress.Town),
|
||||
new StringPair("PostalCode",itemAddress.PostalCode),
|
||||
new StringPair("Status",itemAddress.StatusCode)
|
||||
};
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public override SaxItemAddress CreateItemAddress(ItemId itemId, Sax.AddressType addressType)
|
||||
{
|
||||
ClearErrorState();
|
||||
return new SaxItemAddress_Dbas(CoreDatabase, null, itemId, addressType, 0);
|
||||
}
|
||||
private SaxItemAddress_Dbas CreateItemAddress(ItemAddress_Db dbItemAddress)
|
||||
{
|
||||
ClearErrorState();
|
||||
ItemId itemId = new ItemId(dbItemAddress._ItemType, new SysId(dbItemAddress._ItemId));
|
||||
SaxItemAddress_Dbas itemAddress = new SaxItemAddress_Dbas(CoreDatabase, new SysId(dbItemAddress._Id), itemId, (Sax.AddressType)dbItemAddress._AddressType, (ushort)dbItemAddress._Flags);
|
||||
PopulateFrom(dbItemAddress, itemAddress);
|
||||
return itemAddress;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get item.
|
||||
public override SaxItemAddress GetItemAddress(SaxItemAddress.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetItemAddress(GetItemAddressQueryFilter(prm).Concat(" And ", "(", ")"));
|
||||
}
|
||||
private SaxItemAddress GetItemAddress(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
long count = GetItemAddressCount(filter);
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple items found");
|
||||
return null;
|
||||
}
|
||||
SaxItemAddress itemAddress = null;
|
||||
// Query data.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
ItemAddress_Db dbItemAddress = new ItemAddress_Db(CoreDbInfo);
|
||||
dbItemAddress.PopulateFrom(dbCommand, aliasItemAddress, filter);
|
||||
itemAddress = CreateItemAddress(dbItemAddress);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SaLogger.Warn(GetType().Name + ".GetItemAddress\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
}
|
||||
return itemAddress;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item.
|
||||
public override bool IsValidItemAddressData(SaxItemAddress.Data data, SaxItemAddress.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.IsValidItemAddressData(data, errField)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert item.
|
||||
public override bool InsertItemAddress(SaxItemAddress itemAddress, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertItemAddress";
|
||||
ClearErrorState();
|
||||
if (!IsValidItemAddress(itemAddress)) return false;
|
||||
if (SysId.IsValid(itemAddress.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
ItemAddress_Db dbItemAddress = new ItemAddress_Db(CoreDbInfo);
|
||||
PopulateTo(dbItemAddress, itemAddress, dbUpdateInfo);
|
||||
if (ItemAddress_Db.FieldsNonId.Contains("Id"))
|
||||
{
|
||||
// Generate next Id.
|
||||
dbItemAddress._Id = CoreDatabase.GetNextIdFromTable("ItemAddress");
|
||||
}
|
||||
dbItemAddress.ExecuteInsertCommand(dbCommand);
|
||||
itemAddress.Id = new SysId(dbItemAddress._Id);
|
||||
itemAddress.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(itemAddress).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update item.
|
||||
public override bool UpdateItemAddress(SaxItemAddress itemAddress, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateItemAddress";
|
||||
ClearErrorState();
|
||||
if (!IsValidItemAddress(itemAddress)) return false;
|
||||
if (!SysId.IsValid(itemAddress.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!itemAddress.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(itemAddress).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
ItemAddress_Db dbItemAddress = new ItemAddress_Db(CoreDbInfo);
|
||||
dbItemAddress.PopulateFrom(dbCommand, aliasItemAddress, "Id=" + SysId.ToString(itemAddress.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_ItemAddress updateLogMonitor = new SaxUpdateLogItemMonitor_ItemAddress(SessionContext, CreateItemAddress(dbItemAddress), dbUpdateInfo);
|
||||
// Update properties.
|
||||
PopulateTo(dbItemAddress, itemAddress, dbUpdateInfo);
|
||||
dbItemAddress.ExecuteUpdateCommand(dbCommand);
|
||||
itemAddress.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(itemAddress).Concat(": ").Concat("", "\n\t"));
|
||||
// Record updates.
|
||||
// ToDo updateLogMonitor.RecordUpdatedValues(itemAddress);
|
||||
// ToDo updateLogMonitor.LogUpdates();
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Delete item.
|
||||
public override bool ItemAddressCanBeDeleted(SaxItemAddress itemAddress)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.ItemAddressCanBeDeleted(itemAddress)) return false;
|
||||
return true;
|
||||
}
|
||||
public override bool DeleteItemAddress(SaxItemAddress itemAddress, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteItemAddress";
|
||||
ClearErrorState();
|
||||
if (!ItemAddressCanBeDeleted(itemAddress)) return false;
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve itemAddress.
|
||||
dbConnection.Open();
|
||||
ItemAddress_Db dbItemAddress = new ItemAddress_Db(CoreDbInfo);
|
||||
dbItemAddress.PopulateFrom(dbCommand, aliasItemAddress, "Id=" + itemAddress.Id.ToString());
|
||||
// Delete itemAddress.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemAddress) + " WHERE Id=" + SysId.ToString(itemAddress.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
itemAddress.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(itemAddress).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from database.
|
||||
private void PopulateTo(ItemAddress_Db dbItemAddress, SaxItemAddress itemAddress, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
dbItemAddress._Id = SysId.ToLong(itemAddress.Id);
|
||||
dbItemAddress._ItemType = itemAddress.ItemId.Type;
|
||||
dbItemAddress._ItemId = SysId.ToInt(itemAddress.ItemId.Id);
|
||||
dbItemAddress._AddressType = (short)itemAddress.AddressType;
|
||||
dbItemAddress._Caption = itemAddress.Caption;
|
||||
dbItemAddress._Line1 = itemAddress.Line1;
|
||||
dbItemAddress._Line2 = itemAddress.Line2;
|
||||
dbItemAddress._Line3 = itemAddress.Line3;
|
||||
dbItemAddress._Town = itemAddress.Town;
|
||||
dbItemAddress._Province = itemAddress.Province;
|
||||
dbItemAddress._RegionIdProvince = SysId.ToInt(itemAddress.RegionIdProvince);
|
||||
dbItemAddress._Country = itemAddress.Country;
|
||||
dbItemAddress._RegionIdCountry = SysId.ToInt(itemAddress.RegionIdCountry);
|
||||
// Location.
|
||||
dbItemAddress._LocationSource = itemAddress.LocationSource;
|
||||
dbItemAddress._LocationStoredAt = itemAddress.LocationStoredAt;
|
||||
dbItemAddress._LocationUpdateRequired = itemAddress.LocationUpdateRequired;
|
||||
dbItemAddress._LocationData = itemAddress.LocationData;
|
||||
dbItemAddress._LocationFormattedAddress = itemAddress.LocationFormattedAddress;
|
||||
dbItemAddress._LocationLatitude = itemAddress.LocationLatitude;
|
||||
dbItemAddress._LocationLongitude = itemAddress.LocationLongitude;
|
||||
dbItemAddress._LocationAltitude = itemAddress.LocationAltitude;
|
||||
// Common.
|
||||
dbItemAddress._Notes = itemAddress.Notes;
|
||||
dbItemAddress._Status = SacsSystem.GetStatusCode(itemAddress.Status);
|
||||
dbItemAddress._Flags = (short)itemAddress.Flags;
|
||||
if (!SysId.IsValid(itemAddress.Id))
|
||||
{
|
||||
dbItemAddress._CreateOn = DateTime.Now;
|
||||
dbItemAddress._CreateBy = dbUpdateInfo.UserId.ToInt();
|
||||
dbItemAddress._CreateHost = dbUpdateInfo.Host;
|
||||
}
|
||||
dbItemAddress._UpdateOn = DateTime.Now;
|
||||
dbItemAddress._UpdateBy = dbUpdateInfo.UserId.ToInt();
|
||||
dbItemAddress._UpdateHost = dbUpdateInfo.Host;
|
||||
}
|
||||
private void PopulateFrom(ItemAddress_Db dbItemAddress, SaxItemAddress itemAddress)
|
||||
{
|
||||
//itemAddress.Id = new SysId(dbItemAddress._Id);
|
||||
//itemAddress.ItemId = new ItemId(dbItemAddress._ItemType, new SysId(dbItemAddress._ItemId));
|
||||
itemAddress.AddressType = (Sax.AddressType)dbItemAddress._AddressType;
|
||||
itemAddress.Caption = dbItemAddress._Caption;
|
||||
itemAddress.Line1 = dbItemAddress._Line1;
|
||||
itemAddress.Line2 = dbItemAddress._Line2;
|
||||
itemAddress.Line3 = dbItemAddress._Line3;
|
||||
itemAddress.Town = dbItemAddress._Town;
|
||||
itemAddress.Province = dbItemAddress._Province;
|
||||
itemAddress.RegionIdProvince = new SysId(dbItemAddress._RegionIdProvince);
|
||||
itemAddress.Country = dbItemAddress._Country;
|
||||
itemAddress.RegionIdCountry = new SysId(dbItemAddress._RegionIdCountry);
|
||||
// Location.
|
||||
itemAddress.LocationSource = dbItemAddress._LocationSource;
|
||||
itemAddress.LocationStoredAt = dbItemAddress._LocationStoredAt;
|
||||
itemAddress.LocationUpdateRequired = dbItemAddress._LocationUpdateRequired;
|
||||
itemAddress.LocationData = dbItemAddress._LocationData;
|
||||
itemAddress.LocationFormattedAddress = dbItemAddress._LocationFormattedAddress;
|
||||
itemAddress.LocationLatitude = dbItemAddress._LocationLatitude;
|
||||
itemAddress.LocationLongitude = dbItemAddress._LocationLongitude;
|
||||
itemAddress.LocationAltitude = dbItemAddress._LocationAltitude;
|
||||
// Common.
|
||||
itemAddress.Notes = dbItemAddress._Notes;
|
||||
itemAddress.Status = SacsSystem.GetStatusForCode(dbItemAddress._Status);
|
||||
itemAddress.SetCreateStamp(dbItemAddress._CreateOn, new SysId(dbItemAddress._CreateBy), dbItemAddress._CreateHost);
|
||||
itemAddress.SetUpdateStamp(dbItemAddress._UpdateOn, new SysId(dbItemAddress._UpdateBy), dbItemAddress._UpdateHost);
|
||||
itemAddress.AcceptChanges();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item column definitions.
|
||||
private static readonly String aliasItemAddress = "ItmSpt";
|
||||
private void SetItemAddressColDfn
|
||||
(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.ItemAddress)
|
||||
alias = aliasItemAddress;
|
||||
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 GetItemAddressColumnDfn(SaxItemAddress.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||
switch (columnId)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
case SaxItemAddress.Column.Pos:
|
||||
SetItemAddressColDfn(columnDfn, "Pos", 60, SaxDbDfn_Core.ColumnIdx.Unknown, ColumnAlignment.Right);
|
||||
columnDfn.SortMode = ColumnDfn.ColumnSortMode.Off;
|
||||
columnDfn.ReadOnly = true;
|
||||
columnDfn.Resizable = false;
|
||||
break;
|
||||
case SaxItemAddress.Column.Id:
|
||||
SetItemAddressColDfn(columnDfn, "Id", 80, SaxDbDfn_Core.ColumnIdx.ItemAddress_Id, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.ItemType:
|
||||
SetItemAddressColDfn(columnDfn, "Item type", 80, SaxDbDfn_Core.ColumnIdx.ItemAddress_ItemType, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.ItemType_Code:
|
||||
SetItemAddressColDfn(columnDfn, "Item type", 80, SaxDbDfn_Core.ColumnIdx.ItemAddress_ItemType, ColumnAlignment.Center);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.ItemType_Desc:
|
||||
SetItemAddressColDfn(columnDfn, "Item type", 80, SaxDbDfn_Core.ColumnIdx.ItemAddress_ItemType, ColumnAlignment.Center);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.ItemId:
|
||||
SetItemAddressColDfn(columnDfn, "Item Id", 80, SaxDbDfn_Core.ColumnIdx.ItemAddress_ItemId, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Address properties.
|
||||
case SaxItemAddress.Column.Caption:
|
||||
SetItemAddressColDfn(columnDfn, "Caption", 120, SaxDbDfn_Core.ColumnIdx.ItemAddress_Caption, ColumnAlignment.Left, DataValue.DataType.String);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.Line1:
|
||||
SetItemAddressColDfn(columnDfn, "Line1", 120, SaxDbDfn_Core.ColumnIdx.ItemAddress_Line1, ColumnAlignment.Left, DataValue.DataType.String);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.Line2:
|
||||
SetItemAddressColDfn(columnDfn, "Line2", 120, SaxDbDfn_Core.ColumnIdx.ItemAddress_Line2, ColumnAlignment.Left, DataValue.DataType.String);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.Line3:
|
||||
SetItemAddressColDfn(columnDfn, "Line3", 120, SaxDbDfn_Core.ColumnIdx.ItemAddress_Line3, ColumnAlignment.Left, DataValue.DataType.String);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.Town:
|
||||
SetItemAddressColDfn(columnDfn, "Town", 100, SaxDbDfn_Core.ColumnIdx.ItemAddress_Town, ColumnAlignment.Left, DataValue.DataType.String);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.Province:
|
||||
SetItemAddressColDfn(columnDfn, "Province", 100, SaxDbDfn_Core.ColumnIdx.ItemAddress_Province, ColumnAlignment.Left, DataValue.DataType.String);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.Country:
|
||||
SetItemAddressColDfn(columnDfn, "Country", 100, SaxDbDfn_Core.ColumnIdx.ItemAddress_Country, ColumnAlignment.Left, DataValue.DataType.String);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.PostalCode:
|
||||
SetItemAddressColDfn(columnDfn, "PostalCode", 80, SaxDbDfn_Core.ColumnIdx.ItemAddress_PostalCode, ColumnAlignment.Left, DataValue.DataType.String);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.PhoneMain:
|
||||
SetItemAddressColDfn(columnDfn, "PhoneMain", 100, SaxDbDfn_Core.ColumnIdx.ItemAddress_PhoneMain, ColumnAlignment.Left, DataValue.DataType.String);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Location.
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Derived properties.
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Common properties.
|
||||
case SaxItemAddress.Column.Notes:
|
||||
SetItemAddressColDfn(columnDfn, "Notes", 240, SaxDbDfn_Core.ColumnIdx.ItemAddress_Notes);
|
||||
break;
|
||||
case SaxItemAddress.Column.Flags:
|
||||
SetItemAddressColDfn(columnDfn, "Flags", 60, SaxDbDfn_Core.ColumnIdx.ItemAddress_Flags, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
break;
|
||||
case SaxItemAddress.Column.Status:
|
||||
SetItemAddressColDfn(columnDfn, "Status", 80, SaxDbDfn_Core.ColumnIdx.ItemAddress_Status, ColumnAlignment.Center);
|
||||
break;
|
||||
case SaxItemAddress.Column.Status_Desc:
|
||||
SetItemAddressColDfn(columnDfn, "Status", 90, SaxDbDfn_Core.ColumnIdx.ItemAddress_Status, ColumnAlignment.Center);
|
||||
break;
|
||||
case SaxItemAddress.Column.Status_Ind:
|
||||
SetItemAddressColDfn(columnDfn, "Status", 80, SaxDbDfn_Core.ColumnIdx.ItemAddress_Status, ColumnAlignment.Center, DataValue.DataType.TriState);
|
||||
columnDfn.TriStateFormat = ColumnTriStateFormat.Lights;
|
||||
break;
|
||||
case SaxItemAddress.Column.CreateOn_Date:
|
||||
SetItemAddressColDfn(columnDfn, "Created", 80, SaxDbDfn_Core.ColumnIdx.ItemAddress_CreateOn, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxItemAddress.Column.UpdateOn_Date:
|
||||
SetItemAddressColDfn(columnDfn, "Updated", 80, SaxDbDfn_Core.ColumnIdx.ItemAddress_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> GetItemAddressQueryFilter(SaxItemAddress.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.ItemAddress_Id, aliasItemAddress) + " IN (" + idsIncluded + ")");
|
||||
String idsExcluded = prm.IdsExcluded.Concat(",");
|
||||
if (!idsExcluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Id, aliasItemAddress) + " NOT IN (" + idsExcluded + ")");
|
||||
|
||||
// Item Ids.
|
||||
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.ItemAddress_ItemType, aliasItemAddress) + "=" + itemId.Type +
|
||||
" AND " + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_ItemId, aliasItemAddress) + "=" + SysId.ToInt(itemId.Id);
|
||||
itemIdFilters.Add(itemIdFilter);
|
||||
}
|
||||
if (!itemIdFilters.IsEmpty())
|
||||
filter.Add(itemIdFilters.Concat(" OR ", "(", ")"));
|
||||
}
|
||||
|
||||
// Notes.
|
||||
if (!StringUtil.IsEmpty(prm.NotesPartial))
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Notes, aliasItemAddress) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxItemAddress.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Status, aliasItemAddress) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxItemAddress.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Status, aliasItemAddress) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetItemAddressSortColumns(SaxItemAddress.Params prm)
|
||||
{
|
||||
// Sort sequence:
|
||||
List<String> sortColumnNames = new List<String>();
|
||||
foreach (var columnDfn in prm.SortColumns)
|
||||
{
|
||||
// Need to ensure correct alias used for ItemAddress columns in case of conflict.
|
||||
String sortCol = String.Empty;
|
||||
if (SaxDbDfn_Core.GetTableForColumn((SaxDbDfn_Core.ColumnIdx)columnDfn.DbColumn) == SaxDbDfn_Core.TableIdx.ItemAddress)
|
||||
{
|
||||
sortCol = SaxDbDfn_Core.GetColumnNameQual((SaxDbDfn_Core.ColumnIdx)columnDfn.DbColumn, aliasItemAddress);
|
||||
}
|
||||
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.ItemAddress_Id, aliasItemAddress) + " ASC");
|
||||
}
|
||||
return sortColumnNames;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item count.
|
||||
private long GetItemAddressCount(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
return CoreDatabase.GetRowCount(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemAddress) + " As " + aliasItemAddress, filter);
|
||||
}
|
||||
public override long GetItemAddressCount(SaxItemAddress.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetItemAddressCount(GetItemAddressQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public override List<SaxItemAddress> GetItemAddressList(SaxItemAddress.Params prm)
|
||||
{
|
||||
List<SaxItemAddress> itemAddresss = new List<SaxItemAddress>();
|
||||
DbQuery qry = new DbQuery(CoreDatabase.DbmsType);
|
||||
qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemAddress), aliasItemAddress);
|
||||
ItemAddress_Db dbItemAddress = new ItemAddress_Db(CoreDbInfo);
|
||||
qry.Columns.AddRange(dbItemAddress.ExistingColumnNames);
|
||||
qry.Filters.AddRange(GetItemAddressQueryFilter(prm));
|
||||
qry.OrderBy.AddRange(GetItemAddressSortColumns(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())
|
||||
{
|
||||
dbItemAddress = new ItemAddress_Db(CoreDbInfo);
|
||||
dbItemAddress.PopulateFrom(dbDataReader);
|
||||
itemAddresss.Add(CreateItemAddress(dbItemAddress));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(GetType().Name + ".GetItemAddressList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
}
|
||||
return itemAddresss;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item query execution.
|
||||
public override DbResultSet ExecuteItemAddressQuery(List<ColumnDfn> columns, SaxItemAddress.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Construct query.
|
||||
DbQuery query = new DbQuery(CoreDatabase.DbmsType);
|
||||
query.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemAddress), aliasItemAddress);
|
||||
|
||||
// Add columns as defined in query list.
|
||||
if (columns.HasId(SaxItemAddress.Column.Id))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Id, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.ItemType) || columns.HasId(SaxItemAddress.Column.ItemType_Code) || columns.HasId(SaxItemAddress.Column.ItemType_Desc))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_ItemType, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.ItemId))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_ItemId, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.AddressType) || columns.HasId(SaxItemAddress.Column.AddressType_Code) || columns.HasId(SaxItemAddress.Column.AddressType_Desc))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_AddressType, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.Caption))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Caption, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.Line1))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line1, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.Line2))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line2, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.Line3))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line3, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.Town))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.Province))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Province, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.Country))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Country, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.PostalCode))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_PostalCode, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.PhoneMain))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_PhoneMain, aliasItemAddress));
|
||||
// ToDo Address Location columns.
|
||||
// Common properties.
|
||||
if (columns.HasId(SaxItemAddress.Column.Notes))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Notes, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.Flags))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Flags, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.Status) || columns.HasId(SaxItemAddress.Column.Status_Desc) || columns.HasId(SaxItemAddress.Column.Status_Ind))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Status, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.CreateOn_Date))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_CreateOn, aliasItemAddress));
|
||||
if (columns.HasId(SaxItemAddress.Column.UpdateOn_Date))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_UpdateOn, aliasItemAddress));
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Populate filter.
|
||||
query.Filters.AddRange(GetItemAddressQueryFilter(prm));
|
||||
|
||||
if (prm.IdsIncluded.Count != 1)
|
||||
{
|
||||
// Configure sort sequence.
|
||||
foreach (String sortColumn in GetItemAddressSortColumns(prm))
|
||||
query.OrderBy.Add(sortColumn);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
//return new DbResultSet_DataTableReader(db, query.BuildQuery(prm.ResultsPaging));
|
||||
return DbResultSet_DataReader.ExecuteQuery(CoreDatabase, query.BuildQuery(prm.ResultsPaging));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -256,7 +256,7 @@
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>10</UniqueValues>
|
||||
<UniqueValues>6</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
@@ -343,6 +343,604 @@
|
||||
</DbDfnIndex>
|
||||
</Indices>
|
||||
</DbDfnTable>
|
||||
<DbDfnTable>
|
||||
<Schema>dbo</Schema>
|
||||
<Name>ItemAddress</Name>
|
||||
<Remarks />
|
||||
<Columns>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</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>ItemAddress</Table>
|
||||
<Pos>2</Pos>
|
||||
<Name>ItemType</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>ItemAddress</Table>
|
||||
<Pos>3</Pos>
|
||||
<Name>ItemId</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>ItemAddress</Table>
|
||||
<Pos>4</Pos>
|
||||
<Name>AddressType</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>ItemAddress</Table>
|
||||
<Pos>5</Pos>
|
||||
<Name>Caption</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>200</Size>
|
||||
<BufferLen>400</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>6</Pos>
|
||||
<Name>Line1</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>200</Size>
|
||||
<BufferLen>400</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>7</Pos>
|
||||
<Name>Line2</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>200</Size>
|
||||
<BufferLen>400</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>8</Pos>
|
||||
<Name>Line3</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>200</Size>
|
||||
<BufferLen>400</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>9</Pos>
|
||||
<Name>Town</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>100</Size>
|
||||
<BufferLen>200</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>10</Pos>
|
||||
<Name>Province</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>100</Size>
|
||||
<BufferLen>200</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>11</Pos>
|
||||
<Name>RegionIdProvince</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>ItemAddress</Table>
|
||||
<Pos>12</Pos>
|
||||
<Name>Country</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>100</Size>
|
||||
<BufferLen>200</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>13</Pos>
|
||||
<Name>RegionIdCountry</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>ItemAddress</Table>
|
||||
<Pos>14</Pos>
|
||||
<Name>PostalCode</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>32</Size>
|
||||
<BufferLen>64</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>15</Pos>
|
||||
<Name>PhoneMain</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>100</Size>
|
||||
<BufferLen>200</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>16</Pos>
|
||||
<Name>LocationSource</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>ItemAddress</Table>
|
||||
<Pos>17</Pos>
|
||||
<Name>LocationStoredAt</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>93</DataTypeNative>
|
||||
<DataTypeNameNative>smalldatetime</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>16</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>18</Pos>
|
||||
<Name>LocationUpdateRequired</Name>
|
||||
<DataType>Bit</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-7</DataTypeNative>
|
||||
<DataTypeNameNative>bit</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>1</Size>
|
||||
<BufferLen>1</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>19</Pos>
|
||||
<Name>LocationData</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>4000</Size>
|
||||
<BufferLen>8000</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>20</Pos>
|
||||
<Name>LocationFormattedAddress</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>4000</Size>
|
||||
<BufferLen>8000</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>21</Pos>
|
||||
<Name>LocationLatitude</Name>
|
||||
<DataType>Decimal</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>3</DataTypeNative>
|
||||
<DataTypeNameNative>decimal</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>9</Size>
|
||||
<BufferLen>11</BufferLen>
|
||||
<DecimalDigits>6</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>22</Pos>
|
||||
<Name>LocationLongitude</Name>
|
||||
<DataType>Decimal</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>3</DataTypeNative>
|
||||
<DataTypeNameNative>decimal</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>9</Size>
|
||||
<BufferLen>11</BufferLen>
|
||||
<DecimalDigits>6</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>23</Pos>
|
||||
<Name>LocationAltitude</Name>
|
||||
<DataType>Decimal</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>3</DataTypeNative>
|
||||
<DataTypeNameNative>decimal</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>9</Size>
|
||||
<BufferLen>11</BufferLen>
|
||||
<DecimalDigits>2</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>ItemAddress</Table>
|
||||
<Pos>24</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>ItemAddress</Table>
|
||||
<Pos>25</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>ItemAddress</Table>
|
||||
<Pos>26</Pos>
|
||||
<Name>Status</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>1</DataTypeNative>
|
||||
<DataTypeNameNative>char</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>ItemAddress</Table>
|
||||
<Pos>27</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>ItemAddress</Table>
|
||||
<Pos>28</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>ItemAddress</Table>
|
||||
<Pos>29</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>ItemAddress</Table>
|
||||
<Pos>30</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>ItemAddress</Table>
|
||||
<Pos>31</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>ItemAddress</Table>
|
||||
<Pos>32</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>ItemAddress</Table>
|
||||
<Name>PK_ItemAddress</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>ItemAddress</Table>
|
||||
<Name>IDX_ItemAddress_Item</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>ItemType</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>2</Seq>
|
||||
<Name>ItemId</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
</Columns>
|
||||
</DbDfnIndex>
|
||||
</Indices>
|
||||
</DbDfnTable>
|
||||
<DbDfnTable>
|
||||
<Schema>dbo</Schema>
|
||||
<Name>ItemImage</Name>
|
||||
@@ -734,7 +1332,7 @@
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>5</UniqueValues>
|
||||
<UniqueValues>7</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
@@ -1449,7 +2047,7 @@
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>7</UniqueValues>
|
||||
<UniqueValues>8</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
@@ -1844,6 +2442,31 @@
|
||||
</DbDfnIndexColumn>
|
||||
</Columns>
|
||||
</DbDfnIndex>
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
<Name>IDX_Organisation_Region_Name</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>Name</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>2</Seq>
|
||||
<Name>RegionIdPrimary</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
</Columns>
|
||||
</DbDfnIndex>
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
@@ -2586,8 +3209,8 @@
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>4</Pages>
|
||||
<UniqueValues>267</UniqueValues>
|
||||
<Pages>5</Pages>
|
||||
<UniqueValues>269</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
@@ -3851,7 +4474,7 @@
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>8</UniqueValues>
|
||||
<UniqueValues>9</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
|
||||
Reference in New Issue
Block a user