Example #1
0
 public static void MultipleDelete(int[] ids)
 {
     if (ids.Length > 0)
     {
         DefaultRepository.Delete <NotificationsDAL>(ids);
     }
 }
Example #2
0
 internal static void MultipleDeletePage(int[] ids)
 {
     if (ids.Length > 0)
     {
         DefaultRepository.Delete <PageDAL>(ids);
     }
 }
Example #3
0
        public static void Delete(ContentConstraint constraint)
        {
            if (constraint == null)
            {
                throw new ArgumentNullException(nameof(constraint));
            }

            if (constraint.IsNew)
            {
                throw new ArgumentException("Метод вызван для несуществующего в БД ContentConstraint");
            }

            using (var scope = new QPConnectionScope())
            {
                try
                {
                    if (QPContext.DatabaseType == DatabaseType.SqlServer)
                    {
                        ChangeContentIndexesTriggerState(scope.DbConnection, false);
                    }
                    var dal = MapperFacade.ContentConstraintMapper.GetDalObject(constraint);
                    Common.DropComplexIndex(scope.DbConnection, dal);
                    DefaultRepository.Delete <ContentConstraintDAL>(constraint.Id);
                }
                finally
                {
                    if (QPContext.DatabaseType == DatabaseType.SqlServer)
                    {
                        ChangeContentIndexesTriggerState(scope.DbConnection, true);
                    }
                }
            }
        }
Example #4
0
 internal static void MultipleDeleteObjectFormatVersion(int[] ids)
 {
     if (ids.Length > 0)
     {
         DefaultRepository.Delete <ObjectFormatVersionDAL>(ids);
     }
 }
Example #5
0
        internal static void Delete(int id)
        {
            using (var scope = new QPConnectionScope())
            {
                if (QPContext.DatabaseType == DatabaseType.SqlServer)
                {
                    ChangeDeleteBindingsTriggerState(false);
                }

                var bindings = QPContext.EFContext.ContentWorkflowBindSet.Where(n => n.WorkflowId == id).ToArray();
                DefaultRepository.SimpleDeleteBulk(bindings);

                var bindings2 = QPContext.EFContext.ArticleWorkflowBindSet.Where(n => n.WorkflowId == id).ToArray();
                DefaultRepository.SimpleDeleteBulk(bindings2);

                var waits = QPContext.EFContext.WaitingForApprovalSet.Include(n => n.Article.WorkflowBinding)
                            .Where(n => n.Article.WorkflowBinding.WorkflowId == id).ToArray();
                DefaultRepository.SimpleDeleteBulk(waits);

                DefaultRepository.Delete <WorkflowDAL>(id);

                if (QPContext.DatabaseType == DatabaseType.SqlServer)
                {
                    ChangeDeleteBindingsTriggerState(true);
                }
            }
        }
Example #6
0
 internal static void Delete(int id)
 {
     using (var scope = new QPConnectionScope())
     {
         ChangeDeleteValuesTriggerState(scope.DbConnection, false);
         DefaultRepository.Delete <PluginDAL>(id);
         Common.DropPluginTables(scope.DbConnection, id);
         ChangeDeleteValuesTriggerState(scope.DbConnection, true);
     }
 }
Example #7
0
        public static void Delete(ContentConstraint constraint)
        {
            if (constraint == null)
            {
                throw new ArgumentNullException(nameof(constraint));
            }

            if (constraint.IsNew)
            {
                throw new ArgumentException("Метод вызван для несуществующего в БД ContentConstraint");
            }

            DefaultRepository.Delete <ContentConstraintDAL>(constraint.Id);
        }
Example #8
0
        protected override void DeleteFromDb(Folder folder)
        {
            void Traverse(Folder f)
            {
                f.LoadAllChildren  = true;
                f.AutoLoadChildren = true;
                if (f.Children != null)
                {
                    foreach (var sb in f.Children)
                    {
                        Traverse((Folder)sb);
                    }
                }

                DefaultRepository.Delete <ContentFolderDAL>(f.Id);
            }

            Traverse(folder);
        }
Example #9
0
        protected override void DeleteFromDb(Folder folder)
        {
            Action <Folder> traverse = null;

            traverse = f =>
            {
                f.LoadAllChildren  = true;
                f.AutoLoadChildren = true;
                if (f.Children != null)
                {
                    foreach (var sb in f.Children)
                    {
                        traverse((Folder)sb);
                    }
                }

                DefaultRepository.Delete <SiteFolderDAL>(f.Id);
            };

            traverse(folder);
        }
Example #10
0
        internal static void UpdateSchedule(Article article)
        {
            var item = article.Schedule;

            if (item != null)
            {
                item.Article   = article;
                item.ArticleId = article.Id;

                var originalId = item.Id;
                item.Id = 0;

                var dalItem       = MapperFacade.ArticleScheduleMapper.GetDalObject(item);
                var itemPersisted = originalId != 0;
                var hasChanges    = !itemPersisted;

                if (itemPersisted)
                {
                    var originalItem = GetDalById(originalId);
                    hasChanges = DetectChanges(originalItem, dalItem);
                    if (hasChanges)
                    {
                        DefaultRepository.Delete <ArticleScheduleDAL>(originalId);
                    }
                }

                var needToPersist = dalItem.FreqType != ScheduleFreqTypes.None && hasChanges;
                if (needToPersist)
                {
                    dalItem.UseService     = true;
                    dalItem.Created        = article.Modified;
                    dalItem.Modified       = article.Modified;
                    dalItem.LastModifiedBy = article.LastModifiedBy;
                    DefaultRepository.SimpleSave(dalItem);
                }
            }
        }
Example #11
0
 internal static void Delete(int id)
 {
     DefaultRepository.Delete <ArticleScheduleDAL>(id);
 }
Example #12
0
 internal static void Delete(int id)
 {
     DefaultRepository.Delete <StatusTypeDAL>(id);
 }
Example #13
0
 internal static void DeletePage(int id)
 {
     DefaultRepository.Delete <PageDAL>(id);
 }
Example #14
0
 internal static void DeleteObjectFormat(int id)
 {
     DefaultRepository.Delete <ObjectFormatDAL>(id);
 }
 internal static void MultipleDelete(int[] ids)
 {
     DefaultRepository.Delete <PluginVersionDAL>(ids);
 }
Example #16
0
 internal static void Delete(int id)
 {
     DefaultRepository.Delete <VePluginDAL>(id);
 }
Example #17
0
 internal static void Delete(int id)
 {
     DefaultRepository.Delete <UserGroupDAL>(id);
 }
Example #18
0
 public static void Delete(int id)
 {
     DefaultRepository.Delete <NotificationsDAL>(id);
 }
Example #19
0
 internal static void DeleteStyle(int id)
 {
     DefaultRepository.Delete <VeStyleDAL>(id);
 }
Example #20
0
 internal static void DeleteVeStyle(int id)
 {
     DefaultRepository.Delete <WorkflowDAL>(id);
 }