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(); } }
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(); } }
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; } }
internal static FeedInfoList FetchFeedInfoList(FeedCriteria criteria) { return(Csla.DataPortal.Fetch <FeedInfoList>(criteria)); }
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; } }
public static FeedInfoList FeedFetchInfoList(FeedCriteria criteria) { return(FeedInfoList.FetchFeedInfoList(criteria)); }
internal static Feed FetchFeed(FeedCriteria criteria) { return(Csla.DataPortal.Fetch <Feed>(criteria)); }
internal static Feed FetchFeed(FeedCriteria criteria) { return Csla.DataPortal.Fetch<Feed>(criteria); }
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(); } }
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(); } }
internal static FeedInfoList FetchFeedInfoList(FeedCriteria criteria) { return Csla.DataPortal.Fetch<FeedInfoList>(criteria); }