public void Undo()
        {
            var videoMediaType = _contentTypeService.GetMediaType(AddVideoMediaTypeStepConstants.DocumentTypeAliases.Video);

            if (videoMediaType != null)
            {
                _contentTypeService.Delete(videoMediaType);
            }
        }
Beispiel #2
0
        public void Delete(string alias)
        {
            var contentType = _contentTypeService.GetContentType(alias);

            if (contentType != null)
            {
                _contentTypeService.Delete(contentType);
            }
        }
        private void DeleteContentTypeIfExists()
        {
            var myGroupsContentType = _contentTypeService.GetContentType(GroupsInstallationConstants.DocumentTypeAliases.GroupsMyGroupsOverviewPage);

            if (myGroupsContentType != null)
            {
                _contentTypeService.Delete(myGroupsContentType);
            }
        }
        public IActionResult DeleteById(int id)
        {
            var foundType = _contentTypeService.Get(id);

            if (foundType == null)
            {
                return(NotFound());
            }

            _contentTypeService.Delete(foundType, _backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.Id);
            return(Ok());
        }
        private async Task Remove(string[] aliases)
        {
            var contentType = await Get(aliases, false);

            if (contentType == null)
            {
                return;
            }

            contentTypeService.Delete(contentType);
            await Out.WriteLineAsync($"Removed the content type '{aliases[0]}'");
        }
        public override void Down()
        {
            var doctype = _contentTypeService.GetContentType("NewTextPage");

            //
            // i wouldn't do this - because you will loose any content that might
            // be using this doctype.
            //
            if (doctype != null)
            {
                _contentTypeService.Delete(doctype);
            }
        }
Beispiel #7
0
        public IResponseData <bool> DeleteContentType(Guid id)
        {
            IResponseData <bool> response = new ResponseData <bool>();

            try
            {
                IContentTypeService service = IoC.Container.Resolve <IContentTypeService>();
                service.Delete(id);
                response.SetData(true);
            }
            catch (ValidationException ex)
            {
                response.SetErrors(ex.Errors);
                response.SetStatus(HttpStatusCode.PreconditionFailed);
            }
            return(response);
        }
Beispiel #8
0
        public DocumentTypeState Delete()
        {
            var result = new DocumentTypeState();

            var homeNavigationComposition = _contentTypeService.GetContentType(Alias);

            if (homeNavigationComposition == null)
            {
                result.IsExists = false;
                return(result);
            }

            _contentTypeService.Delete(homeNavigationComposition);

            result.IsExists = false;
            return(result);
        }
Beispiel #9
0
        public override uSyncAction DeleteItem(Guid key, string keyString)
        {
            IMediaType item = null;

            if (key != Guid.Empty)
            {
                item = _contentTypeService.GetMediaType(key);
            }

            if (item == null || !string.IsNullOrEmpty(keyString))
            {
                item = _contentTypeService.GetMediaType(keyString);
            }

            if (item != null)
            {
                LogHelper.Info <ContentTypeHandler>("Deleting Content Type: {0}", () => item.Name);
                _contentTypeService.Delete(item);
                return(uSyncAction.SetAction(true, keyString, typeof(IMediaType), ChangeType.Delete, "Not found"));
            }

            return(uSyncAction.Fail(keyString, typeof(IMediaType), ChangeType.Delete, "Not found"));
        }
        private void UpdateHomeDocumentType()
        {
            try
            {
                var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS);

                var container = contentTypeService.GetContainers(CONTAINER, 1).FirstOrDefault();

                if (contentType != null)
                {
                    if (contentType.PropertyTypes.ToList().SingleOrDefault(x => x.Alias == "termsAndConditionsMessage") == null)
                    {
                        // Add Document Type Properties
                        #region Tenant Home Page Content
                        PropertyType termsAndConditionsMessagePropType = new PropertyType(dataTypeService.GetDataType(-88), "termsAndConditionsMessage")
                        {
                            Name        = "Terms and Conditions",
                            Description = "Message to display for required accepting Terms and Conditions",
                            Variations  = ContentVariation.Culture
                        };
                        contentType.AddPropertyType(termsAndConditionsMessagePropType, CONTENT_TAB);
                        #endregion

                        contentTypeService.Save(contentType);
                        ConnectorContext.AuditService.Add(AuditType.New, -1, contentType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been updated");

                        ContentHelper.CopyPhysicalAssets(new RegisterUpdateHomeEmbeddedResources());
                        //CreateMasterTemplate();
                    }

                    var telegramUsername = contentType.PropertyTypes.ToList().SingleOrDefault(x => x.Alias == "telegramUsername");
                    if (telegramUsername != null)
                    {
                        if (telegramUsername.Name != "Telegram URL")
                        {
                            telegramUsername.Name        = "Telegram URL";
                            telegramUsername.Description = "";

                            telegramUsername.ValidationRegExp = "";
                            contentType.AddPropertyType(telegramUsername);

                            contentTypeService.Save(contentType);
                        }
                        else if (!string.IsNullOrEmpty(telegramUsername.ValidationRegExp))
                        {
                            telegramUsername.ValidationRegExp = "";
                            contentType.AddPropertyType(telegramUsername);

                            contentTypeService.Save(contentType);
                        }
                    }

                    var helpdeskTelegramAccount = contentType.PropertyTypes.ToList().SingleOrDefault(x => x.Alias == "helpdeskTelegramAccount");
                    if (helpdeskTelegramAccount != null)
                    {
                        if (helpdeskTelegramAccount.Name != "HelpDesk Telegram Bot")
                        {
                            helpdeskTelegramAccount.Name        = "HelpDesk Telegram Bot";
                            helpdeskTelegramAccount.Description = "";

                            helpdeskTelegramAccount.ValidationRegExp = "";
                            contentType.AddPropertyType(helpdeskTelegramAccount);

                            contentTypeService.Save(contentType);
                        }
                        else if (!string.IsNullOrEmpty(helpdeskTelegramAccount.ValidationRegExp))
                        {
                            helpdeskTelegramAccount.ValidationRegExp = "";
                            contentType.AddPropertyType(helpdeskTelegramAccount);

                            contentTypeService.Save(contentType);
                        }
                    }

                    var whatsAppNumber = contentType.PropertyTypes.ToList().SingleOrDefault(x => x.Alias == "whatsAppNumber");
                    if (whatsAppNumber != null)
                    {
                        if (whatsAppNumber.Name != "Whatsapp URL")
                        {
                            whatsAppNumber.Name        = "Whatsapp URL";
                            whatsAppNumber.Description = "";

                            whatsAppNumber.ValidationRegExp = "";
                            contentType.AddPropertyType(whatsAppNumber);

                            contentTypeService.Save(contentType);
                        }
                        else if (!string.IsNullOrEmpty(whatsAppNumber.ValidationRegExp))
                        {
                            whatsAppNumber.ValidationRegExp = "";
                            contentType.AddPropertyType(whatsAppNumber);

                            contentTypeService.Save(contentType);
                        }
                    }
                    //var
                    //var
                }

                if (createDictionaryItems)
                {
                    var language = new LanguageDictionaryService(ConnectorContext.LocalizationService, ConnectorContext.DomainService, ConnectorContext.Logger);
                    // Check if parent Key exists, and skip if true
                    if (!language.CheckExists(typeof(Home_ParentKey)))
                    {
                        // Add Dictionary Items
                        var dictionaryItems = new List <Type>
                        {
                            typeof(Home_ParentKey),
                            typeof(Home_Register),
                            typeof(Site_ParentKey),
                            typeof(Site_AlreadyHaveAccount),
                            typeof(Register_ParentKey),
                            typeof(Register_RegisterTitle),
                            typeof(Register_RegisterStep),
                            typeof(Register_RegisterOf),
                            typeof(Register_PhoneNumber),
                            typeof(Register_PhoneNumberPlaceholder),
                            typeof(Register_IsMandatory),
                            typeof(Register_Continue),
                            typeof(Register_PhoneNumberInstructions),
                            typeof(Register_VerificationCode),
                            typeof(Register_VerificationCodePlaceholder),
                            typeof(Register_EnterCode),
                            typeof(Register_Enter6DigitVerificationCode),
                            typeof(Register_EnterVerificationCode),
                            typeof(Register_ResendCode),
                            typeof(Register_Wait),
                            typeof(Register_VerificationCodeInvalidOrExpired),
                            typeof(Register_Email),
                            typeof(Register_EmailPlaceholder),
                            typeof(Register_Password),
                            typeof(Register_PasswordPlaceholder),
                            typeof(Register_ConfirmPassword),
                            typeof(Register_FirstName),
                            typeof(Register_FirstNamePlaceholder),
                            typeof(Register_LastName),
                            typeof(Register_LastNamePlaceholder),
                            typeof(Register_Username),
                            typeof(Register_UsernamePlaceholder),
                            typeof(Register_Gender),
                            typeof(Register_DateOfBirth),
                            typeof(Register_DateOfBirthDay),
                            typeof(Register_DateOfBirthMonth),
                            typeof(Register_DateOfBirthMonthJanuary),
                            typeof(Register_DateOfBirthMonthFebruary),
                            typeof(Register_DateOfBirthMonthMarch),
                            typeof(Register_DateOfBirthMonthApril),
                            typeof(Register_DateOfBirthMonthMay),
                            typeof(Register_DateOfBirthMonthJune),
                            typeof(Register_DateOfBirthMonthJuly),
                            typeof(Register_DateOfBirthMonthAugust),
                            typeof(Register_DateOfBirthMonthSeptember),
                            typeof(Register_DateOfBirthMonthOctober),
                            typeof(Register_DateOfBirthMonthNovember),
                            typeof(Register_DateOfBirthMonthDecember),
                            typeof(Register_DateOfBirthYear),
                            typeof(Register_IAgreeWithThe),
                            typeof(Register_TermsAndConditions),
                            typeof(Register_Finish),
                            typeof(Register_IncorrectOrInvalid),
                            typeof(Register_VerifyEmailSentToTitle),
                            typeof(Register_VerifyEmailSentTo),
                            typeof(Register_VerifyEmailSentToPleaseClick),
                            typeof(Register_ResendVerificationEmail),
                            typeof(Register_ResendVerificationEmailSent),
                            typeof(Register_ChangeEmail),
                            typeof(Register_IsInvalid),
                            typeof(Register_Title),
                            typeof(Register_Address1),
                            typeof(Register_Address1Placeholder),
                            typeof(Register_Address2),
                            typeof(Register_Address2Placeholder),
                            typeof(Register_Address3),
                            typeof(Register_Address3Placeholder),
                            typeof(Register_CityOrTown),
                            typeof(Register_CityOrTownPlaceholder),
                            typeof(Register_PostalCode),
                            typeof(Register_PostalCodePlaceholder),
                            typeof(Register_Country),
                            typeof(Register_Preferences),
                            typeof(Register_Language),
                            typeof(Register_Currency),
                            typeof(Register_OddsDisplay),
                            typeof(Register_TimeZone),
                            typeof(Register_BonusCode),
                            typeof(Register_BonusCodePlaceholder),
                            typeof(Register_Referrer),
                            typeof(Register_ReferrerPlaceholder),
                            typeof(Register_ReceiveNotifications),
                            typeof(Register_ReceiveNotificationsViaInPlatformMessages),
                            typeof(Register_ReceiveNotificationsViaEmail),
                            typeof(Register_ReceiveNotificationsViaSMS),
                            typeof(Register_CookiesPolicy),
                            typeof(Register_PrivacyPolicy),
                            typeof(Register_MinimunAge),
                            typeof(Register_Age),
                            typeof(Register_AgeYearsOld),
                            typeof(Register_NewEmail),
                            typeof(Register_CurrentEmail)
                        };
                        language.CreateDictionaryItems(dictionaryItems); // Create Dictionary Items

                        ConnectorContext.AuditService.Add(AuditType.Save, -1, contentType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been updated, and Dictionaries Created");
                    }
                }

                var oldHome = contentTypeService.Get(HomeDocumentType.DOCUMENT_TYPE_ALIAS);
                if (oldHome != null)
                {
                    // remove old home document type
                    contentTypeService.Delete(contentTypeService.Get(HomeDocumentType.DOCUMENT_TYPE_ALIAS));
                    // remove old home template
                    fileService.DeleteTemplate(HomeDocumentType.TEMPLATE_ALIAS);
                }
            }
            catch (Exception ex)
            {
                logger.Error(typeof(_02_HomeDocumentTypePhase2Milestone6), ex.Message);
                logger.Error(typeof(_02_HomeDocumentTypePhase2Milestone6), ex.StackTrace);
            }
        }
Beispiel #11
0
 protected override void DeleteContentType(IContentTypeBase contentType)
 {
     _service.Delete((IContentType)contentType);
 }
        public void DeleteContentType(Guid id)
        {
            IContentTypeService service = IoC.Container.Resolve <IContentTypeService>();

            service.Delete(id);
        }
Beispiel #13
0
        public static void DeleteDocumentType(string alias)
        {
            var contentType = ContentTypeService.GetContentType(alias);

            ContentTypeService.Delete(contentType);
        }