Example #1
0
        protected void DataPortal_Create(LabelCriteria criteria)
        {
            this.LoadProperty(SourceTypeProperty, criteria.SourceType);
            this.LoadProperty(SourceIdProperty, criteria.SourceId);
            this.LoadProperty(NameProperty, criteria.Name);

            this.BusinessRules.CheckRules();
        }
Example #2
0
        protected void DataPortal_Create(LabelCriteria criteria)
        {
            this.LoadProperty(SourceTypeProperty, criteria.SourceType);
            this.LoadProperty(SourceIdProperty, criteria.SourceId);
            this.LoadProperty(NameProperty, criteria.Name);

            this.BusinessRules.CheckRules();
        }
Example #3
0
        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();
            }
        }
Example #4
0
        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();
            }
        }
Example #5
0
 internal static Label NewLabel(LabelCriteria criteria)
 {
     return Csla.DataPortal.Create<Label>(criteria);
 }
Example #6
0
 internal static Label FetchLabel(LabelCriteria criteria)
 {
     return Csla.DataPortal.Fetch<Label>(criteria);
 }
Example #7
0
 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;
            }
        }
Example #10
0
 internal static void DeleteLabel(LabelCriteria criteria)
 {
     Csla.DataPortal.Delete <Label>(criteria);
 }
Example #11
0
 internal static Label FetchLabel(LabelCriteria criteria)
 {
     return(Csla.DataPortal.Fetch <Label>(criteria));
 }
Example #12
0
 internal static Label NewLabel(LabelCriteria criteria)
 {
     return(Csla.DataPortal.Create <Label>(criteria));
 }
Example #13
0
 internal static LabelInfoList FetchLabelInfoList(LabelCriteria criteria)
 {
     return(Csla.DataPortal.Fetch <LabelInfoList>(criteria));
 }
Example #14
0
        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();
            }
        }
Example #15
0
        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();
            }
        }
Example #16
0
 public static LabelInfoList LabelFetchInfoList(LabelCriteria criteria)
 {
     return LabelInfoList.FetchLabelInfoList(criteria);
 }