public IList <TDto> Top(int firstIndex, int maxSize, IOrderByGetter orderByGetter, IWhereGetter where = null) { var entities = this.IBaseDao.Top <TDbEntity>(firstIndex, maxSize, orderByGetter, where); var dtos = MapToDto(entities); return(dtos); }
public static ICriteria AddOrder(ICriteria iCriteria, IOrderByGetter orderBys) { if (orderBys == null) { return(iCriteria); } return(AddOrder(iCriteria, orderBys.OrderBys)); }
public IList <TEntity> Top <TEntity>(int firstIndex, int maxSize, IOrderByGetter orderByGetter, IWhereGetter where = null) where TEntity : class { var iCriteria = this.Session.CreateCriteria <TEntity>(); iCriteria.SetFirstResult(firstIndex); iCriteria.SetMaxResults(maxSize); var list = iCriteria.List <TEntity>(); return(list); }
public T FirstOrDefault <T>(IWhereGetter where, IOrderByGetter orderByGetter = null) where T : class { var list = this.FindByProperties <T>(where, orderByGetter); if (ToolFactory.CreateIValidatorTool().IsEmpty(list)) { return(null); } return(list[0]); }
public IList <T> FindAll <T>(IOrderByGetter orderBys = null) where T : class { var iCriteria = this.Session.CreateCriteria <T>(); if (orderBys == null) { return(this.HibernateTemplate.LoadAll <T>()); } iCriteria = QueryParameterHelper.AddOrder(iCriteria, orderBys); return(iCriteria.List <T>()); }
public IList <T> FindByProperties <T>(IWhereGetter where, IOrderByGetter orderByGetter = null) where T : class { var iCriteria = this.Session.CreateCriteria <T>(); iCriteria = QueryParameterHelper.Add(iCriteria, where); iCriteria = QueryParameterHelper.AddOrder(iCriteria, orderByGetter); var list = iCriteria.List <T>(); return(list); }
public GenericPageResult <T> Page <T>(IOrderByGetter orderByGetter, IWhereGetter where, int pageIndex = 1, int pageSize = 10) where T : class { var iCriteria = this.Session.CreateCriteria <T>(); pageIndex = pageIndex == 0 ? 1 : pageIndex; iCriteria = QueryParameterHelper.Add(iCriteria, where); var total = ICriteriaHelper.Count(iCriteria); iCriteria.SetMaxResults(pageSize); iCriteria.SetFirstResult(pageSize * (pageIndex - 1)); iCriteria = QueryParameterHelper.AddOrder(iCriteria, orderByGetter.OrderBys); var list = iCriteria.List <T>(); GenericPageResult <T> resultData = new GenericPageResult <T>() { Data = list, PageIndex = pageIndex, PageSize = pageSize, Total = total }; return(resultData); }
public IList <T> FindByProperty(string propertyName, object value, IOrderByGetter orderBys = null) { return(this.DaoTemplate.FindByProperty <T>(propertyName, value, orderBys)); }
public T FirstOrDefault(string propertyName, object value, IOrderByGetter orderBys = null) { return(this.DaoTemplate.FirstOrDefault <T>(propertyName, value, orderBys)); }
public T FirstOrDefault(IWhereGetter where, IOrderByGetter iOrderByGetter = null) { return(this.DaoTemplate.FirstOrDefault <T>(where, iOrderByGetter)); }
public GenericPageResult <T> Page(IOrderByGetter orderBys, IWhereGetter where, int pageIndex = 1, int pageSize = 10) { return(this.DaoTemplate.Page <T>(orderBys, where, pageIndex, pageSize)); }
public IList <T> FindByProperties(IWhereGetter where, IOrderByGetter orderByGetter = null) { return(this.DaoTemplate.FindByProperties <T>(where, orderByGetter)); }
public IList <T> FindAll(IOrderByGetter orderBys = null) { return(this.DaoTemplate.FindAll <T>(orderBys)); }
public IList <T> Top(int firstIndex, int maxSize, IOrderByGetter orderByGetter, IWhereGetter where = null) { return(this.DaoTemplate.Top <T>(firstIndex, maxSize, orderByGetter, where)); }
public T FirstOrDefault <T>(string propertyName, object value, IOrderByGetter orderByGetter = null) where T : class { return(this.FirstOrDefault <T>(Where.Create().Eq(propertyName, value), orderByGetter)); }
public IList <T> FindByProperty <T>(string propertyName, object value, IOrderByGetter orderByGetter = null) where T : class { return(this.FindByProperties <T>(Where.Create().Eq(propertyName, value), orderByGetter)); }