v1.0.4.0
This commit is contained in:
@@ -0,0 +1,670 @@
|
||||
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.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Text;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System.Linq;
|
||||
|
||||
namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxActivityMgr_Dbas
|
||||
{
|
||||
//*******************************************************************
|
||||
// Activity Mgr - Organisation Opportunity
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
private List<StringPair> GetLogProperties(SaxOrganisationOpportunity organisationOpportunity)
|
||||
{
|
||||
return new List<StringPair>()
|
||||
{
|
||||
new StringPair("Id", SysId.ToString(organisationOpportunity.Id)),
|
||||
new StringPair("OrganisationId", SysId.ToString(organisationOpportunity.OrganisationId)),
|
||||
new StringPair("Position", StringUtil.Left(organisationOpportunity.Position,32)),
|
||||
new StringPair("Status", organisationOpportunity.StatusCode)
|
||||
};
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public override SaxOrganisationOpportunity CreateOrganisationOpportunity(SysId userAccountIdJournalist)
|
||||
{
|
||||
ClearErrorState();
|
||||
return new SaxOrganisationOpportunity_Dbas(CoreDatabase, null, userAccountIdJournalist, 0);
|
||||
}
|
||||
private SaxOrganisationOpportunity_Dbas CreateOrganisationOpportunity(OrganisationOpportunity_Db dbOrganisationOpportunity)
|
||||
{
|
||||
ClearErrorState();
|
||||
SaxOrganisationOpportunity_Dbas organisationOpportunity = new SaxOrganisationOpportunity_Dbas(CoreDatabase, new SysId(dbOrganisationOpportunity._Id), new SysId(dbOrganisationOpportunity._OrganisationId), (UInt16)dbOrganisationOpportunity._Flags);
|
||||
PopulateFrom(dbOrganisationOpportunity, organisationOpportunity);
|
||||
return organisationOpportunity;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get item.
|
||||
public override SaxOrganisationOpportunity GetOrganisationOpportunity(SaxOrganisationOpportunity.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetOrganisationOpportunity(GetOrganisationOpportunityQueryFilter(prm).Concat(" And ", "(", ")"));
|
||||
}
|
||||
private SaxOrganisationOpportunity GetOrganisationOpportunity(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
long count = GetOrganisationOpportunityCount(filter);
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple items found");
|
||||
return null;
|
||||
}
|
||||
SaxOrganisationOpportunity organisationOpportunity = null;
|
||||
// Query data.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
OrganisationOpportunity_Db dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||
dbOrganisationOpportunity.PopulateFrom(dbCommand, aliasOrganisationOpportunity, filter);
|
||||
organisationOpportunity = CreateOrganisationOpportunity(dbOrganisationOpportunity);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SaLogger.Warn(GetType().Name + ".GetOrganisationOpportunity\n\tQuery: " + dbCommand.CommandText + "\n\t" + exc.GetType().Name + ": " + exc.Message);
|
||||
}
|
||||
}
|
||||
return organisationOpportunity;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item.
|
||||
public override bool IsValidOrganisationOpportunityData(SaxOrganisationOpportunity.Data data, SaxOrganisationOpportunity.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.IsValidOrganisationOpportunityData(data, errField)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert item.
|
||||
public override bool InsertOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertOrganisationOpportunity";
|
||||
ClearErrorState();
|
||||
if (!IsValidOrganisationOpportunity(organisationOpportunity)) return false;
|
||||
if (SysId.IsValid(organisationOpportunity.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
OrganisationOpportunity_Db dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||
PopulateTo(dbOrganisationOpportunity, organisationOpportunity, dbUpdateInfo);
|
||||
if (OrganisationOpportunity_Db.FieldsNonId.Contains("Id"))
|
||||
{
|
||||
// Generate next Id.
|
||||
// ToDo dbOrganisationOpportunity._Id = CoreDatabase.GetNextIdFromTable("OrganisationOpportunity");
|
||||
}
|
||||
dbOrganisationOpportunity.ExecuteInsertCommand(dbCommand);
|
||||
organisationOpportunity.Id = new SysId(dbOrganisationOpportunity._Id);
|
||||
organisationOpportunity.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(organisationOpportunity).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update item.
|
||||
public override bool UpdateOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateOrganisationOpportunity";
|
||||
ClearErrorState();
|
||||
if (!IsValidOrganisationOpportunity(organisationOpportunity)) return false;
|
||||
if (!SysId.IsValid(organisationOpportunity.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!organisationOpportunity.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(organisationOpportunity).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
OrganisationOpportunity_Db dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||
dbOrganisationOpportunity.PopulateFrom(dbCommand, aliasOrganisationOpportunity, "Id=" + SysId.ToString(organisationOpportunity.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_OrganisationOpportunity updateLogMonitor = new SaxUpdateLogItemMonitor_OrganisationOpportunity(SessionContext, CreateOrganisationOpportunity(dbOrganisationOpportunity), dbUpdateInfo);
|
||||
// Update properties.
|
||||
PopulateTo(dbOrganisationOpportunity, organisationOpportunity, dbUpdateInfo);
|
||||
dbOrganisationOpportunity.ExecuteUpdateCommand(dbCommand);
|
||||
organisationOpportunity.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(organisationOpportunity).Concat(": ").Concat("", "\n\t"));
|
||||
// Record updates.
|
||||
// ToDo updateLogMonitor.RecordUpdatedValues(organisationOpportunity);
|
||||
// ToDo updateLogMonitor.LogUpdates();
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Delete item.
|
||||
public override bool OrganisationOpportunityCanBeDeleted(SaxOrganisationOpportunity organisationOpportunity)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.OrganisationOpportunityCanBeDeleted(organisationOpportunity)) return false;
|
||||
return true;
|
||||
}
|
||||
public override bool DeleteOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteOrganisationOpportunity";
|
||||
ClearErrorState();
|
||||
if (!OrganisationOpportunityCanBeDeleted(organisationOpportunity)) return false;
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve organisationOpportunity.
|
||||
dbConnection.Open();
|
||||
OrganisationOpportunity_Db dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||
dbOrganisationOpportunity.PopulateFrom(dbCommand, aliasOrganisationOpportunity, "Id=" + organisationOpportunity.Id.ToString());
|
||||
// Delete organisationOpportunity.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.OrganisationOpportunity) + " WHERE Id=" + SysId.ToString(organisationOpportunity.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
organisationOpportunity.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(organisationOpportunity).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from database.
|
||||
private void PopulateTo(OrganisationOpportunity_Db dbOrganisationOpportunity, SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
dbOrganisationOpportunity._Id = SysId.ToInt(organisationOpportunity.Id);
|
||||
dbOrganisationOpportunity._OrganisationId = SysId.ToInt(organisationOpportunity.OrganisationId);
|
||||
dbOrganisationOpportunity._RegionIdPrimary = SysId.ToInt(organisationOpportunity.RegionIdPrimary);
|
||||
dbOrganisationOpportunity._SportIdPrimary = SysId.ToInt(organisationOpportunity.SportIdPrimary);
|
||||
dbOrganisationOpportunity._OpportunityTypeCode = OpportunityTypes.GetCodeForType(organisationOpportunity.OpportunityType);
|
||||
dbOrganisationOpportunity._Position = organisationOpportunity.Position;
|
||||
dbOrganisationOpportunity._Outline = organisationOpportunity.Outline;
|
||||
dbOrganisationOpportunity._OpportunityData = organisationOpportunity.OpportunityData;
|
||||
dbOrganisationOpportunity._PublishedAt = organisationOpportunity.PublishedAt;
|
||||
dbOrganisationOpportunity._ExpiresAt = organisationOpportunity.ExpiresAt;
|
||||
dbOrganisationOpportunity._Notes = organisationOpportunity.Notes;
|
||||
dbOrganisationOpportunity._Status = SacsSystem.GetStatusCode(organisationOpportunity.Status);
|
||||
dbOrganisationOpportunity._Flags = (short)organisationOpportunity.Flags;
|
||||
if (!SysId.IsValid(organisationOpportunity.Id))
|
||||
{
|
||||
dbOrganisationOpportunity._CreateOn = DateTime.Now;
|
||||
dbOrganisationOpportunity._CreateBy = dbUpdateInfo.UserId.ToInt();
|
||||
dbOrganisationOpportunity._CreateHost = dbUpdateInfo.Host;
|
||||
}
|
||||
dbOrganisationOpportunity._UpdateOn = DateTime.Now;
|
||||
dbOrganisationOpportunity._UpdateBy = dbUpdateInfo.UserId.ToInt();
|
||||
dbOrganisationOpportunity._UpdateHost = dbUpdateInfo.Host;
|
||||
}
|
||||
private void PopulateFrom(OrganisationOpportunity_Db dbOrganisationOpportunity, SaxOrganisationOpportunity organisationOpportunity)
|
||||
{
|
||||
//organisationOpportunity.Id = new SysId(dbOrganisationOpportunity._Id);
|
||||
//organisationOpportunity.OrganisationId = new SysId(dbOrganisationOpportunity._OrganisationId);
|
||||
organisationOpportunity.RegionIdPrimary = new SysId(dbOrganisationOpportunity._RegionIdPrimary);
|
||||
organisationOpportunity.SportIdPrimary = new SysId(dbOrganisationOpportunity._SportIdPrimary);
|
||||
organisationOpportunity.OpportunityType = (Sax.OpportunityType)OpportunityTypes.GetTypeForCode(dbOrganisationOpportunity._OpportunityTypeCode);
|
||||
organisationOpportunity.Position = dbOrganisationOpportunity._Position;
|
||||
organisationOpportunity.Outline = dbOrganisationOpportunity._Outline;
|
||||
organisationOpportunity.OpportunityData = dbOrganisationOpportunity._OpportunityData;
|
||||
organisationOpportunity.PublishedAt = dbOrganisationOpportunity._PublishedAt;
|
||||
organisationOpportunity.ExpiresAt = dbOrganisationOpportunity._ExpiresAt;
|
||||
organisationOpportunity.Notes = dbOrganisationOpportunity._Notes;
|
||||
organisationOpportunity.Status = SacsSystem.GetStatusForCode(dbOrganisationOpportunity._Status);
|
||||
organisationOpportunity.SetCreateStamp(dbOrganisationOpportunity._CreateOn, new SysId(dbOrganisationOpportunity._CreateBy), dbOrganisationOpportunity._CreateHost);
|
||||
organisationOpportunity.SetUpdateStamp(dbOrganisationOpportunity._UpdateOn, new SysId(dbOrganisationOpportunity._UpdateBy), dbOrganisationOpportunity._UpdateHost);
|
||||
organisationOpportunity.AcceptChanges();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item column definitions.
|
||||
private static readonly String aliasOrganisationOpportunity = "Sprt";
|
||||
private static readonly String aliasOrganisationOpportunity_Organisation = "OrgOpp_Org";
|
||||
private static readonly String prefixOrganisationOpportunity_Organisation = "OrgOpp_Org_";
|
||||
private static readonly String aliasOrganisationOpportunity_Organisation_UserOrganisation = "OrgOpp_Org_UsrOrg";
|
||||
private static readonly String aliasOrganisationOpportunity_Region = "OrgOpp_Reg";
|
||||
private static readonly String prefixOrganisationOpportunity_Region = "OrgOpp_Reg_";
|
||||
private static readonly String aliasOrganisationOpportunity_Sport = "OrgOpp_Spt";
|
||||
private static readonly String prefixOrganisationOpportunity_Sport = "OrgOpp_Spt_";
|
||||
private void SetOrganisationOpportunityColDfn
|
||||
(ColumnDfn col, String caption, int width, SaxDbDfn.ColumnIdx dbCol,
|
||||
ColumnAlignment align = ColumnAlignment.Default, DataValue.DataType dataType = DataValue.DataType.String,
|
||||
String alias = "", String prefix = "")
|
||||
{
|
||||
if (String.IsNullOrEmpty(alias) && SaxDbDfn.GetTableForColumn(dbCol) == SaxDbDfn.TableIdx.OrganisationOpportunity)
|
||||
alias = aliasOrganisationOpportunity;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SaxDbDfn.GetColumnName(dbCol, false), SaxDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SaxDbDfn.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SaxDbDfn.GetColTextLen(dbCol);
|
||||
}
|
||||
public override ColumnDfn GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||
switch (columnId)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
case SaxOrganisationOpportunity.Column.Pos:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Pos", 60, SaxDbDfn.ColumnIdx.Unknown, ColumnAlignment.Right);
|
||||
columnDfn.SortMode = ColumnDfn.ColumnSortMode.Off;
|
||||
columnDfn.ReadOnly = true;
|
||||
columnDfn.Resizable = false;
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.Id:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Id", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Id, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Organisation.
|
||||
case SaxOrganisationOpportunity.Column.OrganisationId:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Organisation Id", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_OrganisationId, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.Organisation_Name:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Organisation", 160, SaxDbDfn.ColumnIdx.Organisation_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasOrganisationOpportunity_Organisation, prefixOrganisationOpportunity_Organisation);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Region.
|
||||
case SaxOrganisationOpportunity.Column.RegionIdPrimary:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Region Id", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_RegionIdPrimary, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.Region_Name:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Region", 100, SaxDbDfn.ColumnIdx.Region_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasOrganisationOpportunity_Region, prefixOrganisationOpportunity_Region);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Sport.
|
||||
case SaxOrganisationOpportunity.Column.SportIdPrimary:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Sport Id", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_SportIdPrimary, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.Sport_Name:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Sport", 100, SaxDbDfn.ColumnIdx.Sport_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasOrganisationOpportunity_Sport, prefixOrganisationOpportunity_Sport);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Opportunity.
|
||||
case SaxOrganisationOpportunity.Column.OpportunityTypeCode:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Opportunity", 90, SaxDbDfn.ColumnIdx.OrganisationOpportunity_OpportunityTypeCode, ColumnAlignment.Center);
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.OpportunityType_Desc:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Opportunbity", 120, SaxDbDfn.ColumnIdx.OrganisationOpportunity_OpportunityTypeCode, ColumnAlignment.Center);
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.Position:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Position", 200, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position);
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.Outline:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Outline", 200, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline);
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.PublishedAt_Date:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Published", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_PublishedAt, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.PublishedAt_DateTime:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Published", 100, SaxDbDfn.ColumnIdx.OrganisationOpportunity_PublishedAt, ColumnAlignment.Center, DataValue.DataType.DateTime);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.ExpiresAt_Date:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Expires", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_ExpiresAt, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.ExpiresAt_DateTime:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Expires", 100, SaxDbDfn.ColumnIdx.OrganisationOpportunity_ExpiresAt, ColumnAlignment.Center, DataValue.DataType.DateTime);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Derived properties.
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Common properties.
|
||||
case SaxOrganisationOpportunity.Column.Notes:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Notes", 240, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Notes);
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.Flags:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Flags", 60, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Flags, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.Status:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Status", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status, ColumnAlignment.Center);
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.Status_Desc:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Status", 90, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status, ColumnAlignment.Center);
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.Status_Ind:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Status", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status, ColumnAlignment.Center, DataValue.DataType.TriState);
|
||||
columnDfn.TriStateFormat = ColumnTriStateFormat.Lights;
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.CreateOn_Date:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Created", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_CreateOn, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxOrganisationOpportunity.Column.UpdateOn_Date:
|
||||
SetOrganisationOpportunityColDfn(columnDfn, "Updated", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_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> GetOrganisationOpportunityQueryFilter(SaxOrganisationOpportunity.Params prm)
|
||||
{
|
||||
List<String> filter = new List<String>();
|
||||
|
||||
// Item Ids.
|
||||
String idsIncluded = prm.IdsIncluded.Concat(",");
|
||||
if (!idsIncluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Id, aliasOrganisationOpportunity) + " IN (" + idsIncluded + ")");
|
||||
String idsExcluded = prm.IdsExcluded.Concat(",");
|
||||
if (!idsExcluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Id, aliasOrganisationOpportunity) + " NOT IN (" + idsExcluded + ")");
|
||||
|
||||
// User Account Ids.
|
||||
String userAccountIdsIncluded = prm.UserAccountIdsIncluded.Concat(",");
|
||||
if (!userAccountIdsIncluded.IsEmpty())
|
||||
{
|
||||
// User Organisation.
|
||||
if (!StringUtil.IsEmpty(prm.Alias_UserOrganisation))
|
||||
{
|
||||
// Filter directly on the joined User Organisation table.
|
||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserOrganisation_UserAccountId, prm.Alias_UserOrganisation) + " IN (" + userAccountIdsIncluded + ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
// User Organisation query.
|
||||
String alias_UserOrganisation = aliasOrganisationOpportunity_Organisation_UserOrganisation;
|
||||
DbQuery queryUserOrganisation = new DbQuery(CoreDatabase.DbmsType);
|
||||
queryUserOrganisation.Tables.Add(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.UserOrganisation), alias_UserOrganisation);
|
||||
queryUserOrganisation.Filters.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserOrganisation_UserAccountId, alias_UserOrganisation) + " IN (" + userAccountIdsIncluded + ")");
|
||||
|
||||
// Filter Organisation directly against the Organisation Opportunity.
|
||||
queryUserOrganisation.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserOrganisation_OrganisationId, alias_UserOrganisation));
|
||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_OrganisationId, aliasOrganisationOpportunity) + " IN (" + queryUserOrganisation.BuildQuery() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
// Organisation Ids.
|
||||
String organisationIdsIncluded = prm.OrganisationIdsIncluded.Concat(",");
|
||||
if (!organisationIdsIncluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_OrganisationId, aliasOrganisationOpportunity) + " IN (" + organisationIdsIncluded + ")");
|
||||
|
||||
// Region Ids.
|
||||
String regionIdsIncluded = prm.RegionIdsIncluded.Concat(",");
|
||||
if (!regionIdsIncluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_RegionIdPrimary, aliasOrganisationOpportunity) + " IN (" + regionIdsIncluded + ")");
|
||||
|
||||
// Sport Ids.
|
||||
String sportIdsIncluded = prm.SportIdsIncluded.Concat(",");
|
||||
if (!sportIdsIncluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_SportIdPrimary, aliasOrganisationOpportunity) + " IN (" + sportIdsIncluded + ")");
|
||||
|
||||
// Position.
|
||||
if (!StringUtil.IsEmpty(prm.PositionPartial))
|
||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position, aliasOrganisationOpportunity) + " Like '%" + DbQuery.FormatForLike(prm.PositionPartial, true) + "%'");
|
||||
|
||||
// Outline.
|
||||
if (!StringUtil.IsEmpty(prm.OutlinePartial))
|
||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline, aliasOrganisationOpportunity) + " Like '%" + DbQuery.FormatForLike(prm.OutlinePartial, true) + "%'");
|
||||
|
||||
// Article.
|
||||
if (!StringUtil.IsEmpty(prm.OpportunityFilter))
|
||||
{
|
||||
// Split filter into words.
|
||||
List<String> filterWords = prm.OpportunityFilter.Split((char[])null).ToList();
|
||||
filterWords.RemoveDuplicatesCI();
|
||||
filterWords.RemoveBlanks();
|
||||
foreach (String filterWord in filterWords)
|
||||
{
|
||||
List<String> articleFilter = new List<String>();
|
||||
articleFilter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position, aliasOrganisationOpportunity) + " Like '%" + DbQuery.FormatForLike(filterWord, true) + "%'");
|
||||
articleFilter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline, aliasOrganisationOpportunity) + " Like '%" + DbQuery.FormatForLike(filterWord, true) + "%'");
|
||||
filter.Add(articleFilter.Concat(" OR ", "(", ")"));
|
||||
}
|
||||
}
|
||||
|
||||
// Notes.
|
||||
if (!StringUtil.IsEmpty(prm.NotesPartial))
|
||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Notes, aliasOrganisationOpportunity) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxOrganisationOpportunity.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status, aliasOrganisationOpportunity) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxOrganisationOpportunity.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status, aliasOrganisationOpportunity) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetOrganisationOpportunitySortColumns(SaxOrganisationOpportunity.Params prm)
|
||||
{
|
||||
// Sort sequence:
|
||||
List<String> sortColumnNames = new List<String>();
|
||||
foreach (var columnDfn in prm.SortColumns)
|
||||
{
|
||||
// Need to ensure correct alias used for OrganisationOpportunity columns in case of conflict.
|
||||
String sortCol = String.Empty;
|
||||
if (SaxDbDfn.GetTableForColumn((SaxDbDfn.ColumnIdx)columnDfn.DbColumn) == SaxDbDfn.TableIdx.OrganisationOpportunity)
|
||||
{
|
||||
sortCol = SaxDbDfn.GetColumnNameQual((SaxDbDfn.ColumnIdx)columnDfn.DbColumn, aliasOrganisationOpportunity);
|
||||
}
|
||||
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.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Id, aliasOrganisationOpportunity) + " ASC");
|
||||
}
|
||||
return sortColumnNames;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item count.
|
||||
private long GetOrganisationOpportunityCount(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
return CoreDatabase.GetRowCount(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.OrganisationOpportunity) + " As " + aliasOrganisationOpportunity, filter);
|
||||
}
|
||||
public override long GetOrganisationOpportunityCount(SaxOrganisationOpportunity.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetOrganisationOpportunityCount(GetOrganisationOpportunityQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public override List<SaxOrganisationOpportunity> GetOrganisationOpportunityList(SaxOrganisationOpportunity.Params prm)
|
||||
{
|
||||
List<SaxOrganisationOpportunity> userActivitys = new List<SaxOrganisationOpportunity>();
|
||||
DbQuery qry = new DbQuery(CoreDatabase.DbmsType);
|
||||
qry.Tables.Add(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.OrganisationOpportunity), aliasOrganisationOpportunity);
|
||||
OrganisationOpportunity_Db dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||
qry.Columns.AddRange(dbOrganisationOpportunity.ExistingColumnNames);
|
||||
qry.Filters.AddRange(GetOrganisationOpportunityQueryFilter(prm));
|
||||
qry.OrderBy.AddRange(GetOrganisationOpportunitySortColumns(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())
|
||||
{
|
||||
dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||
dbOrganisationOpportunity.PopulateFrom(dbDataReader);
|
||||
userActivitys.Add(CreateOrganisationOpportunity(dbOrganisationOpportunity));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(GetType().Name + ".GetOrganisationOpportunityList\n\tQuery: " + dbCommand.CommandText + "\n\t" + exc.GetType().Name + ": " + exc.Message);
|
||||
}
|
||||
}
|
||||
return userActivitys;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item query execution.
|
||||
public override DbResultSet ExecuteOrganisationOpportunityQuery(List<ColumnDfn> columns, SaxOrganisationOpportunity.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Construct query.
|
||||
DbQuery query = new DbQuery(CoreDatabase.DbmsType);
|
||||
query.Tables.Add(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.OrganisationOpportunity), aliasOrganisationOpportunity);
|
||||
|
||||
// Add columns as defined in query list.
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.Id))
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Id, aliasOrganisationOpportunity));
|
||||
bool hasOrganisationCols = (columns.HasId(SaxOrganisationOpportunity.Column.Organisation_Name));
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.OrganisationId) || hasOrganisationCols)
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_OrganisationId, aliasOrganisationOpportunity));
|
||||
bool hasRegionCols = (columns.HasId(SaxOrganisationOpportunity.Column.Region_Name));
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.RegionIdPrimary) || hasRegionCols)
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_RegionIdPrimary, aliasOrganisationOpportunity));
|
||||
bool hasSportCols = (columns.HasId(SaxOrganisationOpportunity.Column.Sport_Name));
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.SportIdPrimary) || hasSportCols)
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_SportIdPrimary, aliasOrganisationOpportunity));
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.OpportunityTypeCode) || columns.HasId(SaxOrganisationOpportunity.Column.OpportunityType_Desc))
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_OpportunityTypeCode, aliasOrganisationOpportunity));
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.Position))
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position, aliasOrganisationOpportunity));
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.Outline))
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline, aliasOrganisationOpportunity));
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.PublishedAt_Date) || columns.HasId(SaxOrganisationOpportunity.Column.PublishedAt_DateTime))
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_PublishedAt, aliasOrganisationOpportunity));
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.ExpiresAt_Date) || columns.HasId(SaxOrganisationOpportunity.Column.ExpiresAt_DateTime))
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_ExpiresAt, aliasOrganisationOpportunity));
|
||||
// Common properties.
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.Notes))
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Notes, aliasOrganisationOpportunity));
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.Flags))
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Flags, aliasOrganisationOpportunity));
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.Status) || columns.HasId(SaxOrganisationOpportunity.Column.Status_Desc) || columns.HasId(SaxOrganisationOpportunity.Column.Status_Ind))
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status, aliasOrganisationOpportunity));
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.CreateOn_Date))
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_CreateOn, aliasOrganisationOpportunity));
|
||||
if (columns.HasId(SaxOrganisationOpportunity.Column.UpdateOn_Date))
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_UpdateOn, aliasOrganisationOpportunity));
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Organisation.
|
||||
if (hasOrganisationCols)
|
||||
{
|
||||
DbQueryJoin joinOrganisation = new DbQueryJoin(DbJoinType.LeftOuter);
|
||||
joinOrganisation.Table = new StringPair(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.Organisation), aliasOrganisationOpportunity_Organisation);
|
||||
joinOrganisation.Filters.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.Organisation_Id, aliasOrganisationOpportunity_Organisation) + "=" + SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_OrganisationId, aliasOrganisationOpportunity));
|
||||
query.Joins.Add(joinOrganisation);
|
||||
List<SaxDbDfn.ColumnIdx> cols = new List<SaxDbDfn.ColumnIdx>();
|
||||
cols.Add(SaxDbDfn.ColumnIdx.Organisation_Name);
|
||||
foreach (var col in cols)
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(col, aliasOrganisationOpportunity_Organisation), prefixOrganisationOpportunity_Organisation + SaxDbDfn.GetColumnName(col, false));
|
||||
prm.Alias_Organisation = aliasOrganisationOpportunity_Organisation;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Primary Region.
|
||||
if (hasRegionCols)
|
||||
{
|
||||
DbQueryJoin joinRegion = new DbQueryJoin(DbJoinType.LeftOuter);
|
||||
joinRegion.Table = new StringPair(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.Region), aliasOrganisationOpportunity_Region);
|
||||
joinRegion.Filters.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.Region_Id, aliasOrganisationOpportunity_Region) + "=" + SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_RegionIdPrimary, aliasOrganisationOpportunity));
|
||||
query.Joins.Add(joinRegion);
|
||||
List<SaxDbDfn.ColumnIdx> cols = new List<SaxDbDfn.ColumnIdx>();
|
||||
cols.Add(SaxDbDfn.ColumnIdx.Region_Name);
|
||||
foreach (var col in cols)
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(col, aliasOrganisationOpportunity_Region), prefixOrganisationOpportunity_Region + SaxDbDfn.GetColumnName(col, false));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Primary Sport.
|
||||
if (hasSportCols)
|
||||
{
|
||||
DbQueryJoin joinSport = new DbQueryJoin(DbJoinType.LeftOuter);
|
||||
joinSport.Table = new StringPair(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.Sport), aliasOrganisationOpportunity_Sport);
|
||||
joinSport.Filters.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.Sport_Id, aliasOrganisationOpportunity_Sport) + "=" + SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_SportIdPrimary, aliasOrganisationOpportunity));
|
||||
query.Joins.Add(joinSport);
|
||||
List<SaxDbDfn.ColumnIdx> cols = new List<SaxDbDfn.ColumnIdx>();
|
||||
cols.Add(SaxDbDfn.ColumnIdx.Sport_Name);
|
||||
foreach (var col in cols)
|
||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(col, aliasOrganisationOpportunity_Sport), prefixOrganisationOpportunity_Sport + SaxDbDfn.GetColumnName(col, false));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Populate filter.
|
||||
query.Filters.AddRange(GetOrganisationOpportunityQueryFilter(prm));
|
||||
|
||||
if (prm.IdsIncluded.Count != 1)
|
||||
{
|
||||
// Configure sort sequence.
|
||||
foreach (String sortColumn in GetOrganisationOpportunitySortColumns(prm))
|
||||
query.OrderBy.Add(sortColumn);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
//return new DbResultSet_DataTableReader(db, query.BuildQuery(prm.ResultsPaging));
|
||||
return DbResultSet_DataReader.ExecuteQuery(CoreDatabase, query.BuildQuery(prm.ResultsPaging));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user