Esempio n. 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;
        }
Esempio n. 2
0
        public DocumentConfigEntity GetByCode(string Code)
        {
            EntityCollection<DocumentConfigEntity> items = new EntityCollection<DocumentConfigEntity>();

            IPredicateExpression predicate = new PredicateExpression();
            predicate.Add(DocumentConfigFields.Code == Code);

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

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

            if (items != null && items.Count > 0)
                return items[0];
            return null;
        }
Esempio n. 3
0
        public NewsEntity GetNews(string TextId)
        {
            EntityCollection<NewsEntity> items = new EntityCollection<NewsEntity>();

            IPredicateExpression predicate = new PredicateExpression();
            predicate.Add(NewsFields.TextId == TextId);

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

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

            if (items != null && items.Count > 0)
                return items[0];
            return null;
        }
Esempio n. 4
0
        public CodeMarkEntity GetByCode(string code)
        {
            EntityCollection<CodeMarkEntity> items = new EntityCollection<CodeMarkEntity>();

            IPredicateExpression predicate = new PredicateExpression();
            predicate.Add(CodeMarkFields.Code == code);
            predicate.AddWithAnd(CodeMarkFields.IsDeleted == false);

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

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

            if (items != null && items.Count > 0)
                return items[0];
            return null;
        }
Esempio n. 5
0
        public DocumentEntity GetByID(Guid ID)
        {
            EntityCollection<DocumentEntity> items = new EntityCollection<DocumentEntity>();

            IPredicateExpression predicate = new PredicateExpression();
            predicate.Add(DocumentFields.Id == ID);
            predicate.AddWithAnd(DocumentFields.IsDeleted == false);

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

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

            if (items != null && items.Count > 0)
                return items[0];
            return null;
        }
Esempio n. 6
0
        public bool IsExistsGroupName(string GroupName, string PositionId)
        {
            EntityCollection<AdvertsPositionEntity> items = new EntityCollection<AdvertsPositionEntity>();

            IPredicateExpression predicate = new PredicateExpression();
            predicate.Add(AdvertsPositionFields.GroupName == GroupName);
            predicate.AddWithAnd(AdvertsPositionFields.PositionId == PositionId);

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

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

            if (items != null && items.Count > 0)
                return true;
            return false;
        }
Esempio n. 7
0
        public CustomersEntity GetByName(string CustomerName)
        {
            EntityCollection<CustomersEntity> cus = new EntityCollection<CustomersEntity>();

            IPredicateExpression predicate = new PredicateExpression();
            predicate.Add(CustomersFields.UserName == CustomerName);
            //predicate.AddWithAnd(CustomersFields.Telphone == "");

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

            SortExpression sort = new SortExpression();
            sort.Add(CustomersFields.UserName | SortOperator.Ascending);

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

            if (cus != null && cus.Count > 0)
                return cus[0];
            return null;
        }
Esempio n. 8
0
        public EntityCollection<CatalogsEntity> GetByParentIdNotId(int Id, int ParentId)
        {
            EntityCollection<CatalogsEntity> cats = new EntityCollection<CatalogsEntity>();

            SortExpression _sort = new SortExpression();
            _sort.Add(CatalogsFields.CatalogName | SortOperator.Ascending);

            IPredicateExpression predicate = new PredicateExpression();
            predicate.Add(CatalogsFields.ParentId == ParentId);
            predicate.AddWithAnd(CatalogsFields.Id != Id);

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

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

            return cats;
        }
Esempio n. 9
0
        public VideosEntity GetVideoByCatTextId(string TextId)
        {
            VideoCatalogEntity c = VideoCatalogManager.CreateInstant().GetByTextId(TextId);
            if (c != null)
            {
                EntityCollection<VideosEntity> items = new EntityCollection<VideosEntity>();
                IPredicateExpression pre = new PredicateExpression();
                pre.Add(VideosFields.CatalogId == c.Id);
                SortExpression sort = new SortExpression();
                sort.Add(VideosFields.Views | SortOperator.Descending);

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

                using (DataAccessAdapterBase adapter = new DataAccessAdapterFactory().CreateAdapter())
                {
                    adapter.FetchEntityCollection(items, filter, 1, sort);
                }

                if (items != null && items.Count > 0)
                    return items[0];
            }
            return null;
        }
Esempio n. 10
0
        public VideosEntity GetVideoHome()
        {
            EntityCollection<VideosEntity> videos = new EntityCollection<VideosEntity>();

            IPredicateExpression predicate = new PredicateExpression();
            predicate.Add(VideosFields.IsVisibleHome == true);

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

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

            if (videos != null && videos.Count > 0)
            {
                return videos[0];
            }

            return null;
        }
Esempio n. 11
0
        public EntityCollection<EventsEntity> GetEvents(string EventType)
        {
            EntityCollection<EventsEntity> items = new EntityCollection<EventsEntity>();

            IPredicateExpression predicate = new PredicateExpression();
            predicate.Add(EventsFields.EventType == EventType);
            predicate.AddWithAnd(EventsFields.Approved == false);

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

            SortExpression sort = new SortExpression();
            sort.Add(EventsFields.CreatedDate | SortOperator.Descending);

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

            return items;
        }