Пример #1
1
        public EntityCollection<CatalogsEntity> GetAllParent(SortExpression sort)
        {
            EntityCollection<CatalogsEntity> cats = new EntityCollection<CatalogsEntity>();

            SortExpression _sort = new SortExpression();
            if (sort != null)
            {
                _sort = sort;
            }
            else
            {
                _sort.Add(CatalogsFields.CatalogName | SortOperator.Ascending);
            }

            IPredicateExpression predicate = new PredicateExpression();
            predicate.Add(CatalogsFields.ParentId == 0);
            predicate.AddWithAnd(CatalogsFields.IsVisible == true);

            RelationPredicateBucket filter = new RelationPredicateBucket();
            filter.PredicateExpression.Add(predicate);

            using (DataAccessAdapterBase adapter = new DataAccessAdapterFactory().CreateAdapter())
            {
                adapter.FetchEntityCollection(cats, filter, 0, _sort);
            }

            return cats;
        }
        public IList<Auction.Domain.Raffle> GetByEvent(long eventId,
                                        ref IAuctionTransaction trans)
        {
            using (var records = new RaffleCollection())
            {
                var filter = new PredicateExpression(RaffleFields.EventId == eventId);

                if (trans != null)
                {
                    trans.Add(records);
                }
                records.GetMulti(filter);
                return records.Select(
                        r =>
                        new Raffle()
                            {
                                CreatedBy = r.CreatedBy,
                                EventId = r.EventId,
                                Id = r.Id,
                                Name = r.Name,
                                Revenue = r.Total,
                                UpdatedBy = (long) r.UpdatedBy
                            }).ToList();
            }
        }
        public Event Get(long Id, ref IAuctionTransaction trans)
        {
            using (var records = new AuctionEventCollection())
            {
                var filter = new PredicateExpression(AuctionEventFields.Id == Id);

                if (trans != null)
                {
                    trans.Add(records);
                }
                records.GetMulti(filter, 1);
                var b = records.ToList().FirstOrDefault();
                return new Event()
                {
                    Id = Id,
                    Date = b.Date,
                    Name = b.Name,
                    AccountId = b.AccountId,
                    CreatedBy = b.CreatedBy,
                    Locked = b.Locked,
                    Notes = b.Notes,
                    UpdatedBy = b.UpdatedBy
                };
            }
        }
 public IList<Auction.Domain.Event> GetByAccount(long accountId,
                           ref IAuctionTransaction trans)
 {
     using (var records = new AuctionEventCollection())
     {
         var filter = new PredicateExpression(AuctionEventFields.AccountId == accountId);
         if (trans != null)
         {
             trans.Add(records);
         }
         records.GetMulti(filter, 0);
         return
             records.Select(
                 b =>
                 new Event()
                     {
                         Id = b.Id,
                         Date = b.Date,
                         Name = b.Name,
                         AccountId = b.AccountId,
                         CreatedBy = b.CreatedBy,
                         Locked = b.Locked,
                         Notes = b.Notes,
                         UpdatedBy = b.UpdatedBy
                     }).ToList();
     }
 }
 public ProviderQueryExpression(
     IEnumerable<ProviderPropertyExpression> providerProperties,
     ProjectionExpression projection,
     PredicateExpression predicate,
     SortExpressionCollectionExpression sort)
     : this(new ProviderPropertiesExpression(providerProperties), projection, predicate, sort)
 { }
 public Auction.Domain.Package Get(long Id, ref IAuctionTransaction trans)
 {
     using (var records = new PackageCollection())
     {
         var filter = new PredicateExpression(PackageFields.Id == Id);
         if (trans != null)
         {
             trans.Add(records);
         }
         records.GetMulti(filter, 1);
         var r = records.FirstOrDefault();
         return new Package()
                    {
                        BidderId = r.BidderId,
                        CategoryId = r.CategoryId,
                        ClosedOutBy = r.ClosedOutBy,
                        Code = r.Code,
                        CreatedBy = r.CreatedBy,
                        EndingBid = r.EndingBid,
                        EventId = r.EventId,
                        Id = r.Id,
                        Name = r.Name,
                        Notes = r.Notes,
                        Paid = (bool) r.Paid,
                        StartingBid = r.StartingBid,
                        UpdatedBy = r.UpdatedBy
                    };
     }
 }
Пример #7
0
        public static int Add(int seriesId, int season)
        {
            var entity = new SeasonEntity { SeasonNumber = season, SeriesId = seriesId };
            var filter = new PredicateExpression { SeasonFields.SeriesId == seriesId, SeasonFields.SeasonNumber == season };

            return Database.AddOrUpdateEntity(entity, filter, false).SeasonId;
        }
 public IList<Auction.Domain.Package> GetByCategory(long categoryId,
                            ref IAuctionTransaction trans)
 {
     using (var records = new PackageCollection())
     {
         var filter = new PredicateExpression(PackageFields.CategoryId == categoryId);
         if (trans != null)
         {
             trans.Add(records);
         }
         records.GetMulti(filter);
         return records.Select(r => new Package()
         {
             BidderId = r.BidderId,
             CategoryId = r.CategoryId,
             ClosedOutBy = r.ClosedOutBy,
             Code = r.Code,
             CreatedBy = r.CreatedBy,
             EndingBid = r.EndingBid,
             EventId = r.EventId,
             Id = r.Id,
             Name = r.Name,
             Notes = r.Notes,
             Paid = (bool)r.Paid,
             StartingBid = r.StartingBid,
             UpdatedBy = r.UpdatedBy
         }).ToList();
     }
 }
Пример #9
0
        public static bool HasEpisodeAttached(int fileId)
        {
            var filter = new PredicateExpression { EpisodeToFileFields.FileId == fileId };
            var entity = Database.GetEntityCollection<EpisodeToFileEntity>(new RelationPredicateBucket(filter));

            return entity.Any();
        }
Пример #10
0
        public static bool HasStream(int fileId)
        {
            var filter = new PredicateExpression { FileVideoStreamFields.FileId == fileId };
            var entity = Database.GetEntityCollection<FileVideoStreamEntity>(new RelationPredicateBucket(filter));

            return entity.Any();
        }
        public ProviderQueryExpression(
           ProviderPropertiesExpression providerPropertiesExpression,
           ProjectionExpression projection,
           PredicateExpression predicate)
            : this(providerPropertiesExpression, projection, predicate, null)
        {

        }
 public string GetTodayVisit()
 {
     WebTrackerCollection trackers = new WebTrackerCollection();
     PredicateExpression filter = new PredicateExpression();
     filter.Add(WebTrackerFields.VisitTime == DateTime.Parse(DateTime.Now.ToShortDateString()));
     trackers.GetMulti(filter);
     return trackers.Count.ToString();
 }
        public ProviderQueryExpression(
           IEnumerable<ProviderPropertyExpression> providerProperties,
           ProjectionExpression projection,
           PredicateExpression predicate)
            : this(providerProperties, projection, predicate, null)
        {

        }
Пример #14
0
        /// <summary>
        /// Does the search using MS Full text search
        /// </summary>
        /// <param name="searchString">Search string.</param>
        /// <param name="forumIDs">Forum Ids of forums to search into.</param>
        /// <param name="orderFirstElement">Order first element setting.</param>
        /// <param name="orderSecondElement">Order second element setting.</param>
        /// <param name="forumsWithThreadsFromOthers">The forums with threads from others.</param>
        /// <param name="userID">The userid of the calling user.</param>
        /// <param name="targetToSearch">The target to search.</param>
        /// <returns>
        /// TypedList filled with threads matching the query.
        /// </returns>
        public static SearchResultTypedList DoSearch(string searchString, List<int> forumIDs, SearchResultsOrderSetting orderFirstElement,
            SearchResultsOrderSetting orderSecondElement, List<int> forumsWithThreadsFromOthers, int userID, SearchTarget targetToSearch)
        {
            // the search utilizes full text search. It performs a CONTAINS upon the MessageText field of the Message entity.
            string searchTerms = PrepareSearchTerms(searchString);
            bool searchMessageText = (targetToSearch == SearchTarget.MessageText) || (targetToSearch == SearchTarget.MessageTextAndThreadSubject);
            bool searchSubject = (targetToSearch == SearchTarget.ThreadSubject) || (targetToSearch == SearchTarget.MessageTextAndThreadSubject);
            if(!(searchSubject || searchMessageText))
            {
                // no target specified, select message
                searchMessageText = true;
            }

            PredicateExpression searchTermFilter = new PredicateExpression();
            if(searchMessageText)
            {
                // Message contents filter
                searchTermFilter.Add(new FieldCompareSetPredicate(ThreadFields.ThreadID, MessageFields.ThreadID,
                                    SetOperator.In, new FieldFullTextSearchPredicate(MessageFields.MessageText, FullTextSearchOperator.Contains, searchTerms)));
            }
            if(searchSubject)
            {
                // Thread subject filter
                if(searchMessageText)
                {
                    searchTermFilter.AddWithOr(new FieldFullTextSearchPredicate(ThreadFields.Subject, FullTextSearchOperator.Contains, searchTerms));
                }
                else
                {
                    searchTermFilter.Add(new FieldFullTextSearchPredicate(ThreadFields.Subject, FullTextSearchOperator.Contains, searchTerms));
                }
            }
            IPredicateExpression mainFilter = searchTermFilter
                                                    .And(ForumFields.ForumID == forumIDs)
                                                    .And(ThreadGuiHelper.CreateThreadFilter(forumsWithThreadsFromOthers, userID));

            ISortExpression sorter = new SortExpression();
            // add first element
            sorter.Add(CreateSearchSortClause(orderFirstElement));
            if(orderSecondElement != orderFirstElement)
            {
                sorter.Add(CreateSearchSortClause(orderSecondElement));
            }

            SearchResultTypedList results = new SearchResultTypedList(false);

            try
            {
                // get the data from the db.
                results.Fill(500, sorter, false, mainFilter);
            }
            catch
            {
                // probably an error with the search words / user error. Swallow for now, which will result in an empty resultset.
            }

            return results;
        }
 public ProviderQueryExpression(
     ProviderPropertiesExpression providerPropertiesExpression,
     ProjectionExpression projection,
     PredicateExpression predicate,
     SortExpressionCollectionExpression sort)
     : base(projection, predicate, sort)
 {
     _providerPropertiesExpression = providerPropertiesExpression;
 }
        public CategoryCollection GetMainCategories()
        {
            CategoryCollection categories = new CategoryCollection();
            PredicateExpression filter = new PredicateExpression();
            filter.Add(new FieldCompareNullPredicate(CategoryFields.BaseCategoryId));
            categories.GetMulti(filter);

            return categories;
        }
Пример #17
0
 /// <summary>Retrieves in the calling AuditActionCollection object all AuditActionEntity objects which are related via a relation of type 'm:n' with the passed in RoleEntity.</summary>
 /// <param name="containingTransaction">A containing transaction, if caller is added to a transaction, or null if not.</param>
 /// <param name="collectionToFill">Collection to fill with the entity objects retrieved</param>
 /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query. When set to 0, no limitations are specified.</param>
 /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
 /// <param name="entityFactoryToUse">The EntityFactory to use when creating entity objects during a GetMulti() call.</param>
 /// <param name="roleInstance">RoleEntity object to be used as a filter in the m:n relation</param>
 /// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch.</param>
 /// <param name="pageNumber">The page number to retrieve.</param>
 /// <param name="pageSize">The page size of the page to retrieve.</param>
 /// <returns>true if succeeded, false otherwise</returns>
 public bool GetMultiUsingRolesWithAuditAction(ITransaction containingTransaction, IEntityCollection collectionToFill, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IEntityFactory entityFactoryToUse, IEntity roleInstance, IPrefetchPath prefetchPathToUse, int pageNumber, int pageSize)
 {
     RelationCollection relations = new RelationCollection();
     relations.Add(AuditActionEntity.Relations.RoleAuditActionEntityUsingAuditActionID, "RoleAuditAction_");
     relations.Add(RoleAuditActionEntity.Relations.RoleEntityUsingRoleID, "RoleAuditAction_", string.Empty, JoinHint.None);
     IPredicateExpression selectFilter = new PredicateExpression();
     selectFilter.Add(new FieldCompareValuePredicate(roleInstance.Fields[(int)RoleFieldIndex.RoleID], ComparisonOperator.Equal));
     return this.GetMulti(containingTransaction, collectionToFill, maxNumberOfItemsToReturn, sortClauses, entityFactoryToUse, selectFilter, relations, prefetchPathToUse, pageNumber, pageSize);
 }
        /// <summary>
        /// Returns valid entities which are valid for given moment in time.
        /// Valid entities have:
        /// 1. Begining is not NULL AND is LESS than given moment in time.
        /// 2. End is NULL OR is GREATER OR EQUAL than given moment in time.
        /// </summary>
        public static PredicateExpression FilterValidEntities(DateTime momentInTime,
            EntityField2 validFromDateTimeField,
            EntityField2 validToDateTimeField)
        {
            PredicateExpression predicateExpression = new PredicateExpression();
            predicateExpression.Add(validFromDateTimeField != DBNull.Value & validFromDateTimeField <= momentInTime);
            predicateExpression.AddWithAnd(validToDateTimeField == DBNull.Value | validToDateTimeField >= momentInTime);

            return predicateExpression;
        }
Пример #19
0
        public static void Add(int artworkId, int roleId)
        {
            var entity = new ArtworkToRoleEntity();
            entity.ArtworkId = artworkId;
            entity.RoleId = roleId;

            var filter = new PredicateExpression();
            filter.Add(ArtworkToRoleFields.ArtworkId == artworkId);
            filter.Add(ArtworkToRoleFields.RoleId == roleId);
            Database.AddOrUpdateEntity(entity, filter, false);
        }
 public void Delete(long Id, ref IAuctionTransaction trans)
 {
     using (var records = new CategoryCollection())
     {
         var filter = new PredicateExpression(CategoryFields.Id == Id);
         if (trans != null)
         {
             trans.Add(records);
         }
         records.DeleteMulti(filter);
     }
 }
Пример #21
0
 public bool EventExists(long id, ref IAuctionTransaction trans)
 {
     using (var records = new AuctionEventCollection())
     {
         var filter = new PredicateExpression(AuctionEventFields.Id == id);
         if (trans != null)
         {
             trans.Add(records);
         }
         return records.GetDbCount(filter) > 0;
     }
 }
 public MembershipEntity GetMember(string uName, string password)
 {
     MembershipCollection memberships = new MembershipCollection();
     PredicateExpression filter = new PredicateExpression();
     filter.AddWithAnd(MembershipFields.UserName == uName);
     filter.AddWithAnd(MembershipFields.Password == Business.Encryption.SHA1Encryption.EncryptMessage(password));
     filter.AddWithAnd(MembershipFields.Status == true);
     memberships.GetMulti(filter);
     if (memberships.Count > 0)
         return memberships.FirstOrDefault();
     else
         return null;
 }
 public int GetAllowableEventCount(long accountId,
                                   ref IAuctionTransaction trans)
 {
     using (var records = new AccountCollection())
     {
         var filter = new PredicateExpression(AccountFields.Id == accountId);
         if (trans != null)
         {
             trans.Add(records);
         }
         records.GetMulti(filter, 1);
         return records.ToList().First().AllowableEvents;
     }
 }
Пример #24
0
        public static int GetId(int importPathId, string relativeFileName)
        {
            var filter = new PredicateExpression { FileFields.ImportPathId == importPathId, FileFields.RelativeFileName == relativeFileName };
            var entity = Database.GetUniqueEntity<FileEntity>(filter);
            if (entity.IsNew)
            {
                entity.ImportPathId = importPathId;
                entity.RelativeFileName = relativeFileName;
                entity.FileExtension = Path.GetExtension(relativeFileName);
                entity = Database.AddEntity(entity, false);
            }

            return entity.FileId;
        }
        public IList<Category> GetByAccount(long accountId, ref IAuctionTransaction trans)
        {
            using (var records = new CategoryCollection())
            {
                var filter = new PredicateExpression(CategoryFields.AccountId == accountId);

                if (trans != null)
                {
                    trans.Add(records);
                }
                records.GetMulti(filter, 0);
                return records.ToList().Select(c => new Category() { Id = c.Id, Name = c.Name, AccountId = c.AccountId }).ToList();
            }
        }
Пример #26
0
        public SelectList subjectAttributes(object selObjId)
        {
            if (m_subjectAttributes == null)
            {
                m_subjectAttributes = new AttributeCollection();
                RelationCollection rels = new RelationCollection(AttributeEntity.Relations.ContextEntityUsingContextId);
                PredicateExpression pe = new PredicateExpression(ContextFields.Name == "subject");
                SortExpression se = new SortExpression(AttributeFields.Name | SortOperator.Ascending);
                m_subjectAttributes.GetMulti(pe, 0, se, rels);
            }

            SelectList selList = new SelectList(m_subjectAttributes, "Id", "Name", selObjId);
            return selList;
        }
Пример #27
0
        public SelectList subjectAttributes(object selObjId)
        {
            if (m_subjectAttributes == null)
            {
                m_subjectAttributes = new AttributeCollection();
                RelationCollection  rels = new RelationCollection(AttributeEntity.Relations.ContextEntityUsingContextId);
                PredicateExpression pe   = new PredicateExpression(ContextFields.Name == "subject");
                SortExpression      se   = new SortExpression(AttributeFields.Name | SortOperator.Ascending);
                m_subjectAttributes.GetMulti(pe, 0, se, rels);
            }

            SelectList selList = new SelectList(m_subjectAttributes, "Id", "Name", selObjId);

            return(selList);
        }
Пример #28
0
        public static int GetDaysSupportRequests()
        {
            SupportIssueCollection supportIssueCollection = new SupportIssueCollection();

            try
            {
                PredicateExpression filter = new PredicateExpression(SupportIssueFields.CreateTime >= DateTime.Now.Date);
                filter.AddWithAnd(SupportIssueFields.CreateTime < DateTime.Now.Date.AddDays(1));
                return(supportIssueCollection.GetDbCount(filter));
            }
            catch
            {
                return(0);
            }
        }
Пример #29
0
        public int DeleteByAdvertPositionId(Guid AdvertPositionId)
        {
            int toReturn = 0;
            RelationPredicateBucket filter = new RelationPredicateBucket();

            IPredicateExpression _PredicateExpression = new PredicateExpression();
            _PredicateExpression.Add(AdvertsGroupFields.AdvertPositionId == AdvertPositionId);
            filter.PredicateExpression.Add(_PredicateExpression);

            using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                toReturn = adapter.DeleteEntitiesDirectly("AdvertsGroupEntity", filter);
            }
            return toReturn;
        }
Пример #30
0
        public int DeleteByPropertyNames(string PropertyNames)
        {
            int toReturn = 0;
            RelationPredicateBucket filter = new RelationPredicateBucket();

            IPredicateExpression _PredicateExpression = new PredicateExpression();
            _PredicateExpression.Add(AspnetProfileFields.PropertyNames == PropertyNames);
            filter.PredicateExpression.Add(_PredicateExpression);

            using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                toReturn = adapter.DeleteEntitiesDirectly("AspnetProfileEntity", filter);
            }
            return toReturn;
        }
Пример #31
0
        public int DeleteByLastUpdatedDate(DateTime LastUpdatedDate)
        {
            int toReturn = 0;
            RelationPredicateBucket filter = new RelationPredicateBucket();

            IPredicateExpression _PredicateExpression = new PredicateExpression();
            _PredicateExpression.Add(AspnetProfileFields.LastUpdatedDate == LastUpdatedDate);
            filter.PredicateExpression.Add(_PredicateExpression);

            using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                toReturn = adapter.DeleteEntitiesDirectly("AspnetProfileEntity", filter);
            }
            return toReturn;
        }
Пример #32
0
        public static int GetActiveDevices()
        {
            DeviceCollection ecDeviceCollection = new DeviceCollection();

            try
            {
                PredicateExpression filter = new PredicateExpression(DeviceFields.LastReportTime >= DateTime.Now.Date);
                filter.AddWithAnd(DeviceFields.LastReportTime < DateTime.Now.Date.AddDays(1));
                return(ecDeviceCollection.GetDbCount(filter));
            }
            catch
            {
                return(0);
            }
        }
Пример #33
0
 /// <summary> Retrieves all related entities of type 'CustomerEntity' using a relation of type 'm:n'.</summary>
 /// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
 /// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
 /// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
 public SD.LLBLGen.Pro.Examples.Auditing.CollectionClasses.CustomerCollection GetMultiCustomersCollectionViaCustomerCustomerDemo(bool forceFetch, IEntityFactory entityFactoryToUse)
 {
     if ((!_alreadyFetchedCustomersCollectionViaCustomerCustomerDemo || forceFetch || _alwaysFetchCustomersCollectionViaCustomerCustomerDemo) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         AddToTransactionIfNecessary(_customersCollectionViaCustomerCustomerDemo);
         IPredicateExpression filter = new PredicateExpression();
         filter.Add(new FieldCompareValuePredicate(CustomerDemographyFields.CustomerTypeId, ComparisonOperator.Equal, this.CustomerTypeId, "CustomerDemographyEntity__"));
         _customersCollectionViaCustomerCustomerDemo.SuppressClearInGetMulti = !forceFetch;
         _customersCollectionViaCustomerCustomerDemo.EntityFactoryToUse      = entityFactoryToUse;
         _customersCollectionViaCustomerCustomerDemo.GetMulti(filter, GetRelationsForField("CustomersCollectionViaCustomerCustomerDemo"));
         _customersCollectionViaCustomerCustomerDemo.SuppressClearInGetMulti = false;
         _alreadyFetchedCustomersCollectionViaCustomerCustomerDemo           = true;
     }
     return(_customersCollectionViaCustomerCustomerDemo);
 }
Пример #34
0
 /// <summary> Retrieves all related entities of type 'AuditActionTypeEntity' using a relation of type 'm:n'.</summary>
 /// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
 /// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
 /// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
 public SD.LLBLGen.Pro.Examples.Auditing.CollectionClasses.AuditActionTypeCollection GetMultiAuditActionTypeCollectionViaAuditInfo(bool forceFetch, IEntityFactory entityFactoryToUse)
 {
     if ((!_alreadyFetchedAuditActionTypeCollectionViaAuditInfo || forceFetch || _alwaysFetchAuditActionTypeCollectionViaAuditInfo) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         AddToTransactionIfNecessary(_auditActionTypeCollectionViaAuditInfo);
         IPredicateExpression filter = new PredicateExpression();
         filter.Add(new FieldCompareValuePredicate(UserFields.UserId, ComparisonOperator.Equal, this.UserId, "UserEntity__"));
         _auditActionTypeCollectionViaAuditInfo.SuppressClearInGetMulti = !forceFetch;
         _auditActionTypeCollectionViaAuditInfo.EntityFactoryToUse      = entityFactoryToUse;
         _auditActionTypeCollectionViaAuditInfo.GetMulti(filter, GetRelationsForField("AuditActionTypeCollectionViaAuditInfo"));
         _auditActionTypeCollectionViaAuditInfo.SuppressClearInGetMulti = false;
         _alreadyFetchedAuditActionTypeCollectionViaAuditInfo           = true;
     }
     return(_auditActionTypeCollectionViaAuditInfo);
 }
Пример #35
0
        public static Int64 GetDaysExceptions()
        {
            ExceptionLogCollection exceptionLogCollection = new ExceptionLogCollection();

            try
            {
                PredicateExpression filter = new PredicateExpression(ExceptionLogFields.ReceivedTime >= DateTime.Now.Date);
                filter.AddWithAnd(ExceptionLogFields.ReceivedTime < DateTime.Now.Date.AddDays(1));
                return(exceptionLogCollection.GetDbCount(filter));
            }
            catch
            {
                return(0L);
            }
        }
Пример #36
0
        public int DeleteByNewsletterId(Guid NewsletterId)
        {
            int toReturn = 0;
            RelationPredicateBucket filter = new RelationPredicateBucket();

            IPredicateExpression _PredicateExpression = new PredicateExpression();
            _PredicateExpression.Add(NewsletterInProductFields.NewsletterId == NewsletterId);
            filter.PredicateExpression.Add(_PredicateExpression);

            using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                toReturn = adapter.DeleteEntitiesDirectly("NewsletterInProductEntity", filter);
            }
            return toReturn;
        }
 /// <summary> Retrieves all related entities of type 'SupplierEntity' using a relation of type 'm:n'.</summary>
 /// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
 /// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
 /// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
 public SD.LLBLGen.Pro.Examples.Auditing.CollectionClasses.SupplierCollection GetMultiSuppliersCollectionViaProducts(bool forceFetch, IEntityFactory entityFactoryToUse)
 {
     if ((!_alreadyFetchedSuppliersCollectionViaProducts || forceFetch || _alwaysFetchSuppliersCollectionViaProducts) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         AddToTransactionIfNecessary(_suppliersCollectionViaProducts);
         IPredicateExpression filter = new PredicateExpression();
         filter.Add(new FieldCompareValuePredicate(CategoryFields.CategoryId, ComparisonOperator.Equal, this.CategoryId, "CategoryEntity__"));
         _suppliersCollectionViaProducts.SuppressClearInGetMulti = !forceFetch;
         _suppliersCollectionViaProducts.EntityFactoryToUse      = entityFactoryToUse;
         _suppliersCollectionViaProducts.GetMulti(filter, GetRelationsForField("SuppliersCollectionViaProducts"));
         _suppliersCollectionViaProducts.SuppressClearInGetMulti = false;
         _alreadyFetchedSuppliersCollectionViaProducts           = true;
     }
     return(_suppliersCollectionViaProducts);
 }
Пример #38
0
 /// <summary> Retrieves all related entities of type 'EmployeeEntity' using a relation of type 'm:n'.</summary>
 /// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
 /// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
 /// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
 public SD.LLBLGen.Pro.Examples.Auditing.CollectionClasses.EmployeeCollection GetMultiEmployeesCollectionViaOrders(bool forceFetch, IEntityFactory entityFactoryToUse)
 {
     if ((!_alreadyFetchedEmployeesCollectionViaOrders || forceFetch || _alwaysFetchEmployeesCollectionViaOrders) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         AddToTransactionIfNecessary(_employeesCollectionViaOrders);
         IPredicateExpression filter = new PredicateExpression();
         filter.Add(new FieldCompareValuePredicate(ShipperFields.ShipperId, ComparisonOperator.Equal, this.ShipperId, "ShipperEntity__"));
         _employeesCollectionViaOrders.SuppressClearInGetMulti = !forceFetch;
         _employeesCollectionViaOrders.EntityFactoryToUse      = entityFactoryToUse;
         _employeesCollectionViaOrders.GetMulti(filter, GetRelationsForField("EmployeesCollectionViaOrders"));
         _employeesCollectionViaOrders.SuppressClearInGetMulti = false;
         _alreadyFetchedEmployeesCollectionViaOrders           = true;
     }
     return(_employeesCollectionViaOrders);
 }
    /// <summary>
    /// Handles the Click event of the btnSearchSubSet control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnSearchSubSet_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        _filter = new PredicateExpression();
        IPredicate toAdd = null;

        if (chkEnableShipperId.Checked)
        {
            string fromValueAsString = tbxShipperIdMiFrom.Text;
            string toValueAsString   = tbxShipperIdMiTo.Text;
            toAdd = GeneralUtils.CreatePredicate(ShipperFields.ShipperId, Convert.ToInt32(opShipperId.SelectedValue), chkNotShipperId.Checked,
                                                 fromValueAsString, toValueAsString);
            if (toAdd != null)
            {
                _filter.Add(toAdd);
            }
        }
        if (chkEnableCompanyName.Checked)
        {
            string fromValueAsString = tbxCompanyNameMiFrom.Text;
            string toValueAsString   = string.Empty;
            toAdd = GeneralUtils.CreatePredicate(ShipperFields.CompanyName, Convert.ToInt32(opCompanyName.SelectedValue), chkNotCompanyName.Checked,
                                                 fromValueAsString, toValueAsString);
            if (toAdd != null)
            {
                _filter.Add(toAdd);
            }
        }
        if (chkEnablePhone.Checked)
        {
            string fromValueAsString = tbxPhoneMiFrom.Text;
            string toValueAsString   = string.Empty;
            toAdd = GeneralUtils.CreatePredicate(ShipperFields.Phone, Convert.ToInt32(opPhone.SelectedValue), chkNotPhone.Checked,
                                                 fromValueAsString, toValueAsString);
            if (toAdd != null)
            {
                _filter.Add(toAdd);
            }
        }
        if (SearchClicked != null)
        {
            SearchClicked(this, new EventArgs());
        }
    }
Пример #40
0
        public ActionResult DecisionNodeOrder(policyData vData, int id, int id2, int linkId, FormCollection collection)
        {
            DecisionNodeEntity     match = new DecisionNodeEntity(id2);
            DecisionNodeCollection coll  = new DecisionNodeCollection();

            PredicateExpression pe = new PredicateExpression(DecisionNodeFields.Id != match.Id);

            pe.Add(DecisionNodeFields.ParentId == id);
            SortExpression se = null;

            if (collection["up"] != null)
            {
                // Find all categories with display index less than ours.
                pe.Add(DecisionNodeFields.Order <= match.Order);

                // Order by display index, highest first.
                se = new SortExpression(DecisionNodeFields.Order | SortOperator.Descending);
            }
            else
            {
                // Find all categories with display index greater than ours.
                pe.Add(DecisionNodeFields.Order >= match.Order);

                // Order by display index, lowest first.
                se = new SortExpression(DecisionNodeFields.Order | SortOperator.Ascending);
            }

            // Swap with closest one.
            if (coll.GetMulti(pe, 1, se) && coll.Count > 0)
            {
                int temp = coll[0].Order;
                coll[0].Order = match.Order;
                match.Order   = temp;

                match.Save();
                coll.SaveMulti();
            }

            string action = collection["backTo"];

            if (action == "EditRule")
            {
                vData.Condition = new DecisionNodeEntity(id);
                id = vData.Condition.Rule[0].Id;
            }

            return(RedirectToAction(action, new { id = id, linkId = linkId }));
        }
    /// <summary>
    /// Handles the Click event of the btnSearchSubSet control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnSearchSubSet_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        _filter = new PredicateExpression();
        IPredicate toAdd = null;

        if (chkEnableCategoryId.Checked)
        {
            string fromValueAsString = tbxCategoryIdMiFrom.Text;
            string toValueAsString   = tbxCategoryIdMiTo.Text;
            toAdd = GeneralUtils.CreatePredicate(CategoryFields.CategoryId, Convert.ToInt32(opCategoryId.SelectedValue), chkNotCategoryId.Checked,
                                                 fromValueAsString, toValueAsString);
            if (toAdd != null)
            {
                _filter.Add(toAdd);
            }
        }
        if (chkEnableCategoryName.Checked)
        {
            string fromValueAsString = tbxCategoryNameMiFrom.Text;
            string toValueAsString   = string.Empty;
            toAdd = GeneralUtils.CreatePredicate(CategoryFields.CategoryName, Convert.ToInt32(opCategoryName.SelectedValue), chkNotCategoryName.Checked,
                                                 fromValueAsString, toValueAsString);
            if (toAdd != null)
            {
                _filter.Add(toAdd);
            }
        }
        if (chkEnableDescription.Checked)
        {
            string fromValueAsString = tbxDescriptionMiFrom.Text;
            string toValueAsString   = string.Empty;
            toAdd = GeneralUtils.CreatePredicate(CategoryFields.Description, Convert.ToInt32(opDescription.SelectedValue), chkNotDescription.Checked,
                                                 fromValueAsString, toValueAsString);
            if (toAdd != null)
            {
                _filter.Add(toAdd);
            }
        }
        if (SearchClicked != null)
        {
            SearchClicked(this, new EventArgs());
        }
    }
    /// <summary>
    /// Handles the Click event of the btnSearchSubSet control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnSearchSubSet_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        _filter = new PredicateExpression();
        IPredicate toAdd = null;

        if (chkEnableUserId.Checked)
        {
            string fromValueAsString = tbxUserIdMiFrom.Text;
            string toValueAsString   = string.Empty;
            toAdd = GeneralUtils.CreatePredicate(UserFields.UserId, Convert.ToInt32(opUserId.SelectedValue), chkNotUserId.Checked,
                                                 fromValueAsString, toValueAsString);
            if (toAdd != null)
            {
                _filter.Add(toAdd);
            }
        }
        if (chkEnablePassword.Checked)
        {
            string fromValueAsString = tbxPasswordMiFrom.Text;
            string toValueAsString   = string.Empty;
            toAdd = GeneralUtils.CreatePredicate(UserFields.Password, Convert.ToInt32(opPassword.SelectedValue), chkNotPassword.Checked,
                                                 fromValueAsString, toValueAsString);
            if (toAdd != null)
            {
                _filter.Add(toAdd);
            }
        }
        if (chkEnableFullName.Checked)
        {
            string fromValueAsString = tbxFullNameMiFrom.Text;
            string toValueAsString   = string.Empty;
            toAdd = GeneralUtils.CreatePredicate(UserFields.FullName, Convert.ToInt32(opFullName.SelectedValue), chkNotFullName.Checked,
                                                 fromValueAsString, toValueAsString);
            if (toAdd != null)
            {
                _filter.Add(toAdd);
            }
        }
        if (SearchClicked != null)
        {
            SearchClicked(this, new EventArgs());
        }
    }
Пример #43
0
        public ProductCollection GetRelatedProducts(int pid)
        {
            ProductEntity product = new ProductEntity(pid);

            ProductKeywordCollection productKeywords = new ProductKeywordCollection();

            productKeywords.GetMulti(null);
            List <int> keywordIds = new List <int>();

            foreach (ProductKeywordEntity item in product.ProductKeywords)
            {
                keywordIds.Add(item.KeywordId);
            }
            //var relatedProductIds = from rp in productKeywords
            //                        group rp by new { ProductID = rp.ProductId, KeywordID = rp.KeywordId } into g
            //                        where keywordIds.Contains(g.Key.KeywordID) && g.Key.KeywordID != 2
            //                        select new
            //                        {
            //                            Key = g.Key
            //                            ,
            //                            Count = g.Select(p => p.ProductId).Count()
            //                        }; // into g  //select new {RCount=g.Key //where keywordIds.Contains(rp.KeywordId) && rp.ProductId != 2 select new { rp.ProductId };


            var relatedProductIds = productKeywords.Where(p => keywordIds.Contains(p.KeywordId) && p.ProductId != pid).GroupBy(g => g.ProductId).Select(gr => new
            {
                ProductId           = gr.Key,
                RelatedKeywordCount = gr.Count()
            }).OrderByDescending(f => f.RelatedKeywordCount).Take(5);


            ArrayList ids = new ArrayList();

            foreach (var item in relatedProductIds)
            {
                ids.Add(item.ProductId);
            }

            //Related Products
            ProductCollection   productList = new ProductCollection();
            PredicateExpression filter      = new PredicateExpression();

            filter.Add(new FieldCompareRangePredicate(ProductFields.Id, ids));
            filter.Add(ProductFields.Status == true);
            productList.GetMulti(filter);

            return(productList);
        }
Пример #44
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="isreadonly">The Is Read Only Flag of the requested entity.</param>
        /// <returns>EntityCollection<ModuleInstanceEntity></returns>
        public static EntityCollection <ModuleInstanceEntity> SelectByIsReadOnly(System.Boolean isreadonly)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleInstanceFields.IsReadOnly == isreadonly);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleInstanceEntity> modulesinstances = new EntityCollection <ModuleInstanceEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(modulesinstances, bucket);
            return(modulesinstances);
        }
Пример #45
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="nametag">The Name Tag of the requested entity.</param>
        /// <returns>EntityCollection<ModuleInstanceEntity></returns>
        public static EntityCollection <ModuleInstanceEntity> SelectByNameTag(System.String nametag)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleInstanceFields.NameTag == nametag);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleInstanceEntity> modulesinstances = new EntityCollection <ModuleInstanceEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(modulesinstances, bucket);
            return(modulesinstances);
        }
Пример #46
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="name">The name of the requested action entity.</param>
        /// <returns>EntityCollection<ActionEntity></returns>
        public static EntityCollection <ActionEntity> SelectByName(string name)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ActionFields.Name == name);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ActionEntity> actions = new EntityCollection <ActionEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(actions, bucket);
            return(actions);
        }
Пример #47
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="instancesallowed">The Instances Allowed of the requested entity.</param>
        /// <returns>EntityCollection<ModuleSetModuleEntity></returns>
        public static EntityCollection <ModuleSetModuleEntity> SelectByInstancesAllowed(System.Int32 instancesallowed)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleSetModuleFields.InstancesAllowed == instancesallowed);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleSetModuleEntity> mse = new EntityCollection <ModuleSetModuleEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(mse, bucket);
            return(mse);
        }
Пример #48
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="name">The Name of the requested entity.</param>
        /// <returns>EntityCollection<ModuleSetEntity></returns>
        public static EntityCollection <ModuleSetEntity> SelectByName(System.String name)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleSetFields.Name == name);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleSetEntity> mse = new EntityCollection <ModuleSetEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(mse, bucket);
            return(mse);
        }
Пример #49
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="isbuiltin">The IsBuiltin Flag of the requested entity.</param>
        /// <returns>EntityCollection<ModuleSetEntity></returns>
        public static EntityCollection <ModuleSetEntity> SelectByIsBuiltin(System.Boolean isbuiltin)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleSetFields.IsBuiltIn == isbuiltin);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleSetEntity> mse = new EntityCollection <ModuleSetEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(mse, bucket);
            return(mse);
        }
Пример #50
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="name">The Name of the requested entity.</param>
        /// <returns>EntityCollection<SiteTypeEntity></returns>
        public static EntityCollection <SiteTypeEntity> SelectByName(System.String name)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(SiteTypeFields.Name == name);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <SiteTypeEntity> sitestype = new EntityCollection <SiteTypeEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(sitestype, bucket);
            return(sitestype);
        }
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="guid">The TemplateGUID of the requested entity.</param>
        /// <returns>EntityCollection<TemplateChunksEntity></returns>
        public static EntityCollection <TemplateChunksEntity> SelectByTemplateGUID(Guid guid)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(TemplateChunksFields.TemplateGUID == guid);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <TemplateChunksEntity> templatechunks = new EntityCollection <TemplateChunksEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(templatechunks, bucket);
            return(templatechunks);
        }
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="currentsubsitecount">The CurrentSubSiteCount of the requested entity.</param>
        /// <returns>EntityCollection<SiteSubSiteInfoEntity></returns>
        public static EntityCollection <SiteSubSiteInfoEntity> SelectByCurrentSubSiteCount(int currentsubsitecount)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(SiteSubSiteInfoFields.CurrentSubSiteCount == currentsubsitecount);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <SiteSubSiteInfoEntity> sitenetinfo = new EntityCollection <SiteSubSiteInfoEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(sitenetinfo, bucket);
            return(sitenetinfo);
        }
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="siteuid">The SiteUID of the requested entity.</param>
        /// <returns>EntityCollection<SiteSubSiteInfoEntity></returns>
        public static EntityCollection <SiteSubSiteInfoEntity> SelectBySiteUID(int siteuid)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(SiteSubSiteInfoFields.SiteUID == siteuid);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <SiteSubSiteInfoEntity> sitenetinfo = new EntityCollection <SiteSubSiteInfoEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(sitenetinfo, bucket);
            return(sitenetinfo);
        }
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="etguid">The Entity Type GUID of the requested entity.</param>
        /// <returns>EntityCollection<GroupEntityPermissionEntity></returns>
        public static EntityCollection <GroupEntityPermissionEntity> SelectByEntityTypeGUID(System.Guid etguid)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(GroupEntityPermissionFields.EntityTypeGUID == etguid);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <GroupEntityPermissionEntity> permissions = new EntityCollection <GroupEntityPermissionEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(permissions, bucket);
            return(permissions);
        }
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="allow">The Allow flag of the requested entity.</param>
        /// <returns>EntityCollection<GroupEntityPermissionEntity></returns>
        public static EntityCollection <GroupEntityPermissionEntity> SelectByAllow(System.Boolean allow)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(GroupEntityPermissionFields.Allow == allow);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <GroupEntityPermissionEntity> permissions = new EntityCollection <GroupEntityPermissionEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(permissions, bucket);
            return(permissions);
        }
Пример #56
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="dt">The Edit Time of the requested entity.</param>
        /// <returns>EntityCollection<ModuleInstanceEntity></returns>
        public static EntityCollection <ModuleInstanceEntity> SelectByEditTime(System.DateTime dt)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleInstanceFields.EditTime == dt);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleInstanceEntity> modulesinstances = new EntityCollection <ModuleInstanceEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(modulesinstances, bucket);
            return(modulesinstances);
        }
Пример #57
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="edittime">The Edit Time of the requested entity.</param>
        /// <returns>EntityCollection<TemplateEntity></returns>
        public static EntityCollection <TemplateEntity> SelectByEditTime(System.DateTime edittime)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(TemplateFields.EditTime == edittime);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <TemplateEntity> templates = new EntityCollection <TemplateEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(templates, bucket);
            return(templates);
        }
Пример #58
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="ouid">The Owner UID of the requested entity.</param>
        /// <returns>EntityCollection<TemplateEntity></returns>
        public static EntityCollection <TemplateEntity> SelectByOwnerUID(System.Int32 ouid)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(TemplateFields.OwnerUID == ouid);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <TemplateEntity> templates = new EntityCollection <TemplateEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(templates, bucket);
            return(templates);
        }
Пример #59
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="suid">The Site UID of the requested entity.</param>
        /// <returns>EntityCollection<ModuleInstanceEntity></returns>
        public static EntityCollection <ModuleInstanceEntity> SelectBySiteUID(System.Int32 suid)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleInstanceFields.SiteUID == suid);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleInstanceEntity> modulesinstances = new EntityCollection <ModuleInstanceEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(modulesinstances, bucket);
            return(modulesinstances);
        }
Пример #60
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="flag">The Is Builtin Flag of the requested entity.</param>
        /// <returns>EntityCollection<TemplateEntity></returns>
        public static EntityCollection <TemplateEntity> SelectByIsBuiltin(System.Boolean flag)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(TemplateFields.IsBuiltin == flag);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <TemplateEntity> templates = new EntityCollection <TemplateEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(templates, bucket);
            return(templates);
        }