当前位置: 首页>>代码示例>>C#>>正文


C# TreeProvider.ChangeSiteDefaultCulture方法代码示例

本文整理汇总了C#中TreeProvider.ChangeSiteDefaultCulture方法的典型用法代码示例。如果您正苦于以下问题:C# TreeProvider.ChangeSiteDefaultCulture方法的具体用法?C# TreeProvider.ChangeSiteDefaultCulture怎么用?C# TreeProvider.ChangeSiteDefaultCulture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TreeProvider的用法示例。


在下文中一共展示了TreeProvider.ChangeSiteDefaultCulture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: wzdImport_NextButtonClick


//.........这里部分代码省略.........
                string error = ImportExportControl.CheckLicenses(ImportSettings);
                if (!string.IsNullOrEmpty(error))
                {
                    lblError.Text = error;

                    e.Cancel = true;
                    return;
                }

                ImportSettings = pnlImport.Settings;

                PreviousButton.Enabled = false;
                NextButton.Enabled = false;

                SiteName = ImportSettings.SiteName;
                Domain = ImportSettings.SiteDomain;

                // Init the Mimetype helper (required for the Import)
                MimeTypeHelper.LoadMimeTypes();

                // Start asynchronnous Import
                ImportSettings.SetSettings(ImportExportHelper.SETTINGS_DELETE_TEMPORARY_FILES, false);
                ImportSettings.DefaultProcessObjectType = ProcessObjectEnum.Selected;
                ImportManager.Settings = ImportSettings;

                // Import site asynchronously
                ctrlImport.RunAsync(ImportManager.Import, WindowsIdentity.GetCurrent());
                ctrlImport.PostbackOnError = false;

                ltlScript.Text = ScriptHelper.GetScript("StartImportStateTimer();");
                wzdImport.ActiveStepIndex++;
                break;

                // Import progress
            case 4:
                PreviousButton.Visible = false;

                CultureHelper.SetPreferredCulture(Culture);
                if (siteType.SelectTemplate)
                {
                    // Done
                    finishSite.Domain = Domain;
                    finishSite.SiteIsRunning = SiteIsRunning;
                    wzdImport.ActiveStepIndex = 7;
                }
                else
                {
                    if (ImportManager.Settings.IsWarning())
                    {
                        try
                        {
                            // Convert default culture
                            TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);
                            tree.ChangeSiteDefaultCulture(SiteName, Culture, "en-US");

                            // Change root GUID
                            TreeNode root = DocumentHelper.GetDocument(SiteName, "/", Culture, false, "cms.root", null, null, 1, false, null, tree);
                            if (root != null)
                            {
                                root.NodeGUID = Guid.NewGuid();
                                DocumentHelper.UpdateDocument(root, tree);
                            }
                        }
                        catch (Exception ex)
                        {
                            EventLogProvider ev = new EventLogProvider();
                            ev.LogEvent("NewSiteWizard", "FINISH", ex);
                            lblError.Text = ex.Message;
                            e.Cancel = true;
                            return;
                        }
                    }
                    selectMaster.SiteName = SiteName;
                    selectMaster.ReloadData();
                }
                break;

                // Master template
            case 5:
                if (!selectMaster.ApplySettings())
                {
                    e.Cancel = true;
                    return;
                }

                siteStructure.SiteName = SiteName;
                break;

                // Define site structure
            case 6:
                finishSite.Domain = Domain;
                finishSite.SiteIsRunning = SiteIsRunning;
                break;

                // Other steps
            default:
                wzdImport.ActiveStepIndex = e.NextStepIndex;
                break;
        }
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:101,代码来源:NewSiteWizard.ascx.cs

示例2: ctrlImport_OnFinished

    protected void ctrlImport_OnFinished(object sender, EventArgs e)
    {
        try
        {
            // Convert default culture
            if (!siteType.SelectTemplate)
            {
                TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);
                tree.ChangeSiteDefaultCulture(SiteName, Culture, "en-US");

                // Change root GUID
                TreeNode root = DocumentHelper.GetDocument(SiteName, "/", Culture, false, "cms.root", null, null, 1, false, null, tree);
                if (root != null)
                {
                    root.NodeGUID = Guid.NewGuid();
                    DocumentHelper.UpdateDocument(root, tree);
                }
            }
        }
        catch (Exception ex)
        {
            EventLogProvider ev = new EventLogProvider();
            ev.LogEvent("NewSiteWizard", "FINISH", ex);
        }
        finally
        {
            if (ImportManager.Settings.ProcessCanceled)
            {
                NextButton.Enabled = CancelButton.Enabled = false;
                mImportCanceled = true;
                lblProgress.Text = "<strong>" + ResHelper.GetAPIString("ImportSite.ImportCanceled", "Import process has been cancelled.") + "</strong>";
            }
            else
            {
                if (!ImportManager.Settings.IsWarning() && !ImportManager.Settings.IsError())
                {
                    PreviousButton.Visible = false;
                    CultureHelper.SetPreferredCulture(Culture);
                    if (siteType.SelectTemplate)
                    {
                        // Done
                        finishSite.Domain = Domain;
                        wzdImport.ActiveStepIndex = 7;
                    }
                    else
                    {
                        selectMaster.SiteName = SiteName;
                        wzdImport.ActiveStepIndex += 1;
                        selectMaster.ReloadData();
                    }
                }
            }

            // Stop the timer
            string script = "StopSelectionTimer();";
            ltlScriptAfter.Text += ScriptHelper.GetScript(script);
        }
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:58,代码来源:NewSiteWizard.ascx.cs


注:本文中的TreeProvider.ChangeSiteDefaultCulture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。