private void CreateConfirmEmailDocumentType() { try { var container = contentTypeService.GetContainers(CONTAINER, 1).FirstOrDefault(); var containerId = container.Id; var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); var parentDocType = contentTypeService.Get(PARENT_DOCUMENT_TYPE_ALIAS); if (contentType == null) { ContentType docType = (ContentType)contentType ?? new ContentType(containerId) { Name = DOCUMENT_TYPE_NAME, Alias = DOCUMENT_TYPE_ALIAS, AllowedAsRoot = false, Description = DOCUMENT_TYPE_DESCRIPTION, Icon = ICON, SortOrder = 0, Variations = ContentVariation.Culture, ParentId = parentDocType.Id }; // Create the Template if it doesn't exist if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { //then create the template Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); fileService.SaveTemplate(newTemplate); } // Set templates for document type var template = fileService.GetTemplate(TEMPLATE_ALIAS); docType.AllowedTemplates = new List <ITemplate> { template }; docType.SetDefaultTemplate(template); contentTypeService.Save(docType); // set as allowed content type in home ContentHelper.AddAllowedDocumentType(contentTypeService, Phase2MergedHomeDocumentType.DOCUMENT_TYPE_ALIAS, DOCUMENT_TYPE_ALIAS); ConfigureMasterTemplate(); ConnectorContext.AuditService.Add(AuditType.New, -1, docType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_NAME}' has been created"); ContentHelper.CopyPhysicalAssets(new Milestone7EmbeddedResources()); } } catch (System.Exception ex) { logger.Error(typeof(_07_ResetPasswordViaEmailDocumentType), ex.Message); logger.Error(typeof(_07_ResetPasswordViaEmailDocumentType), ex.StackTrace); } }
private void Reconfigure() { try { // Create the Template if it doesn't exist if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { //then create the template Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); ITemplate masterTemplate = fileService.GetTemplate(PARENT_TEMPLATE_ALIAS); newTemplate.SetMasterTemplate(masterTemplate); fileService.SaveTemplate(newTemplate); // Set template for document type var genericDocType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); genericDocType.AddTemplate(contentTypeService, newTemplate); ContentHelper.CopyPhysicalAssets(new ReconfigureSportsPageEmbeddedResources()); ConnectorContext.AuditService.Add(AuditType.Save, -1, newTemplate.Id, "Template", $"Teplate '{TEMPLATE_NAME}' has been created and assigned"); } if (createDictionaryItems) { var language = new LanguageDictionaryService(localizationService, domainService, logger); // Check if parent Key exists, and skip if true if (!language.CheckExists(typeof(Pages_ParentKey))) { // Add Dictionary Items var dictionaryItems = new List <Type> { typeof(Pages_ParentKey), typeof(Pages_SportsPage), typeof(Pages_SportEvents), typeof(Pages_SportEventsEventName), typeof(Pages_SportEventsEventScheduleTime), typeof(Pages_SportEventsEventStatusDescription), typeof(Pages_SportEventsEventTournament), typeof(Pages_SportEventsEventCategory), typeof(Pages_SportEventsEventCategorySport), typeof(Pages_SportEventsNoEvents) }; language.CreateDictionaryItems(dictionaryItems); // Create Dictionary Items } } } catch (Exception ex) { logger.Error(typeof(_08_SportsPageIntegration), ex.Message); logger.Error(typeof(_08_SportsPageIntegration), ex.StackTrace); } }
public void Initialize() { try { ContentHelper.CopyPhysicalAssets(new StylesheetBulkUploadEmbeddedResources()); } catch (System.Exception ex) { _logger.Error(typeof(_37_StylesheetBulkUploadMigration), ex.Message); _logger.Error(typeof(_37_StylesheetBulkUploadMigration), ex.StackTrace); } }
private void UpdateHomeDocumentType() { const string editorAlias = "paymentSettings"; const string propertyAlias = "paymentSettingsProperty"; const string dataTypeName = "Tenant Payment Methods"; try { var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); if (contentType != null) { var exists = dataTypeService.GetDataType(dataTypeName) != null; if (!exists) { var created = Web.Composing.Current.PropertyEditors.TryGet(editorAlias, out IDataEditor editor); if (created) { DataType tenantPreferencesDataType = new DataType(editor) { Name = dataTypeName }; dataTypeService.Save(tenantPreferencesDataType); PropertyType tenantPreferencesPropType = new PropertyType(tenantPreferencesDataType, propertyAlias) { Name = dataTypeName, Description = "Payment Options for Customers" }; contentType.AddPropertyType(tenantPreferencesPropType, TENANT_TAB); contentTypeService.Save(contentType); ConnectorContext.AuditService.Add(AuditType.Save, -1, contentType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been updated"); } else { ContentHelper.CopyPhysicalAssets(new PaymentSettingsEmbeddedResources()); // copy property editor files before trying to create the data type // will need to restart the app, in order to force a refresh to attempt to create the data type again throw new DataTypeNotCreatedException("In order to create the Data Type, a Reload is required"); } } } } catch (System.Exception ex) { logger.Error(typeof(_13_HomeDocumentTypePaymentSettings), ex.Message); logger.Error(typeof(_13_HomeDocumentTypePaymentSettings), ex.StackTrace); } }
private void CreateDictionaryItems() { try { if (createDictionaryItems) { var language = new LanguageDictionaryService(localizationService, domainService, logger); // Check if parent Key exists, and skip if true if (!language.CheckExists(typeof(Login_ParentKey))) { // Add Dictionary Items var dictionaryItems = new List <Type> { typeof(Login_ParentKey), typeof(Login_EmailUsernameOrPhone), typeof(Login_EmailUsernameOrPhonePlaceholder), typeof(Login_ForgotPassword), typeof(Login_Password), typeof(Login_RememberMe), typeof(Login_Login), typeof(Login_DontHaveAccount), typeof(Login_LoginSuccess), typeof(Login_LoginFailure) }; language.CreateDictionaryItems(dictionaryItems); // Create Dictionary Items ConnectorContext.AuditService.Add(AuditType.Save, -1, -1, "Dictionary Items", $"Dictionaries Created"); } } var firstEmbeddedResource = new LoginEmbeddedResources().Resources[0]; if (!ContentHelper.AssetAlreadyExists(firstEmbeddedResource.FileName, firstEmbeddedResource.OutputDirectory)) { ContentHelper.CopyPhysicalAssets(new LoginEmbeddedResources()); } } catch (Exception ex) { logger.Error(typeof(_05_Phase2Milestone7DictionaryMigration), ex.Message); logger.Error(typeof(_05_Phase2Milestone7DictionaryMigration), ex.StackTrace); } }
private void Reconfigure() { try { // Create the Template if it doesn't exist if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { //then create the template Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); ITemplate masterTemplate = fileService.GetTemplate(PARENT_TEMPLATE_ALIAS); newTemplate.SetMasterTemplate(masterTemplate); fileService.SaveTemplate(newTemplate); // Set template for document type var genericDocType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); genericDocType.AddTemplate(contentTypeService, newTemplate); ContentHelper.CopyPhysicalAssets(new ReconfigureBettingHistoryPageEmbeddedResources()); ConnectorContext.AuditService.Add(AuditType.Save, -1, newTemplate.Id, "Template", $"Teplate '{TEMPLATE_NAME}' has been created and assigned"); } //var language = new LanguageDictionaryService(localizationService, domainService, logger); //// Check if parent Key exists, and skip if true //if (!language.CheckExists(typeof(Pages_ParentKey))) //{ // // Add Dictionary Items // var dictionaryItems = new List<Type> // { // typeof(Pages_ParentKey), // typeof(Pages_CasinoPage) // }; // language.CreateDictionaryItems(dictionaryItems); // Create Dictionary Items //} } catch (Exception ex) { logger.Error(typeof(_11_BettingHistoryPageIntegration), ex.Message); logger.Error(typeof(_11_BettingHistoryPageIntegration), ex.StackTrace); } }
private void Reconfigure() { try { var genericDocType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); // Create the Template if it doesn't exist if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { //then create the template Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); ITemplate masterTemplate = fileService.GetTemplate(PARENT_TEMPLATE_ALIAS); newTemplate.SetMasterTemplate(masterTemplate); fileService.SaveTemplate(newTemplate); // Set template for document type genericDocType.AddTemplate(contentTypeService, newTemplate); ContentHelper.CopyPhysicalAssets(new GamesPagesEmbeddedResources()); ConnectorContext.AuditService.Add(AuditType.Save, -1, newTemplate.Id, "Template", $"Teplate '{TEMPLATE_NAME}' has been created and assigned"); } if (!genericDocType.PropertyTypeExists("gameType")) { PropertyType propType = new PropertyType(dataTypeService.GetDataType(-92), "gameType") { Name = "Game Type", Description = "The game this page will display", Variations = ContentVariation.Nothing }; genericDocType.AddPropertyType(propType, TAB_NAME); contentTypeService.Save(genericDocType); ConnectorContext.AuditService.Add(AuditType.Save, -1, genericDocType.Id, "DocumentType", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been updated"); } } catch (Exception ex) { logger.Error(typeof(_19_GamePages), ex.Message); logger.Error(typeof(_19_GamePages), ex.StackTrace); } }
private void CreateHomeDocumentType() { try { var container = contentTypeService.GetContainers(CONTAINER, 1).FirstOrDefault(); int containerId = 0; if (container == null) { var newcontainer = contentTypeService.CreateContainer(-1, CONTAINER); if (newcontainer.Success) { containerId = newcontainer.Result.Entity.Id; } } else { containerId = container.Id; } var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); if (contentType == null) { //http://refreshwebsites.co.uk/blog/umbraco-document-types-explained-in-60-seconds/ //https://our.umbraco.org/forum/developers/api-questions/43278-programmatically-creating-a-document-type ContentType docType = (ContentType)contentType ?? new ContentType(containerId) { Name = DOCUMENT_TYPE_NAME, Alias = DOCUMENT_TYPE_ALIAS, AllowedAsRoot = true, Description = DOCUMENT_TYPE_DESCRIPTION, Icon = ICON, SortOrder = 0, Variations = ContentVariation.Culture }; // Create the Template if it doesn't exist if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { //then create the template Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); fileService.SaveTemplate(newTemplate); } // Set templates for document type var template = fileService.GetTemplate(TEMPLATE_ALIAS); docType.AllowedTemplates = new List <ITemplate> { template }; docType.SetDefaultTemplate(template); docType.AddPropertyGroup(CONTENT_TAB); docType.AddPropertyGroup(TENANT_TAB); // Set Document Type Properties #region Tenant Home Page Content PropertyType brandLogoPropType = new PropertyType(dataTypeService.GetDataType(1043), "brandLogo") { Name = "Brand Logo", Variations = ContentVariation.Nothing }; docType.AddPropertyType(brandLogoPropType, CONTENT_TAB); PropertyType homeContentProType = new PropertyType(dataTypeService.GetDataType(-87), "homeContent") { Name = "Content", Variations = ContentVariation.Culture }; docType.AddPropertyType(homeContentProType, CONTENT_TAB); #endregion #region Tenant Info Tab PropertyType tenantUidPropType = new PropertyType(dataTypeService.GetDataType(-92), "tenantUid") { Name = "Tenant Uid", Description = "Tenant Unique Id", Variations = ContentVariation.Nothing }; docType.AddPropertyType(tenantUidPropType, TENANT_TAB); PropertyType brandNamePropType = new PropertyType(dataTypeService.GetDataType(-92), "brandName") { Name = "Brand Name", Variations = ContentVariation.Nothing }; docType.AddPropertyType(brandNamePropType, TENANT_TAB); PropertyType domainPropType = new PropertyType(dataTypeService.GetDataType(-92), "domain") { Name = "Domain", Variations = ContentVariation.Nothing }; docType.AddPropertyType(domainPropType, TENANT_TAB); PropertyType subDomainPropType = new PropertyType(dataTypeService.GetDataType(-92), "subDomain") { Name = "Sub Domain", Variations = ContentVariation.Nothing }; docType.AddPropertyType(subDomainPropType, TENANT_TAB); PropertyType appIdPropType = new PropertyType(dataTypeService.GetDataType(-92), "appId") { Name = "App Id", Variations = ContentVariation.Nothing }; docType.AddPropertyType(appIdPropType, TENANT_TAB); PropertyType apiKeyPropType = new PropertyType(dataTypeService.GetDataType(-92), "apiKey") { Name = "Api Key", Variations = ContentVariation.Nothing }; docType.AddPropertyType(apiKeyPropType, TENANT_TAB); PropertyType defaultLanguagePropType = new PropertyType(dataTypeService.GetDataType(-92), "defaultLanguage") { Name = "Default Language", Description = "System Default Language", Variations = ContentVariation.Nothing }; docType.AddPropertyType(defaultLanguagePropType, TENANT_TAB); PropertyType languagestPropType = new PropertyType(dataTypeService.GetDataType(-92), "languages") { Name = "Alternate Languages", Variations = ContentVariation.Nothing }; docType.AddPropertyType(languagestPropType, TENANT_TAB); PropertyType tenantStatusPropType = new PropertyType(dataTypeService.GetDataType(-92), "tenantStatus") { Name = "Tenant Status", Description = "Total Code Tenant Status", Variations = ContentVariation.Nothing }; docType.AddPropertyType(tenantStatusPropType, TENANT_TAB); #endregion contentTypeService.Save(docType); ConnectorContext.AuditService.Add(AuditType.New, -1, docType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_NAME}' has been created"); ContentHelper.CopyPhysicalAssets(new EmbeddedResources()); } } catch (System.Exception ex) { logger.Error(typeof(HomeDocumentType), ex.Message); logger.Error(typeof(HomeDocumentType), ex.StackTrace); } }
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); } }
public void Initialize() { try { var container = contentTypeService.GetContainers(DOCUMENT_TYPE_CONTAINER, 1).FirstOrDefault(); int containerId = -1; if (container != null) { containerId = container.Id; } var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); if (contentType != null) { return; } const string CONTENT_TAB = "CONTENT"; ContentType docType = (ContentType)contentType ?? new ContentType(containerId) { Name = DOCUMENT_TYPE_NAME, Alias = DOCUMENT_TYPE_ALIAS, AllowedAsRoot = true, Description = "", Icon = NESTED_DOCUMENT_TYPE_ICON, ParentId = contentTypeService.Get(NESTED_DOCUMENT_TYPE_PARENT_ALIAS).Id, SortOrder = 0, Variations = ContentVariation.Culture, }; // Create the Template if it doesn't exist if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { //then create the template Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); ITemplate masterTemplate = fileService.GetTemplate(PARENT_TEMPLATE_ALIAS); newTemplate.SetMasterTemplate(masterTemplate); fileService.SaveTemplate(newTemplate); } var template = fileService.GetTemplate(TEMPLATE_ALIAS); docType.AllowedTemplates = new List <ITemplate> { template }; docType.SetDefaultTemplate(template); docType.AddPropertyGroup(CONTENT_TAB); #region Content PropertyType CotentPageTitlePropType = new PropertyType(dataTypeService.GetDataType(-88), "genericInfoPageTitle") { Name = "Page Title", Variations = ContentVariation.Culture }; docType.AddPropertyType(CotentPageTitlePropType, CONTENT_TAB); PropertyType CotentPageContentPropType = new PropertyType(dataTypeService.GetDataType(-87), "genericInfoPageContent") { Name = "Page Content", Variations = ContentVariation.Culture }; docType.AddPropertyType(CotentPageContentPropType, CONTENT_TAB); #endregion contentTypeService.Save(docType); ConnectorContext.AuditService.Add(AuditType.New, -1, docType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_NAME}' has been created"); ContentHelper.CopyPhysicalAssets(new GenericInfoPageEmbeddedResources()); } catch (Exception ex) { logger.Error(typeof(_40_GenericInfoPageDocumentType), ex.Message); logger.Error(typeof(_40_GenericInfoPageDocumentType), ex.StackTrace); } }
private void UpdateHomeDocumentType() { const string editorAlias = "tenantPreferences"; const string propertyAlias = "tenantPreferencesProperty"; const string dataTypeName = "Total Code Tenant Properties"; try { var container = dataTypeService.GetContainers(CONTAINER, 1).FirstOrDefault(); var containerId = -1; if (container != null) { containerId = container.Id; } var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); if (contentType != null) { #region Tenant Currencies if (!contentType.PropertyTypeExists("tenantCurrencies")) { PropertyType tenantCurrenciesPropType = new PropertyType(dataTypeService.GetDataType(-92), "tenantCurrencies") { Name = "Tenant Currencies", Description = "Total Code Tenant Used Currencies", Variations = ContentVariation.Nothing }; contentType.AddPropertyType(tenantCurrenciesPropType, TENANT_TAB); contentTypeService.Save(contentType); } #endregion var exists = dataTypeService.GetDataType(dataTypeName) != null; if (!exists) { var created = Web.Composing.Current.PropertyEditors.TryGet(editorAlias, out IDataEditor editor); if (created) { DataType tenantPreferencesDataType = new DataType(editor, containerId) { Name = dataTypeName }; dataTypeService.Save(tenantPreferencesDataType); PropertyType tenantPreferencesPropType = new PropertyType(tenantPreferencesDataType, propertyAlias) { Name = "Tenant Preferences", Description = "Tenant Preferences for Customers" }; contentType.AddPropertyType(tenantPreferencesPropType, TENANT_TAB); contentTypeService.Save(contentType); ConnectorContext.AuditService.Add(AuditType.Save, -1, contentType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been updated"); var tenantCurrencies = dataTypeService.GetDataType("tenantCurrencies"); if (tenantCurrencies.SortOrder != 9) { tenantCurrencies.SortOrder = 9; tenantPreferencesDataType.SortOrder = 10; dataTypeService.Save(new List <IDataType> { tenantPreferencesDataType, tenantCurrencies }); } } else { ContentHelper.CopyPhysicalAssets(new TenantPreferencesEmbeddedResources()); // copy property editor files before trying to create the data type // will need to restart the app, in order to force a refresh to attempt to create the data type again throw new DataTypeNotCreatedException("In order to create the Data Type, a Reload is required"); } } } } catch (System.Exception ex) { logger.Error(typeof(_01_HomeDocumentTypePhase2), ex.Message); logger.Error(typeof(_01_HomeDocumentTypePhase2), ex.StackTrace); } }
private void CreateDocumentType() { try { var container = contentTypeService.GetContainers(CONTAINER, 1).FirstOrDefault(); var containerId = container.Id; var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); var parentDocType = contentTypeService.Get(PARENT_NODE_DOCUMENT_TYPE_ALIAS); if (contentType == null) { ContentType docType = (ContentType)contentType ?? new ContentType(containerId) { Name = DOCUMENT_TYPE_NAME, Alias = DOCUMENT_TYPE_ALIAS, AllowedAsRoot = false, Description = DOCUMENT_TYPE_DESCRIPTION, Icon = ICON, SortOrder = 0, Variations = ContentVariation.Culture, ParentId = parentDocType.Id }; // Create the Template if it doesn't exist if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { var layoutAlias = "totalCodeLayout"; ITemplate masterTemplate = fileService.GetTemplate(layoutAlias); //then create the template Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); newTemplate.SetMasterTemplate(masterTemplate); fileService.SaveTemplate(newTemplate); } // Set templates for document type var template = fileService.GetTemplate(TEMPLATE_ALIAS); docType.AllowedTemplates = new List <ITemplate> { template }; docType.SetDefaultTemplate(template); contentTypeService.Save(docType); // set as allowed content type in account home ContentHelper.AddAllowedDocumentType(contentTypeService, PARENT_NODE_DOCUMENT_TYPE_ALIAS, DOCUMENT_TYPE_ALIAS); ConnectorContext.AuditService.Add(AuditType.New, -1, docType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_NAME}' has been created"); ContentHelper.CopyPhysicalAssets(new EditAccountDetailsEmbeddedResources()); if (createDictionaryItems) { // Check if parent Key exists, and skip if true var language = new LanguageDictionaryService(localizationService, domainService, logger); if (!language.CheckExists(typeof(Account_ParentKey))) { // Add Dictionary Items var dictionaryItems = new List <Type> { typeof(Account_ParentKey), typeof(Others_Save), typeof(Account_AccountPageTitle), typeof(Account_AccountEditPageTitle) }; language.CreateDictionaryItems(dictionaryItems); // Create Dictionary Items ConnectorContext.AuditService.Add(AuditType.Save, -1, -1, "Dictionary Items", $"Dictionaries Created"); } } } } catch (Exception ex) { logger.Error(typeof(_09_EditAccountDocumentType), ex.Message); logger.Error(typeof(_09_EditAccountDocumentType), ex.StackTrace); } }
private void CreateMilestoneItems() { try { if (createDictionaryItems) { var language = new LanguageDictionaryService(localizationService, domainService, logger); // Check if parent Key exists, and skip if true if (!language.CheckExists(typeof(Forgot_ParentKey))) { // Add Dictionary Items var dictionaryItems = new List <Type> { typeof(Forgot_ParentKey), typeof(Forgot_EnterCaptcha), typeof(Forgot_Captcha), typeof(Forgot_ForgotUsernameSuccess), typeof(Forgot_ForgotUsernameFailure), typeof(Forgot_ChangePassword), typeof(Forgot_ConfirmNewPassword), typeof(Forgot_NewPassword), typeof(Forgot_ChangePasswordSuccess), typeof(Forgot_ForgotPasswordEmailSentToTitle), typeof(Forgot_ForgotPasswordEmailSentTo), typeof(Forgot_ResendResetPasswordEmail), typeof(Forgot_ResendResetPasswordEmailSent), typeof(Forgot_ForgotPasswordInstructions), typeof(Forgot_ForgotUsernameInstructions), typeof(Forgot_ForgotPassword), typeof(Forgot_UsernameRequestSuccessful), typeof(Others_ConfirmEmail), typeof(Others_Successful) }; language.CreateDictionaryItems(dictionaryItems); // Create Dictionary Items } if (!language.CheckExists(typeof(Reset_ParentKey))) { var resetPasswordViaEmailDictionary = new List <Type> { typeof(Reset_ParentKey), typeof(Reset_ChangePassword), typeof(Reset_ResetPasswordSuccess), typeof(Reset_ResetPasswordFailure) }; language.CreateDictionaryItems(resetPasswordViaEmailDictionary); // Create Dictionary Items } ConnectorContext.AuditService.Add(AuditType.Save, -1, -1, "Reset Password Dictionary Items", "Dictionaries Created"); if (!language.CheckExists(typeof(ServerErrors_ParentKey))) { var serverErrorsDictionary = new List <Type> { typeof(ServerErrors_ParentKey), typeof(ServerErrors_MissingField), typeof(ServerErrors_InvalidEmailFormat), typeof(ServerErrors_InvalidDate), typeof(ServerErrors_InvalidAge), typeof(ServerErrors_MobileOrEmailRequired), typeof(ServerErrors_InvalidCountry), typeof(ServerErrors_InvalidCurrency), typeof(ServerErrors_InvalidLanguage), typeof(ServerErrors_InvalidTimeZone), typeof(ServerErrors_ExistingCustomer), typeof(ServerErrors_EmailNotFound), typeof(ServerErrors_EmailSendFail), typeof(ServerErrors_ChangePassword), typeof(ServerErrors_InvalidCustomer), typeof(ServerErrors_InvalidOldPassword), typeof(ServerErrors_MatchingOldAndNewPassword), typeof(ServerErrors_InvalidCustomerStatus), typeof(ServerErrors_CustomerNotFound), typeof(ServerErrors_VerificationRecordNotFound), typeof(ServerErrors_VerificationEmailExpired), typeof(ServerErrors_ValidationCodeExpired), typeof(ServerErrors_ValidationCodeSendFail), typeof(ServerErrors_SMSSendFail), typeof(ServerErrors_InvalidMobileNumber), typeof(ServerErrors_InvalidVerificationEmail), typeof(ServerErrors_VerificationCodeLimitExceeded), typeof(ServerErrors_MobileNumberNotFound), typeof(ServerErrors_ValidationCodeInvalid), typeof(ServerErrors_UnhandledError) }; language.CreateDictionaryItems(serverErrorsDictionary); // Create Dictionary Items ConnectorContext.AuditService.Add(AuditType.Save, -1, -1, "Server Error Dictionary Items", "Dictionaries Created"); } var firstEmbeddedResource = new Milestone7EmbeddedResources().Resources[0]; if (!ContentHelper.AssetAlreadyExists(firstEmbeddedResource.FileName, firstEmbeddedResource.OutputDirectory)) { ContentHelper.CopyPhysicalAssets(new Milestone7EmbeddedResources()); ConnectorContext.AuditService.Add(AuditType.Save, -1, -1, "Templates", "Templates Created"); } // changed Email Confirmation page to remove from Allowed in Root var confirmEmailDocType = contentTypeService.Get(_03_ConfirmEmailDocumentType.DOCUMENT_TYPE_ALIAS); if (!confirmEmailDocType.AllowedAsRoot) { confirmEmailDocType.AllowedAsRoot = false; contentTypeService.Save(confirmEmailDocType); } // delete en-GB var enGB = localizationService.GetLanguageByIsoCode("en-GB"); if (enGB != null) { localizationService.Delete(enGB); } } } catch (Exception ex) { logger.Error(typeof(_06_Phase2Milestone7), ex.Message); logger.Error(typeof(_06_Phase2Milestone7), ex.StackTrace); } }
private void Reconfigure() { const string propertyAlias = "gameSlider", propertyName = "Game Slider", propertyDescription = "Slider with game banners"; try { var casinoDocType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); // Create the Template if it doesn't exist if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { //then create the template Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); ITemplate masterTemplate = fileService.GetTemplate(PARENT_TEMPLATE_ALIAS); newTemplate.SetMasterTemplate(masterTemplate); fileService.SaveTemplate(newTemplate); // Set template for document type casinoDocType.AddTemplate(contentTypeService, newTemplate); ContentHelper.CopyPhysicalAssets(new ReconfigureCasinoPageEmbeddedResources()); ConnectorContext.AuditService.Add(AuditType.Save, -1, newTemplate.Id, "Template", $"Teplate '{TEMPLATE_NAME}' has been created and assigned"); } var dataTypeContainer = dataTypeService.GetContainers(DATA_TYPE_CONTAINER, 1).FirstOrDefault(); var dataTypeContainerId = -1; if (dataTypeContainer != null) { dataTypeContainerId = dataTypeContainer.Id; } var exists = dataTypeService.GetDataType(propertyName) != null; if (!exists) { var created = Web.Composing.Current.PropertyEditors.TryGet("Umbraco.NestedContent", out IDataEditor editor); if (created) { DataType bannerSliderNestedDataType = new DataType(editor, dataTypeContainerId) { Name = propertyName, ParentId = dataTypeContainerId, Configuration = new NestedContentConfiguration { MinItems = 0, MaxItems = 999, ConfirmDeletes = true, HideLabel = false, ShowIcons = true, ContentTypes = new[] { new NestedContentConfiguration.ContentType { Alias = NESTED_DOCUMENT_TYPE_ALIAS, TabAlias = SLIDERS_TAB } } } }; dataTypeService.Save(bannerSliderNestedDataType); ConnectorContext.AuditService.Add(AuditType.Save, -1, casinoDocType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been updated"); } } if (!casinoDocType.PropertyTypeExists(propertyAlias)) { var bannerSliderNestedDataType = dataTypeService.GetDataType(propertyName); PropertyType BannerSlider = new PropertyType(bannerSliderNestedDataType, propertyAlias) { Name = propertyName, Description = propertyDescription, Variations = ContentVariation.Culture }; casinoDocType.AddPropertyGroup(SLIDERS_TAB); casinoDocType.AddPropertyType(BannerSlider, SLIDERS_TAB); contentTypeService.Save(casinoDocType); } } catch (Exception ex) { logger.Error(typeof(_10_CasinoPageIntegration), ex.Message); logger.Error(typeof(_10_CasinoPageIntegration), ex.StackTrace); } }
private void CreateErrorPageDocumentType() { try { var container = contentTypeService.GetContainers(CONTAINER, 1).FirstOrDefault(); int containerId = container.Id; var errorDocType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); if (errorDocType == null) { errorDocType = new ContentType(containerId) { Name = DOCUMENT_TYPE_NAME, Alias = DOCUMENT_TYPE_ALIAS, AllowedAsRoot = true, ParentId = contentTypeService.Get("totalCodeBasePage").Id, Description = DOCUMENT_TYPE_DESCRIPTION, Icon = ICON, SortOrder = 0, Variations = ContentVariation.Culture }; errorDocType.AddPropertyGroup(CONTENT_TAB); PropertyType errorTitlePropertyType = new PropertyType(dataTypeService.GetDataType(-88), "errorTitle") { Name = "Page Title", Description = "Title to display to users when reaching this page", Variations = ContentVariation.Culture }; errorDocType.AddPropertyType(errorTitlePropertyType, CONTENT_TAB); var richTextEditor = dataTypeService.GetDataType("Full Rich Text Editor"); string propertyName = "Page Content", propertyDescription = "Text to be displayed on the Page"; PropertyType richTextPropType = new PropertyType(dataTypeService.GetDataType(richTextEditor.Id), "pageContent") { Name = propertyName, Description = propertyDescription, Variations = ContentVariation.Culture }; errorDocType.AddPropertyType(richTextPropType, CONTENT_TAB); if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { ITemplate masterTemplate = fileService.GetTemplate(TEMPLATE_PARENT_ALIAS); Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); newTemplate.SetMasterTemplate(masterTemplate); fileService.SaveTemplate(newTemplate); errorDocType.AllowedTemplates = new List <ITemplate> { newTemplate }; errorDocType.SetDefaultTemplate(newTemplate); } contentTypeService.Save(errorDocType); ConnectorContext.AuditService.Add(AuditType.New, -1, errorDocType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_NAME}' has been created"); ContentHelper.CopyPhysicalAssets(new ErrorPageEmbeddedResources()); NodeHelper helper = new NodeHelper(); helper.CreateErrorNode(DOCUMENT_TYPE_ALIAS, "Page Not Found (404)", domainService); } } catch (System.Exception ex) { logger.Error(typeof(_23_ErrorPageDocumentType), ex.Message); logger.Error(typeof(_23_ErrorPageDocumentType), ex.StackTrace); } }
private void UpdateDocumentType() { const string svgViewerEditorAlias = "svgCustomView", svgViewerPropertyAlias = "pageCustomSvgIcon", svgViewerPropertyName = "Page Custom Svg Icon", svgViewerPropertyDescription = "Displays the page icon from the strip-menu svg file", svgViewerDataTypeName = "Page Custom Svg Icon"; try { var container = dataTypeService.GetContainers(CONTAINER, 1).FirstOrDefault(); var containerId = -1; if (container != null) { containerId = container.Id; } var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); if (contentType != null) { var exists = dataTypeService.GetDataType(svgViewerDataTypeName) != null; if (!exists) { var notCreated = Web.Composing.Current.PropertyEditors.TryGet(svgViewerEditorAlias, out IDataEditor editor); if (notCreated) { DataType svgDataType = new DataType(editor, containerId) { Name = svgViewerDataTypeName }; dataTypeService.Save(svgDataType); } else { var firstEmbeddedResource = new SvgViewerEmbeddedResources().Resources[0]; if (!ContentHelper.AssetAlreadyExists(firstEmbeddedResource.FileName, firstEmbeddedResource.OutputDirectory)) { ContentHelper.CopyPhysicalAssets(new SvgViewerEmbeddedResources()); ConnectorContext.AuditService.Add(AuditType.Save, 1, contentType.Id, "Resources", "Embedded Resources Copied"); } // will need to restart the app, in order to force a refresh to attempt to create the data type again throw new DataTypeNotCreatedException("In order to create the Data Type, a Reload is required"); } } if (!contentType.PropertyTypeExists(svgViewerPropertyAlias)) { var svgDataType = dataTypeService.GetDataType(svgViewerPropertyName); PropertyType svgPropertyType = new PropertyType(svgDataType, svgViewerPropertyAlias) { Name = svgViewerPropertyName, Description = svgViewerPropertyDescription, Variations = ContentVariation.Nothing }; contentType.AddPropertyType(svgPropertyType, TAB); contentTypeService.Save(contentType); ConnectorContext.AuditService.Add(AuditType.Save, -1, contentType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been updated"); } } } catch (System.Exception ex) { logger.Error(typeof(_15_UpdateGenericDocumentTypeForSvgIcons), ex.Message); logger.Error(typeof(_15_UpdateGenericDocumentTypeForSvgIcons), ex.StackTrace); } }