本文整理汇总了C#中ICriteria.AddOrder方法的典型用法代码示例。如果您正苦于以下问题:C# ICriteria.AddOrder方法的具体用法?C# ICriteria.AddOrder怎么用?C# ICriteria.AddOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICriteria
的用法示例。
在下文中一共展示了ICriteria.AddOrder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddCriteria
public ICriteria AddCriteria(ICriteria criteria)
{
if (m_order == SortFilter.Orders.ASC)
{
return criteria.AddOrder(NHibernate.Criterion.Order.Asc(m_fieldName));
}
else
{
return criteria.AddOrder(NHibernate.Criterion.Order.Desc(m_fieldName));
}
}
示例2: AddOrdersToCriteria
/// <summary>
/// Adds a collection of Order (sort by) specifiers to an ICriteria.
/// </summary>
/// <param name="criteria">The ICriteria that will be modified.</param>
/// <param name="orders">The collection of Order specifiers.</param>
internal static void AddOrdersToCriteria(ICriteria criteria, Order[] orders)
{
if (orders != null)
{
foreach (Order order in orders)
{
criteria.AddOrder(order);
}
}
}
示例3: AddCriteriaAndOrder
/// <summary>
///
/// </summary>
/// <param name="hibernateCriteria"></param>
/// <param name="where"></param>
/// <param name="orders"></param>
private void AddCriteriaAndOrder(ICriteria hibernateCriteria, IEnumerable<ICriterion> where, IEnumerable<Order> orders)
{
foreach (ICriterion criterion in where)
{
hibernateCriteria.Add(criterion);
}
foreach (Order order in orders)
{
hibernateCriteria.AddOrder(order);
}
}
示例4: AddOrdersToCriteria
private static void AddOrdersToCriteria(ICriteria criteria, IEnumerable<Order> orders)
{
if (orders != null)
{
foreach (Order order in orders)
{
criteria.AddOrder(order);
}
}
}
示例5: GetOrder
private static void GetOrder(Sort sort, ICriteria cr)
{
bool sortDir = sort.Direction == "ASC" ? true : false;
Order order = null;
if (sort.Column.IndexOf(".", StringComparison.OrdinalIgnoreCase) >= 0)
order = new Order(sort.Column, sortDir);
else
order = new Order(string.Format("attendance.{0}", sort.Column), sortDir);
cr.AddOrder(order);
}
示例6: GetOrder
private static void GetOrder(Sort sort, ICriteria cr)
{
bool sortDir = sort.Direction == "ASC" ? true : false;
Order order = new Order(string.Format("dept.{0}", sort.Column), sortDir);
cr.AddOrder(order);
}
示例7: setOrderBy
public void setOrderBy(ref ICriteria icr)
{
icr.AddOrder(new Order("recInd", false));
icr.AddOrder(new Order("recLevel", false));
icr.AddOrder((new Order("hotelName",true)));
}
示例8: OrderComplexSearch
public static ICriteria OrderComplexSearch(IList<OrderCriteria> critList, ICriteria c)
{
foreach (OrderCriteria s in critList)
{
switch (s.Order)
{
case OrderType.ASC:
c.AddOrder(Order.Asc(s.PropertyName));
break;
case OrderType.DESC:
c.AddOrder(Order.Desc(s.PropertyName));
break;
}
}
return c;
}
示例9: AddTimeOrdering
private static void AddTimeOrdering(ICriteria criteria)
{
criteria.AddOrder(Order.Asc("Year"));
criteria.AddOrder(Order.Asc("Quarter"));
criteria.AddOrder(Order.Asc("Month"));
}
示例10: setOrderby
protected void setOrderby(ref ICriteria icr)
{
string orderbyName = WebUtil.GetParamAttr("orderbyName",null);
if (orderbyName == null) return;
string orderbyType = WebUtil.GetParamAttr("orderbyType", "desc");
if (orderbyType == "desc") {
icr.AddOrder(Order.Desc(orderbyName));
}
else if (orderbyType == "asc")
{
icr.AddOrder(Order.Asc(orderbyName));
}
else {
icr.AddOrder(Order.Desc(orderbyName));
}
}
示例11: setOrderBy
public void setOrderBy(ref ICriteria icr)
{
icr.AddOrder(Order.Desc("recInd"));
icr.AddOrder(Order.Desc("recLevel"));
icr.AddOrder(Order.Desc("picURL"));
icr.AddOrder(Order.Desc("brandName"));
}
示例12: OnEvent
public void OnEvent(ICriteria crit)
{
crit.AddOrder(order);
}
示例13: Get_OnCriteria
public void Get_OnCriteria(object sender, ICriteria criteria)
{
criteria.AddOrder(Order.Asc("Code"));
// ICriterion criterion = Restrictions.Eq("Name", "测试123");
// criteria.Add(criterion);
}
示例14: setOrderBy
public void setOrderBy(ref ICriteria icr)
{
icr.AddOrder(Order.Desc("id"));
}
示例15: InitSession
/// <summary>
/// Initializes the session that will be used to enumerate
/// </summary>
private void InitSession()
{
_session = _sessionFactory.OpenSession();
_session.FlushMode = FlushMode.Never;
_tx = _session.BeginTransaction();
try
{
//Handle the case of entity type (InitialLoad)
if (_entityType != null)
{
_criteria = _session.CreateCriteria(_entityType);
_criteria.SetCacheable(false);
//If perform by id, add order to the criteria
if (_performOrderById)
{
IClassMetadata metadata = _sessionFactory.GetClassMetadata(_entityType);
string idPropName = metadata.IdentifierPropertyName;
if (idPropName != null)
_criteria.AddOrder(Order.Asc(idPropName));
}
}
//Handle the case of Persistency.Query (GetEnumerator)
else if (_persistencyQuery != null)
{
string select = _persistencyQuery.SqlQuery;
_query = _session.CreateQuery(select);
object[] preparedValues = _persistencyQuery.Parameters;
if (preparedValues != null)
{
for (int i = 0; i < preparedValues.Length; i++)
{
_query.SetParameter(i, preparedValues[i]);
}
}
_query.SetCacheable(false);
_query.SetFlushMode(FlushMode.Never);
}
else throw new Exception("NHibernateDataEnumerator must receive an Entity Type or a Query");
}
catch(Exception ex)
{
if (_tx != null && _tx.IsActive)
_tx.Rollback();
if (_session.IsOpen)
_session.Close();
throw new Exception("Error while constructing an enumerator", ex);
}
}
开发者ID:GigaSpaces-ProfessionalServices,项目名称:xapnet-templates,代码行数:51,代码来源:NHibernateDataEnumerator.cs