/// <summary> /// Executes an action on default culture text if it does not exist. Actions include - nothing, create empty string, copy current culture text /// </summary> /// <param name="actionForDefaultCulture">Specific action</param> /// <param name="dynamicText">Current dynamic text entity</param> /// <param name="currentCulture">Current culture entity</param> /// <param name="dictionaryScope">Current dictionary scope entity</param> private void ExecuteDefaultCultureAction( IfDefaultNotExistAction actionForDefaultCulture, DynamicText dynamicText, ICulture currentCulture, IDictionaryScope dictionaryScope ) { if (actionForDefaultCulture == IfDefaultNotExistAction.DoNothing) { return; } var defaultCulture = GetDefaultCulture(); if (currentCulture.Equals(defaultCulture)) { return; } var defaultText = m_staticTextUoW.GetByNameAndCultureAndScope( dynamicText.Name, defaultCulture.Name, dictionaryScope.Name ); if (defaultText != null) { return; } string text; switch (actionForDefaultCulture) { case IfDefaultNotExistAction.DoNothing: return; case IfDefaultNotExistAction.CreateEmpty: text = string.Empty; break; case IfDefaultNotExistAction.CreateTextCopy: text = dynamicText.Text; break; default: throw new ArgumentOutOfRangeException( nameof(actionForDefaultCulture), actionForDefaultCulture, "Invalid default language save action" ); } m_staticTextUoW.AddStaticText( dynamicText.Name, dynamicText.Format, text, defaultCulture.Name, dictionaryScope.Name, dynamicText.ModificationUser, DateTime.UtcNow ); }