本文整理汇总了C#中SIGEM.Business.SQL.ONSqlSelect.AddOrderBy方法的典型用法代码示例。如果您正苦于以下问题:C# ONSqlSelect.AddOrderBy方法的具体用法?C# ONSqlSelect.AddOrderBy怎么用?C# ONSqlSelect.AddOrderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIGEM.Business.SQL.ONSqlSelect
的用法示例。
在下文中一共展示了ONSqlSelect.AddOrderBy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddOrderCriteria
///<summary> This method adds the order criteria to the SQL statement </summary>
///<param name = "onSql"> This parameter represents the SQL component </param>
///<param name = "comparer"> This parameter has all the information refering to the order criteria to add to SQL statement</param>
/// <param name="startRowOid">This parameter has the OID necessary to start the search</param>
/// <param name="blockSize">This parameter represents the number of instances to be returned</param>
protected override void AddOrderCriteria(ONSqlSelect onSql, ONOrderCriteria comparer, ONOid startRowOid, int blockSize, ONPath initialPath)
{
//Initilizate StartRow
AeronaveInstance lInstance = null;
if (startRowOid != null)
{
lInstance = new AeronaveInstance(OnContext);
lInstance.Oid = startRowOid as AeronaveOid;
}
//Default OrderCriteria
if (comparer == null)
{
string lAlias = onSql.GetAlias("Aeronave", initialPath);
if (lInstance != null)
{
onSql.AddOrderBy(lAlias, CtesBD.FLD_AERONAVE_ID_AERONAVE, OrderByTypeEnumerator.Asc, lInstance.Oid.Id_AeronaveAttr);
}
else
{
onSql.AddOrderBy(lAlias, CtesBD.FLD_AERONAVE_ID_AERONAVE, OrderByTypeEnumerator.Asc, null);
}
return;
}
//Add OrderCriteria
bool lUseStartRow = (!comparer.InMemory);
foreach (ONOrderCriteriaItem lOrderCriteriaItem in comparer.OrderCriteriaSqlItem)
{
ONPath lPath = new ONPath(lOrderCriteriaItem.OnPath);
if((lInstance != null) && (lUseStartRow))
{
ONSimpleType lAttrStartRow = null;
if (lPath.Path == "")
lAttrStartRow = lInstance[lOrderCriteriaItem.Attribute] as ONSimpleType;
else
{
ONCollection lCollection = (lInstance[lPath.Path] as ONCollection);
if((lCollection != null) && (lCollection.Count > 0))
lAttrStartRow = lCollection[0][lOrderCriteriaItem.Attribute] as ONSimpleType;
}
onSql.AddOrderBy(AeronaveData.AddPath(onSql, JoinType.LeftJoin, lOrderCriteriaItem.Facet, lPath, null, lOrderCriteriaItem.DomainArgument, false), lOrderCriteriaItem.Attribute, lOrderCriteriaItem.Type, lAttrStartRow);
lUseStartRow = (lAttrStartRow != null);
}
else
onSql.AddOrderBy(AeronaveData.AddPath(onSql, JoinType.LeftJoin, lOrderCriteriaItem.Facet, lPath, null, lOrderCriteriaItem.DomainArgument, false), lOrderCriteriaItem.Attribute, lOrderCriteriaItem.Type, null);
}
return;
}