コード例 #1
0
        private void DataPortal_Delete(FeedCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities>
                             .GetManager(Database.ApplicationConnection, false))
            {
                var data = ctx.ObjectContext.Feeds
                           .Single(row => row.FeedId == criteria.FeedId);

                ctx.ObjectContext.Feeds.DeleteObject(data);

                ctx.ObjectContext.SaveChanges();
            }
        }
コード例 #2
0
        private void DataPortal_Fetch(FeedCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities>
                             .GetManager(Database.ApplicationConnection, false))
            {
                var data = ctx.ObjectContext.Feeds
                           .Include("CreatedByUser")
                           .Single(row => row.FeedId == criteria.FeedId);

                this.Fetch(data);

                this.BusinessRules.CheckRules();
            }
        }
コード例 #3
0
        private void DataPortal_Fetch(FeedCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities>
                             .GetManager(Database.ApplicationConnection, false))
            {
                this.RaiseListChangedEvents = false;
                this.IsReadOnly             = false;

                IQueryable <Data.Feed> query = ctx.ObjectContext.Feeds
                                               .Include("CreatedByUser");

                if (criteria.FeedId != null)
                {
                    query = query.Where(row => row.FeedId == criteria.FeedId);
                }

                if (criteria.Type != null)
                {
                    query = query.Where(row => row.Type == criteria.Type);
                }

                if (criteria.Data != null)
                {
                    query = query.Where(row => row.Data == criteria.Data);
                }

                if (criteria.CreatedBy != null)
                {
                    query = query.Where(row => row.CreatedBy == criteria.CreatedBy);
                }

                if (criteria.CreatedDate.DateFrom.Date != DateTime.MinValue.Date)
                {
                    query = query.Where(row => row.CreatedDate >= criteria.CreatedDate.DateFrom);
                }

                if (criteria.CreatedDate.DateTo.Date != DateTime.MaxValue.Date)
                {
                    query = query.Where(row => row.CreatedDate <= criteria.CreatedDate.DateTo);
                }

                if (criteria.SortBy != null)
                {
                    query = query.OrderBy(string.Format(
                                              "{0} {1}",
                                              criteria.SortBy,
                                              criteria.SortOrder == ListSortDirection.Ascending ? "ASC" : "DESC"));
                }

                if (criteria.MaximumRecords != null)
                {
                    query = query.Take(criteria.MaximumRecords.Value);
                }

                var data = query.AsEnumerable().Select(FeedInfo.FetchFeedInfo);

                this.AddRange(data);

                this.IsReadOnly             = true;
                this.RaiseListChangedEvents = true;
            }
        }
コード例 #4
0
 internal static FeedInfoList FetchFeedInfoList(FeedCriteria criteria)
 {
     return(Csla.DataPortal.Fetch <FeedInfoList>(criteria));
 }
コード例 #5
0
        private void DataPortal_Fetch(FeedCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                        .GetManager(Database.ApplicationConnection, false))
            {
                this.RaiseListChangedEvents = false;
                this.IsReadOnly = false;

                IQueryable<Data.Feed> query = ctx.ObjectContext.Feeds
                    .Include("CreatedByUser");

                if (criteria.FeedId != null)
                {
                    query = query.Where(row => row.FeedId == criteria.FeedId);
                }

                if (criteria.Type != null)
                {
                    query = query.Where(row => row.Type == criteria.Type);
                }

                if (criteria.Data != null)
                {
                    query = query.Where(row => row.Data == criteria.Data);
                }

                if (criteria.CreatedBy != null)
                {
                    query = query.Where(row => row.CreatedBy == criteria.CreatedBy);
                }

                if (criteria.CreatedDate.DateFrom.Date != DateTime.MinValue.Date)
                {
                    query = query.Where(row => row.CreatedDate >= criteria.CreatedDate.DateFrom);
                }

                if (criteria.CreatedDate.DateTo.Date != DateTime.MaxValue.Date)
                {
                    query = query.Where(row => row.CreatedDate <= criteria.CreatedDate.DateTo);
                }

                if (criteria.SortBy != null)
                {
                    query = query.OrderBy(string.Format(
                        "{0} {1}",
                        criteria.SortBy,
                        criteria.SortOrder == ListSortDirection.Ascending ? "ASC" : "DESC"));
                }

                if (criteria.MaximumRecords != null)
                {
                    query = query.Take(criteria.MaximumRecords.Value);
                }

                var data = query.AsEnumerable().Select(FeedInfo.FetchFeedInfo);

                this.AddRange(data);

                this.IsReadOnly = true;
                this.RaiseListChangedEvents = true;
            }
        }
コード例 #6
0
 public static FeedInfoList FeedFetchInfoList(FeedCriteria criteria)
 {
     return(FeedInfoList.FetchFeedInfoList(criteria));
 }
コード例 #7
0
ファイル: Feed.Methods.cs プロジェクト: WhiteIsland/epiworx
 internal static Feed FetchFeed(FeedCriteria criteria)
 {
     return(Csla.DataPortal.Fetch <Feed>(criteria));
 }
コード例 #8
0
ファイル: Feed.Methods.cs プロジェクト: WhiteIsland/epiworx
 internal static Feed FetchFeed(FeedCriteria criteria)
 {
     return Csla.DataPortal.Fetch<Feed>(criteria);
 }
コード例 #9
0
ファイル: Feed.Data.cs プロジェクト: WhiteIsland/epiworx
        private void DataPortal_Delete(FeedCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                        .GetManager(Database.ApplicationConnection, false))
            {
                var data = ctx.ObjectContext.Feeds
                    .Single(row => row.FeedId == criteria.FeedId);

                ctx.ObjectContext.Feeds.DeleteObject(data);

                ctx.ObjectContext.SaveChanges();
            }
        }
コード例 #10
0
ファイル: Feed.Data.cs プロジェクト: WhiteIsland/epiworx
        private void DataPortal_Fetch(FeedCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                        .GetManager(Database.ApplicationConnection, false))
            {
                var data = ctx.ObjectContext.Feeds
                    .Include("CreatedByUser")
                    .Single(row => row.FeedId == criteria.FeedId);

                this.Fetch(data);

                this.BusinessRules.CheckRules();
            }
        }
コード例 #11
0
 internal static FeedInfoList FetchFeedInfoList(FeedCriteria criteria)
 {
     return Csla.DataPortal.Fetch<FeedInfoList>(criteria);
 }