public void Delete(AttachmentDataCriteria criteria)
        {
            var data = MockDb.Attachments
                .Where(row => row.AttachmentId == criteria.AttachmentId)
                .Single();

            MockDb.Attachments.Remove(data);
        }
        public void Delete(AttachmentDataCriteria criteria)
        {
            var data = MockDb.Attachments
                       .Where(row => row.AttachmentId == criteria.AttachmentId)
                       .Single();

            MockDb.Attachments.Remove(data);
        }
Exemplo n.º 3
0
        private void DataPortal_Delete(AttachmentDataCriteria criteria)
        {
            using (var dalManager = DataFactoryManager.GetManager())
            {
                var dalFactory = dalManager.GetProvider <IAttachmentDataFactory>();

                dalFactory.Delete(criteria);
            }
        }
        public AttachmentData Fetch(AttachmentDataCriteria criteria)
        {
            var data = MockDb.Attachments
                       .Where(row => row.AttachmentId == criteria.AttachmentId)
                       .Single();

            data = this.Fetch(data);

            return(data);
        }
        public AttachmentData Fetch(AttachmentDataCriteria criteria)
        {
            var data = MockDb.Attachments
                .Where(row => row.AttachmentId == criteria.AttachmentId)
                .Single();

            data = this.Fetch(data);

            return data;
        }
        public void Delete(AttachmentDataCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                          .GetManager(Database.ApplicationConnection, false))
            {
                var attachment = this.Fetch(ctx, criteria)
                    .Single();

                ctx.ObjectContext.Attachments.DeleteObject(attachment);

                ctx.ObjectContext.SaveChanges();
            }
        }
Exemplo n.º 7
0
        public void Delete(AttachmentDataCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities>
                             .GetManager(Database.ApplicationConnection, false))
            {
                var attachment = this.Fetch(ctx, criteria)
                                 .Single();

                ctx.ObjectContext.Attachments.DeleteObject(attachment);

                ctx.ObjectContext.SaveChanges();
            }
        }
        public AttachmentData Fetch(AttachmentDataCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                         .GetManager(Database.ApplicationConnection, false))
            {
                var attachment = this.Fetch(ctx, criteria)
                    .Single();

                var attachmentData = new AttachmentData();

                this.Fetch(attachment, attachmentData);

                return attachmentData;
            }
        }
Exemplo n.º 9
0
        public AttachmentData Fetch(AttachmentDataCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities>
                             .GetManager(Database.ApplicationConnection, false))
            {
                var attachment = this.Fetch(ctx, criteria)
                                 .Single();

                var attachmentData = new AttachmentData();

                this.Fetch(attachment, attachmentData);

                return(attachmentData);
            }
        }
        public AttachmentData[] FetchInfoList(AttachmentDataCriteria criteria)
        {
            var query = MockDb.Attachments
                        .AsQueryable();

            var attachments = query.AsQueryable();

            var data = new List <AttachmentData>();

            foreach (var attachment in attachments)
            {
                data.Add(this.Fetch(attachment));
            }

            return(data.ToArray());
        }
Exemplo n.º 11
0
        private void DataPortal_Fetch(AttachmentDataCriteria criteria)
        {
            using (var dalManager = DataFactoryManager.GetManager())
            {
                var dalFactory = dalManager.GetProvider <IAttachmentDataFactory>();

                var data = dalFactory.Fetch(criteria);

                using (this.BypassPropertyChecks)
                {
                    this.Fetch(data);
                }

                // this.ChildPropertyName = Csla.DataPortal.FetchChild<ChildPropertType>(data);
            }
        }
Exemplo n.º 12
0
        public AttachmentData[] FetchInfoList(AttachmentDataCriteria criteria)
        {
            var query = MockDb.Attachments
                .AsQueryable();

            var attachments = query.AsQueryable();

            var data = new List<AttachmentData>();

            foreach (var attachment in attachments)
            {
                data.Add(this.Fetch(attachment));
            }

            return data.ToArray();
        }
Exemplo n.º 13
0
        private void DataPortal_Fetch(AttachmentDataCriteria criteria)
        {
            using (var dalManager = DataFactoryManager.GetManager())
            {
                var dalFactory = dalManager.GetProvider <IAttachmentDataFactory>();

                var data = dalFactory.FetchInfoList(criteria);

                this.RaiseListChangedEvents = false;
                this.IsReadOnly             = false;

                this.AddRange(data.Select(row => Csla.DataPortal.FetchChild <AttachmentInfo>(row)));

                this.IsReadOnly             = true;
                this.RaiseListChangedEvents = true;
            }
        }
        private void DataPortal_Fetch(AttachmentDataCriteria criteria)
        {
            using (var dalManager = DataFactoryManager.GetManager())
            {
                var dalFactory = dalManager.GetProvider<IAttachmentDataFactory>();

                var data = dalFactory.FetchInfoList(criteria);

                this.RaiseListChangedEvents = false;
                this.IsReadOnly = false;

                this.AddRange(data.Select(row => Csla.DataPortal.FetchChild<AttachmentInfo>(row)));

                this.IsReadOnly = true;
                this.RaiseListChangedEvents = true;
            }
        }
Exemplo n.º 15
0
        public AttachmentData[] FetchLookupInfoList(AttachmentDataCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities>
                             .GetManager(Database.ApplicationConnection, false))
            {
                var attachments = this.Fetch(ctx, criteria)
                                  .AsEnumerable();

                var attachmentDataList = new List <AttachmentData>();

                foreach (var attachment in attachments)
                {
                    var attachmentData = new AttachmentData();

                    this.Fetch(attachment, attachmentData);

                    attachmentDataList.Add(attachmentData);
                }

                return(attachmentDataList.ToArray());
            }
        }
Exemplo n.º 16
0
        public AttachmentData[] FetchLookupInfoList(AttachmentDataCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                          .GetManager(Database.ApplicationConnection, false))
            {
                var attachments = this.Fetch(ctx, criteria)
                    .AsEnumerable();

                var attachmentDataList = new List<AttachmentData>();

                foreach (var attachment in attachments)
                {
                    var attachmentData = new AttachmentData();

                    this.Fetch(attachment, attachmentData);

                    attachmentDataList.Add(attachmentData);
                }

                return attachmentDataList.ToArray();
            }
        }
Exemplo n.º 17
0
 internal static AttachmentInfoList FetchAttachmentInfoList(AttachmentDataCriteria criteria)
 {
     return(Csla.DataPortal.Fetch <AttachmentInfoList>(criteria));
 }
Exemplo n.º 18
0
 public static AttachmentInfoList AttachmentFetchInfoList(AttachmentDataCriteria criteria)
 {
     return AttachmentInfoList.FetchAttachmentInfoList(criteria);
 }
Exemplo n.º 19
0
        private void DataPortal_Fetch(AttachmentDataCriteria criteria)
        {
            using (var dalManager = DataFactoryManager.GetManager())
            {
                var dalFactory = dalManager.GetProvider<IAttachmentDataFactory>();

                var data = dalFactory.Fetch(criteria);

                using (this.BypassPropertyChecks)
                {
                    this.Fetch(data);
                }

                // this.ChildPropertyName = Csla.DataPortal.FetchChild<ChildPropertType>(data);
            }
        }
Exemplo n.º 20
0
 internal static void DeleteAttachment(AttachmentDataCriteria criteria)
 {
     Csla.DataPortal.Delete<Attachment>(criteria);
 }
 internal static AttachmentInfoList FetchAttachmentInfoList(AttachmentDataCriteria criteria)
 {
     return Csla.DataPortal.Fetch<AttachmentInfoList>(criteria);
 }
 public static AttachmentInfoList AttachmentFetchInfoList(AttachmentDataCriteria criteria)
 {
     return(AttachmentInfoList.FetchAttachmentInfoList(criteria));
 }
Exemplo n.º 23
0
 internal static void DeleteAttachment(AttachmentDataCriteria criteria)
 {
     Csla.DataPortal.Delete <Attachment>(criteria);
 }
Exemplo n.º 24
0
        private IQueryable<Attachment> Fetch(
             Csla.Data.ObjectContextManager<ApplicationEntities> ctx,
             AttachmentDataCriteria criteria)
        {
            IQueryable<Attachment> query = ctx.ObjectContext.Attachments
                .Include("CreatedByUser")
                .Include("ModifiedByUser");

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

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

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

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

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

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

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

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

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

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

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

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

            if (criteria.Text != null)
            {
                query = query.Where(row => row.Name.Contains(criteria.Text));
            }

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

            if (criteria.SkipRecords != null)
            {
                query = query.Skip(criteria.SkipRecords.Value);
            }

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

            return query;
        }
Exemplo n.º 25
0
        private IQueryable <Attachment> Fetch(
            Csla.Data.ObjectContextManager <ApplicationEntities> ctx,
            AttachmentDataCriteria criteria)
        {
            IQueryable <Attachment> query = ctx.ObjectContext.Attachments
                                            .Include("CreatedByUser")
                                            .Include("ModifiedByUser");

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

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

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

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

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

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

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

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

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

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

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

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

            if (criteria.Text != null)
            {
                query = query.Where(row => row.Name.Contains(criteria.Text));
            }

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

            if (criteria.SkipRecords != null)
            {
                query = query.Skip(criteria.SkipRecords.Value);
            }

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

            return(query);
        }
Exemplo n.º 26
0
        private void DataPortal_Delete(AttachmentDataCriteria criteria)
        {
            using (var dalManager = DataFactoryManager.GetManager())
            {
                var dalFactory = dalManager.GetProvider<IAttachmentDataFactory>();

                dalFactory.Delete(criteria);
            }
        }