public IEnumerable <SupplierInfoData> Search(SupplierCriteria criteria) { ArgumentValidator.IsNotNull("critetia", criteria); IEnumerable <SupplierInfoData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <SupplierInfoData>(); if (criteria.CategoryId != null) { query.AddExpressionEq <SupplierInfoData, object>(o => o.CategoryId, criteria.CategoryId); } if (!string.IsNullOrEmpty(criteria.SupplierName)) { query.AddExpressionInsensitiveLike <SupplierInfoData, string>(o => o.Name, criteria.SupplierName, MatchMode.Anywhere); } if (!string.IsNullOrEmpty(criteria.ZipCode)) { query.AddExpressionInsensitiveLike <SupplierInfoData, string>(o => o.ZipCode, criteria.ZipCode, MatchMode.Anywhere); } if (!string.IsNullOrEmpty(criteria.Address)) { query.AddExpressionInsensitiveLike <SupplierInfoData, string>(o => o.Address, criteria.Address, MatchMode.Anywhere); } result = query.List <SupplierInfoData>(); }); return(result); }
public ReferenceInfoData GetReference(string urlAlias, object locationId, object languageId) { ArgumentValidator.IsNotNull("urlAlias", urlAlias); ReferenceInfoData result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <ReferenceInfoData>(); query.AddExpressionInsensitiveLike <ReferenceInfoData, string>(o => o.UrlAlias, urlAlias); result = query.UniqueResult <ReferenceInfoData>(); AttachAdditionalContent(result, locationId, languageId); }); return(result); }