public virtual IEnumerable <IOrganizationStructureState> GetOrganizationTreeChildren(string parentId, IEnumerable <KeyValuePair <string, object> > filter, IList <string> orders, int firstResult = 0, int maxResults = int.MaxValue) { var criteria = CurrentSession.CreateCriteria <OrganizationStructureState>(); NHibernateUtils.CriteriaAddCriterion(criteria, "Id.ParentId", parentId); NHibernateUtils.CriteriaAddFilterAndOrdersAndSetFirstResultAndMaxResults(criteria, filter, orders, firstResult, maxResults); return(criteria.List <OrganizationStructureState>()); }
public virtual IEnumerable <IPermissionState> GetPermissionTreeChildren(string parentId, Dddml.Support.Criterion.ICriterion filter, IList <string> orders, int firstResult = 0, int maxResults = int.MaxValue) { var criteria = CurrentSession.CreateCriteria <PermissionState>(); NHibernateUtils.CriteriaAddCriterion(criteria, "ParentPermissionId", parentId); NHibernateUtils.CriteriaAddFilterAndOrdersAndSetFirstResultAndMaxResults(criteria, filter, orders, firstResult, maxResults); return(criteria.List <PermissionState>()); }
private void CriteriaAddOrganizationTreeRootParentIdCriterion(ICriteria criteria) { IList <object> rootParentIdValues = new object[] { "" }; if (rootParentIdValues.Count == 1) { NHibernateUtils.CriteriaAddCriterion(criteria, "Id.ParentId", rootParentIdValues[0]); } else { var j = Restrictions.Disjunction(); foreach (var pIdValue in rootParentIdValues) { NHibernateUtils.DisjunctionAddCriterion(j, "Id.ParentId", pIdValue); } criteria.Add(j); } }