public IEnumerable <SubjectInfoData> GetAttachedSubjects(object refId, object subitemId, int pageIndex, int pageSize, object locationId = null, object languageId = null) { ArgumentValidator.IsNotNull("refId", refId); ArgumentValidator.IsNotNull("subitemId", subitemId); ReferenceInfoData reference = null; // Retrieve reference by refId RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <ReferenceInfoData>(); query.AddExpressionEq <ReferenceInfoData, object>(o => o.Id, refId); reference = query.UniqueResult <ReferenceInfoData>(); }); // Get attached content IEnumerable <SubjectInfoData> result = null; if (reference != null) { SubitemValueInfoData value = reference.Values.SingleOrDefault(o => object.Equals(o.SubitemId, subitemId)); if (value != null && value.ValueInt.HasValue) { object folderId = value.ValueInt.Value; int? templateId = value.ValueText.TryToParse <int>(); result = GetSubjectsByFolder(folderId, templateId, pageIndex, pageSize, languageId); } } return(result); }
public IEnumerable <PostInfoData> Search(PostCriteria criteria) { IEnumerable <PostInfoData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { IQuery query = CurrentSession.GetNamedQuery("GetPostInfoList"); if (criteria.TopicId != null) { query.SetParameter("TopicId", criteria.TopicId); } else { query.SetString("TopicId", null); } if (criteria.UserId != null) { query.SetParameter("UserId", criteria.UserId); } else { query.SetString("UserId", null); } result = query.List <PostInfoData>(); }); return(result); }
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 IEnumerable <OrderBriefInfoData> GetOrdersInProcess(OrderCriteria criteria) { IEnumerable <OrderBriefInfoData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { IQuery query = CurrentSession.GetNamedQuery("GetOrdersInProcess"); if (criteria.SupplierId != null) { query.SetParameter("SupplierId", criteria.SupplierId); } else { query.SetString("SupplierId", null); } if (criteria.CustomerId != null) { query.SetParameter("CustomerId", criteria.CustomerId); } else { query.SetString("CustomerId", null); } result = query.List <OrderBriefInfoData>(); }); return(result); }
public IEnumerable <TemplateInfoData> GetTemplatesInfo() { IEnumerable <TemplateInfoData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <TemplateInfoData>(); result = query.List <TemplateInfoData>(); }); return(result); }
public IEnumerable <FolderInfoData> GetSubsiteRootFolders() { IEnumerable <FolderInfoData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <FolderInfoData>(); query.AddExpressionEq <FolderInfoData, bool>(o => o.IsSubsiteRoot, true); result = query.List <FolderInfoData>(); }); return(result); }
public IEnumerable <FolderInfoData> GetFolders(FolderType folderType) { IEnumerable <FolderInfoData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <FolderInfoData>(); query.AddExpressionEq <FolderInfoData, FolderType>(o => o.FolderType, folderType); result = query.List <FolderInfoData>(); }); return(result); }
public ProjectData GetProjectByTaskId(object taskId) { ProjectData result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { IQuery query = CurrentSession.GetNamedQuery("GetProjectByTaskId"); query.SetInt32("taskId", (int)taskId); result = query.UniqueResult <ProjectData>(); }); return(result); }
public AliasInfoData GetAliasInfo(string alias) { AliasInfoData result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <AliasInfoData>(); query.AddExpressionEq <AliasInfoData, string>(o => o.UrlAlias, alias); result = query.UniqueResult <AliasInfoData>(); }); return(result); }
public IEnumerable <NotificationTemplateData> RetrieveByType(NotificationTypes type) { IEnumerable <NotificationTemplateData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { result = CurrentSession.CreateCriteria <NotificationTemplateData>() .AddExpressionEq <NotificationTemplateData, int>(o => o.NotificationTypeId, (int)type) .List <NotificationTemplateData>(); }); return(result); }
public IEnumerable <SubjectFieldInfoData> GetSubjectFieldInfosData(object subjectId) { IEnumerable <SubjectFieldInfoData> results = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { IQuery query = CurrentSession.GetNamedQuery("GetSubjectFieldInfosData"); query.SetParameter("subjectId", subjectId); results = query.List <SubjectFieldInfoData>(); }); return(results); }
public SubjectData RetrieveBySubjectType(string subjectType) { SubjectData result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { result = CurrentSession.CreateCriteria <SubjectData>() .AddExpressionInsensitiveLike <SubjectData, string>(o => o.SubjectType, subjectType, MatchMode.Exact) .UniqueResult <SubjectData>(); }); return(result); }
public SubsiteInfoData GetSubsiteInfo(object instanceId) { SubsiteInfoData result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <SubsiteInfoData>(); query.AddExpressionEq <SubsiteInfoData, object>(o => o.Id, instanceId); result = query.UniqueResult <SubsiteInfoData>(); }); return(result); }
public IEnumerable <LocationData> GetPublishedLocations() { IEnumerable <LocationData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <LocationData>(); query.AddExpressionEq <LocationData, bool>(o => o.IsPublished, true); result = query.List <LocationData>(); }); return(result); }
public TopicBriefInfoData GetTopicInfo(object topicId) { TopicBriefInfoData result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { IQuery query = CurrentSession.GetNamedQuery("GetTopicBriefInfo"); query.SetParameter("TopicId", topicId); result = query.UniqueResult <TopicBriefInfoData>(); }); return(result); }
public bool IsExists(string username) { bool isExists = false; RepositoryExceptionWrapper.Wrap(GetType(), () => { isExists = CurrentSession.CreateCriteria <AdministratorData>() .AddExpressionEq <AdministratorData, string>(o => o.Username, username) .SetProjection(Projections.RowCount()) .UniqueResult <int>() != 0; }); return(isExists); }
public AdministratorData RetrieveByCredential(string username, string password) { AdministratorData result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { result = CurrentSession.CreateCriteria <AdministratorData>() .AddExpressionEq <AdministratorData, string>(o => o.Username, username) .AddExpressionEq <AdministratorData, string>(o => o.Password, password) .UniqueResult <AdministratorData>(); }); return(result); }
public UserData RetrieveByCredential(string email, string password) { UserData result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { result = CurrentSession.CreateCriteria <UserData>() .AddExpressionEq <UserData, string>(o => o.Email, email) .AddExpressionEq <UserData, string>(o => o.Password, password) .UniqueResult <UserData>(); }); return(result); }
public UserData RetrieveByCredential(string username, string password) { UserData result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { result = CurrentSession.CreateCriteria <UserData>() .AddExpressionInsensitiveLike <UserData, string>(o => o.Username, username, MatchMode.Exact) .AddExpressionEq <UserData, string>(o => o.Password, password) .UniqueResult <UserData>(); }); return(result); }
public ProductInfoData RetrieveProductInfo(object productId) { ProductInfoData result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <ProductInfoData>(); query.AddExpressionEq <ProductInfoData, object>(o => o.ProductId, productId); result = query.UniqueResult <ProductInfoData>(); }); return(result); }
public IEnumerable <ScheduleEventData> SearchByEmployee(object employeeId) { ArgumentValidator.IsNotNull("employeeId", employeeId); IEnumerable <ScheduleEventData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { IQuery query = CurrentSession.GetNamedQuery("GetScheduleEventsByEmployee"); query.SetParameter("EmployeeId", employeeId); result = query.List <ScheduleEventData>(); }); 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); }
public SupplierInfoData RetrieveSupplierInfo(object supplierId) { SupplierInfoData result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <SupplierInfoData>(); query.AddExpressionEq <SupplierInfoData, object>(o => o.SupplierId, supplierId); result = query.UniqueResult <SupplierInfoData>(); }); return(result); }
public ReferenceInfoData GetReference(object id) { ArgumentValidator.IsNotNull("id", id); ReferenceInfoData result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <ReferenceInfoData>(); query.AddExpressionEq <ReferenceInfoData, object>(o => o.Id, id); result = query.UniqueResult <ReferenceInfoData>(); AttachAdditionalContent(result); }); return(result); }
public IEnumerable <OrderData> SearchByContact(object id) { ArgumentValidator.IsNotNull("id", id); IEnumerable <OrderData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <OrderData>(); query.AddExpressionEq <OrderData, object>(o => o.ContactId, id); result = query.List <OrderData>(); }); return(result); }
public IEnumerable <SubsiteBriefData> GetSubsites(bool isPublished = false) { IEnumerable <SubsiteBriefData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <SubsiteBriefData>(); if (isPublished) { query.AddExpressionEq <SubsiteBriefData, bool>(o => o.IsPublished, true); } result = query.List <SubsiteBriefData>(); }); return(result); }
public IEnumerable <ReferenceBriefData> GetList(int folderId, int pageIndex, int pageSize) { ArgumentValidator.IsNotNull("folderId", folderId); IList <ReferenceBriefData> results = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { IQuery query = CurrentSession.GetNamedQuery("GetReferenceBriefList"); query.SetParameter("folderId", folderId); query.SetInt32("pageIndex", pageIndex); query.SetInt32("pageSize", pageSize); results = query.List <ReferenceBriefData>(); }); return(results); }
public IEnumerable <NewsData> SearchByUser(object userId) { ArgumentValidator.IsNotNull("userId", userId); IEnumerable <NewsData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <NewsData>(); query.AddExpressionEq <NewsData, object>(o => o.IssuedById, userId); result = query.Future <NewsData>(); }); return(result); }
public IEnumerable <OpportunityData> SearchByCustomer(object customerId) { ArgumentValidator.IsNotNull("customerId", customerId); IEnumerable <OpportunityData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <OpportunityData>(); query.AddExpressionEq <OpportunityData, object>(o => o.CustomerId, customerId); result = query.Future <OpportunityData>(); }); return(result); }
public IEnumerable <ContactData> SearchByEmployee(object employeeId) { ArgumentValidator.IsNotNull("EmployeeId", employeeId); IEnumerable <ContactData> result = null; RepositoryExceptionWrapper.Wrap(GetType(), () => { ICriteria query = CurrentSession.CreateCriteria <ContactData>(); query.AddExpressionEq <ContactData, object>(o => o.EmployeeId, employeeId); result = query.Future <ContactData>(); }); return(result); }