protected void DataPortal_Create(LabelCriteria criteria) { this.LoadProperty(SourceTypeProperty, criteria.SourceType); this.LoadProperty(SourceIdProperty, criteria.SourceId); this.LoadProperty(NameProperty, criteria.Name); this.BusinessRules.CheckRules(); }
private void DataPortal_Delete(LabelCriteria criteria) { using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var data = ctx.ObjectContext.Labels .Single(row => row.SourceId == criteria.SourceId && row.SourceType == (int)criteria.SourceType && row.Name == criteria.Name); ctx.ObjectContext.Labels.DeleteObject(data); ctx.ObjectContext.SaveChanges(); } }
private void DataPortal_Fetch(LabelCriteria criteria) { using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var data = ctx.ObjectContext.Labels .Include("CreatedByUser") .Single(row => row.SourceId == criteria.SourceId && row.SourceType == (int)criteria.SourceType && row.Name == criteria.Name); this.Fetch(data); this.BusinessRules.CheckRules(); } }
internal static Label NewLabel(LabelCriteria criteria) { return Csla.DataPortal.Create<Label>(criteria); }
internal static Label FetchLabel(LabelCriteria criteria) { return Csla.DataPortal.Fetch<Label>(criteria); }
internal static void DeleteLabel(LabelCriteria criteria) { Csla.DataPortal.Delete<Label>(criteria); }
private void DataPortal_Fetch(LabelCriteria criteria) { using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { this.RaiseListChangedEvents = false; this.IsReadOnly = false; IQueryable <Data.Label> query = ctx.ObjectContext.Labels .Include("CreatedByUser"); if (criteria.SourceId != null) { query = query.Where(row => row.SourceId == criteria.SourceId); } if (criteria.SourceType != null) { query = query.Where(row => row.SourceType == (int)criteria.SourceType); } if (criteria.Name != null) { query = query.Where(row => row.Name == criteria.Name); } 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(LabelInfo.FetchLabelInfo); this.AddRange(data); this.IsReadOnly = true; this.RaiseListChangedEvents = true; } }
private void DataPortal_Fetch(LabelCriteria criteria) { using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { this.RaiseListChangedEvents = false; this.IsReadOnly = false; IQueryable<Data.Label> query = ctx.ObjectContext.Labels .Include("CreatedByUser"); if (criteria.SourceId != null) { query = query.Where(row => row.SourceId == criteria.SourceId); } if (criteria.SourceType != null) { query = query.Where(row => row.SourceType == (int)criteria.SourceType); } if (criteria.Name != null) { query = query.Where(row => row.Name == criteria.Name); } 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(LabelInfo.FetchLabelInfo); this.AddRange(data); this.IsReadOnly = true; this.RaiseListChangedEvents = true; } }
internal static void DeleteLabel(LabelCriteria criteria) { Csla.DataPortal.Delete <Label>(criteria); }
internal static Label FetchLabel(LabelCriteria criteria) { return(Csla.DataPortal.Fetch <Label>(criteria)); }
internal static Label NewLabel(LabelCriteria criteria) { return(Csla.DataPortal.Create <Label>(criteria)); }
internal static LabelInfoList FetchLabelInfoList(LabelCriteria criteria) { return(Csla.DataPortal.Fetch <LabelInfoList>(criteria)); }
private void DataPortal_Fetch(LabelCriteria criteria) { using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var data = ctx.ObjectContext.Labels .Include("CreatedByUser") .Single(row => row.SourceId == criteria.SourceId && row.SourceType == (int)criteria.SourceType && row.Name == criteria.Name); this.Fetch(data); this.BusinessRules.CheckRules(); } }
private void DataPortal_Delete(LabelCriteria criteria) { using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var data = ctx.ObjectContext.Labels .Single(row => row.SourceId == criteria.SourceId && row.SourceType == (int)criteria.SourceType && row.Name == criteria.Name); ctx.ObjectContext.Labels.DeleteObject(data); ctx.ObjectContext.SaveChanges(); } }
public static LabelInfoList LabelFetchInfoList(LabelCriteria criteria) { return LabelInfoList.FetchLabelInfoList(criteria); }