コード例 #1
0
        public IEnumerable <ProductInfoData> Search(ProductCriteria criteria)
        {
            ArgumentValidator.IsNotNull("critetia", criteria);

            IEnumerable <ProductInfoData> result = null;

            RepositoryExceptionWrapper.Wrap(GetType(), () =>
            {
                ICriteria query = CurrentSession.CreateCriteria <ProductInfoData>();
                if (criteria.SupplierId != null)
                {
                    query.AddExpressionEq <ProductInfoData, object>(o => o.SupplierId, criteria.SupplierId);
                }
                if (criteria.CategoryId != null)
                {
                    query.AddExpressionEq <ProductInfoData, object>(o => o.CategoryId, criteria.CategoryId);
                }
                if (!string.IsNullOrEmpty(criteria.ProductName))
                {
                    query.AddExpressionInsensitiveLike <ProductInfoData, string>(o => o.Name, criteria.ProductName, MatchMode.Anywhere);
                }
                if (criteria.CatalogId != null)
                {
                    query.AddExpressionEq <ProductInfoData, object>(o => o.CatalogId, criteria.CatalogId);
                }

                result = query.List <ProductInfoData>();
            });

            return(result);
        }
コード例 #2
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);
        }
コード例 #3
0
        public IEnumerable <ReviewData> SearchByProduct(object id)
        {
            ArgumentValidator.IsNotNull("id", id);

            IEnumerable <ReviewData> result = null;

            RepositoryExceptionWrapper.Wrap(GetType(), () =>
            {
                ICriteria query = CurrentSession.CreateCriteria <ReviewData>();
                query.AddExpressionEq <ReviewData, object>(o => o.ObjectId, id);
                query.AddExpressionEq <ReviewData, int>(o => o.ObjectTypeId, (int)ReviewObjectTypes.Product);

                result = query.Future <ReviewData>();
            });

            return(result);
        }
コード例 #4
0
        public IEnumerable <ScheduleEventData> SearchByContact(object id)
        {
            ArgumentValidator.IsNotNull("id", id);

            IEnumerable <ScheduleEventData> result = null;

            RepositoryExceptionWrapper.Wrap(GetType(), () =>
            {
                ICriteria query = CurrentSession.CreateCriteria <ScheduleEventData>();
                query.AddExpressionEq <ScheduleEventData, int>(o => o.ObjectTypeId, (int)EventObjectTypes.Contact);
                query.AddExpressionEq <ScheduleEventData, object>(o => o.ObjectId, id);

                result = query.List <ScheduleEventData>();
            });

            return(result);
        }
コード例 #5
0
        public IEnumerable <OrderData> SearchBySupplierAndStatus(object supplierId, int statusId)
        {
            ArgumentValidator.IsNotNull("supplierId", supplierId);
            ArgumentValidator.IsNotNull("statusId", statusId);

            IEnumerable <OrderData> result = null;

            RepositoryExceptionWrapper.Wrap(GetType(), () =>
            {
                ICriteria query = CurrentSession.CreateCriteria <OrderData>();
                query.AddExpressionEq <OrderData, object>(o => o.SupplierId, supplierId);
                query.AddExpressionEq <OrderData, int>(o => o.StatusId, statusId);

                result = query.List <OrderData>();
            });

            return(result);
        }
コード例 #6
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);
        }
コード例 #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);
        }
コード例 #8
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);
        }
コード例 #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);
        }
コード例 #10
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);
        }
コード例 #11
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);
        }
コード例 #12
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);
        }
コード例 #13
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);
        }
コード例 #14
0
        public IEnumerable <CategoryData> RetrieveCategoryTree(object catalogId)
        {
            ArgumentValidator.IsNotNull("catalogId", catalogId);

            IEnumerable <CategoryData> result = null;

            RepositoryExceptionWrapper.Wrap(GetType(), () =>
            {
                ICriteria query = CurrentSession.CreateCriteria <CategoryData>();
                query.AddExpressionEq <CategoryData, object>(o => o.CatalogId, catalogId);

                result = query.Future <CategoryData>();
            });

            return(result);
        }
コード例 #15
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);
        }
コード例 #16
0
        public IEnumerable <ProductData> SearchBySupplier(object supplierId)
        {
            ArgumentValidator.IsNotNull("SupplierId", supplierId);

            IEnumerable <ProductData> result = null;

            RepositoryExceptionWrapper.Wrap(GetType(), () =>
            {
                ICriteria query = CurrentSession.CreateCriteria <ProductData>();
                query.AddExpressionEq <ProductData, object>(o => o.SupplierId, supplierId);

                result = query.Future <ProductData>();
            });

            return(result);
        }
コード例 #17
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);
        }
コード例 #18
0
        public IEnumerable <DataPhraseData> SearchByLanguage(object languageId)
        {
            ArgumentValidator.IsNotNull("languageId", languageId);

            IEnumerable <DataPhraseData> result = null;

            RepositoryExceptionWrapper.Wrap(GetType(), () =>
            {
                ICriteria query = CurrentSession.CreateCriteria <DataPhraseData>();
                query.AddExpressionEq <DataPhraseData, object>(o => o.LanguageId, languageId);

                result = query.Future <DataPhraseData>();
            });

            return(result);
        }
コード例 #19
0
        public IEnumerable <ShipToData> SearchByContactPhone(string phone)
        {
            ArgumentValidator.IsNotNull("phone", phone);

            IEnumerable <ShipToData> result = null;

            RepositoryExceptionWrapper.Wrap(GetType(), () =>
            {
                ICriteria query = CurrentSession.CreateCriteria <ShipToData>();
                query.AddExpressionEq <ShipToData, object>(o => o.ContactPhone, phone);

                result = query.List <ShipToData>();
            });

            return(result);
        }
コード例 #20
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);
        }
コード例 #21
0
        public IEnumerable <OrderData> SearchByCustomer(object customerId)
        {
            ArgumentValidator.IsNotNull("customerId", customerId);

            IEnumerable <OrderData> result = null;

            RepositoryExceptionWrapper.Wrap(GetType(), () =>
            {
                ICriteria query = CurrentSession.CreateCriteria <OrderData>();
                query.AddExpressionEq <OrderData, object>(o => o.CustomerId, customerId);

                result = query.List <OrderData>();
            });

            return(result);
        }