本文整理汇总了C#中SiteInfo.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# SiteInfo.Clone方法的具体用法?C# SiteInfo.Clone怎么用?C# SiteInfo.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteInfo
的用法示例。
在下文中一共展示了SiteInfo.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveSite
/// <summary>
/// Save edited site.
/// </summary>
private bool SaveSite(SiteInfo oldSi)
{
// Correct domain name and return it to textbox
txtDomainName.Text = URLHelper.RemoveProtocol(txtDomainName.Text);
// Get SiteInfo with the given siteID
SiteInfo si = oldSi.Clone();
if (siteId > 0)
{
try
{
// Keep information about running status
bool runSite = (si.Status == SiteStatusEnum.Running);
if (si.DisplayName != txtDisplayName.Text)
{
// Refresh the breadcrumb
ScriptHelper.RefreshTabHeader(Page, null);
}
// Update SiteInfo parameters
si.SiteName = txtCodeName.Text;
si.Description = txtDescription.Text;
si.DisplayName = txtDisplayName.Text;
si.DomainName = txtDomainName.Text;
si.DefaultVisitorCulture = ValidationHelper.GetString(cultureSelector.Value, "");
si.SiteID = siteId;
si.SiteDefaultStylesheetID = ValidationHelper.GetInteger(ctrlSiteSelectStyleSheet.Value, 0);
si.SiteDefaultEditorStylesheet = ValidationHelper.GetInteger(ctrlEditorSelectStyleSheet.Value, 0);
si.Status = SiteStatusEnum.Stopped;
// Save SiteInfo
SiteInfoProvider.SetSiteInfo(si);
// Remove cached cultures for site
CultureInfoProvider.ClearSiteCultures(true);
// Clear settings if sitename changes
if (si.SiteName.ToLower() != txtCodeName.Text.Trim().ToLower())
{
SettingsKeyProvider.Clear(true);
}
// Reindex hashtable with sessions if SiteName changes and change info message
if (oldSi.SiteName != txtCodeName.Text)
{
SessionManager.ReindexSessionsInfosHashtable(oldSi.SiteName, txtCodeName.Text);
if (SearchIndexInfoProvider.SearchEnabled)
{
lblInfo.Text = String.Format(GetString("general.changessaved") + " " + GetString("srch.indexrequiresrebuild"), "<a href=\"javascript:" + Page.ClientScript.GetPostBackEventReference(this, "saved") + "\">" + GetString("General.clickhere") + "</a>");
}
}
if (runSite)
{
DataSet ds = SiteInfoProvider.CheckDomainNameForCollision(txtDomainName.Text.Trim(), si.SiteID);
if (!DataHelper.DataSourceIsEmpty(ds))
{
SiteInfo runningsi = SiteInfoProvider.GetSiteInfo(ValidationHelper.GetInteger(ds.Tables[0].Rows[0]["SiteID"], 0));
if (runningsi != null)
{
string collisionSite = HTMLHelper.HTMLEncode(runningsi.DisplayName);
string collisionDomain = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ds.Tables[0].Rows[0]["SiteDomainAliasName"], ""));
lblError.Text = String.Format(GetString("SiteDomain.RunError"), collisionSite, collisionDomain, HTMLHelper.HTMLEncode(si.DisplayName));
lblError.Visible = true;
}
}
else
{
// Run current site
SiteInfoProvider.RunSite(si.SiteName);
}
}
}
catch (RunningSiteException exc)
{
lblError.Visible = true;
lblError.Text = exc.Message;
}
return true;
}
else
{
return false;
}
}