Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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);
            }
        }