public List <SPPaymentInfoEntity> FindAllDefaultClientPaymentByOrderByDate(List <SPClientEntity> spClientEntities, DateTime startDate, DateTime endDate, string sortFieldName, bool isDesc, int pageIndex, int limit, out int recordCount) { var queryBuilder = new NHibernateDynamicQueryGenerator <SPPaymentInfoEntity>(); queryBuilder.AddWhereClause(PROPERTY_CLIENTID.In(spClientEntities)); if (startDate != DateTime.MinValue) { queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Ge(startDate.Date)); } if (endDate != DateTime.MinValue) { queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Lt(endDate.AddDays(1).Date)); } AddDefaultOrderByToQueryGenerator(sortFieldName, isDesc, queryBuilder); queryBuilder.SetFirstResult((pageIndex - 1) * limit); queryBuilder.SetMaxResults(limit); return(FindListByPageByQueryBuilder(queryBuilder, out recordCount)); }
public List <SPPaymentInfoEntity> FindAllByOrderByAndSPClientGroupIDAndDateAndProviceNoIntercept(List <SPClientEntity> spClientEntities, int spClientGroupID, DateTime startDate, DateTime endDate, string province, string city, string phone, string sortFieldName, bool isdesc, int pageIndex, int limit, out int recordCount) { var queryBuilder = new NHibernateDynamicQueryGenerator <SPPaymentInfoEntity>(); queryBuilder.AddWhereClause(PROPERTY_CLIENTID.In(spClientEntities)); if (startDate == DateTime.MinValue) { startDate = DateTime.Now; } if (endDate == DateTime.MinValue) { endDate = DateTime.Now; } if (!string.IsNullOrEmpty(province)) { if (province.Equals("NULL")) { queryBuilder.AddWhereClause(PROPERTY_PROVINCE.Eq("")); } else { queryBuilder.AddWhereClause(PROPERTY_PROVINCE.Eq(province)); } } if (!string.IsNullOrEmpty(city)) { queryBuilder.AddWhereClause(PROPERTY_CITY.Eq(city)); } if (!string.IsNullOrEmpty(phone)) { queryBuilder.AddWhereClause(PROPERTY_MOBILENUMBER.Like(phone, MatchMode.Start)); } queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Ge(startDate.Date)); queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Lt(endDate.AddDays(1).Date)); queryBuilder.AddWhereClause(PROPERTY_ISINTERCEPT.Eq(false)); queryBuilder.AddWhereClause(PROPERTY_CLIENTGROUPID.Eq(spClientGroupID)); AddDefaultOrderByToQueryGenerator(sortFieldName, isdesc, queryBuilder); queryBuilder.SetFirstResult((pageIndex - 1) * limit); queryBuilder.SetMaxResults(limit); return(FindListByPageByQueryBuilder(queryBuilder, out recordCount)); }