Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        public IEnumerable <TemplateInfoData> GetTemplatesInfo()
        {
            IEnumerable <TemplateInfoData> result = null;

            RepositoryExceptionWrapper.Wrap(GetType(), () =>
            {
                ICriteria query = CurrentSession.CreateCriteria <TemplateInfoData>();
                result          = query.List <TemplateInfoData>();
            });

            return(result);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        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);
        }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
        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);
        }
Ejemplo n.º 20
0
        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);
        }
Ejemplo n.º 22
0
        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);
        }
Ejemplo n.º 23
0
        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);
        }
Ejemplo n.º 24
0
        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);
        }
Ejemplo n.º 25
0
        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);
        }
Ejemplo n.º 26
0
        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);
        }
Ejemplo n.º 27
0
        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);
        }
Ejemplo n.º 28
0
        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);
        }
Ejemplo n.º 30
0
        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);
        }