Пример #1
0
        /// <summary>
        /// Deal with change of master page zone admin type from editable or configurable to static.
        /// </summary>
        /// <param name="existingMasterPageZone">Existing master page zone.</param>
        /// <param name="masterPageZone">Updated master page zone.</param>
        /// <param name="unitOfWork">Unit of work.</param>
        private void ChangeAdminTypeToStatic(MasterPageZone existingMasterPageZone, MasterPageZone masterPageZone, IUnitOfWork unitOfWork)
        {
            // Delete page zone elements that were required by editable or configurable master page zones, but no longer required for static master page zone
            List <long> elementIds = _masterPageRepository.ListPageElementsByMasterPageZone(existingMasterPageZone.TenantId, existingMasterPageZone.MasterPageId, existingMasterPageZone.MasterPageZoneId, unitOfWork);

            _pageRepository.DeletePageZoneElementsByMasterPageZone(existingMasterPageZone.TenantId, existingMasterPageZone.MasterPageId, existingMasterPageZone.MasterPageZoneId, unitOfWork);
            HashSet <long> removedElements = new HashSet <long>();

            foreach (long elementId in elementIds)
            {
                removedElements.Add(elementId);
            }
            if (removedElements.Count > 0)
            {
                DeleteElementsThatAreNoLongerInUse(existingMasterPageZone.TenantId, removedElements, unitOfWork);
            }

            // Delete page zones that were required by editable or configurable master page zones, but no longer required for static master page zone
            _pageRepository.DeletePageZonesByMasterPageZone(existingMasterPageZone.TenantId, existingMasterPageZone.MasterPageId, existingMasterPageZone.MasterPageZoneId, unitOfWork);
        }