本文整理汇总了C#中SiteInfo类的典型用法代码示例。如果您正苦于以下问题:C# SiteInfo类的具体用法?C# SiteInfo怎么用?C# SiteInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SiteInfo类属于命名空间,在下文中一共展示了SiteInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetWildcardSettingsFolder
public static Item GetWildcardSettingsFolder(SiteInfo siteInfo)
{
if(Sitecore.Context.Database == null || siteInfo == null)
{
return null;
}
string xpath = $"/sitecore/wildcard/settings/*[@name = '{siteInfo.Name}']";
var node = Factory.GetConfigNode(xpath);
if (node == null)
{
node = Factory.GetConfigNode("/sitecore/wildcard/settings/*[@name = 'Default']");
}
if(node == null)
{
return null;
}
var path = XmlUtil.GetAttribute("path", node, true);
if(string.IsNullOrWhiteSpace(path))
{
return null;
}
if(!path.StartsWith("/sitecore/", System.StringComparison.OrdinalIgnoreCase))
{
path = string.Concat(siteInfo.RootPath, StringUtil.EnsurePrefix('/', path));
}
return Sitecore.Context.Database.GetItem(path);
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
siteId = QueryHelper.GetInteger("siteid", 0);
si = SiteInfoProvider.GetSiteInfo(siteId);
EditedObject = si;
if (!RequestHelper.IsPostBack())
{
// Load input fields for the first time
txtMessage.Value = si.SiteOfflineMessage;
txtURL.Text = si.SiteOfflineRedirectURL;
radURL.Checked = !String.IsNullOrEmpty(txtURL.Text);
radMessage.Checked = !String.IsNullOrEmpty(txtMessage.Value);
if (!radURL.Checked && !radMessage.Checked)
{
radMessage.Checked = true;
}
}
txtMessage.MediaDialogConfig.HideContent = true;
ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "EnableDisableTextBox", ScriptHelper.GetScript(
"function EnableDisableBox(elementId, state) \n" +
"{ var elem = document.getElementById(elementId); \n" +
" if (elem) { \n" +
" if (state == 0) { elem.disabled = 'disabled'; elem.readonly = 'readonly'; } \n" +
" if (state == 1) { elem.disabled = ''; elem.readonly = ''; } \n" +
" } \n" +
"} \n"));
radMessage.Attributes.Add("onclick", "EnableDisableBox('" + txtURL.ClientID + "', 0); EnableDisableBox('" + txtMessage.ClientID + "', 1);");
radURL.Attributes.Add("onclick", "EnableDisableBox('" + txtURL.ClientID + "', 1); EnableDisableBox('" + txtMessage.ClientID + "', 0);");
}
示例3: ImportMyLogsWithCachesAsync
public async Task ImportMyLogsWithCachesAsync(Core.Storage.Database db, SiteInfo activeSite)
{
using (Utils.DataUpdater upd = new Utils.DataUpdater(db))
{
await Task.Run(new Action(() => ImportMyLogsWithCaches(db, activeSite)));
}
}
示例4: GetUsersWaitingForApprovalCount
/// <summary>
/// Gets number of users waiting for approval.
/// </summary>
/// <param name="site">Tile's site</param>
/// <returns>Number of users waiting for approval</returns>
private static int GetUsersWaitingForApprovalCount(SiteInfo site)
{
return UserInfoProvider.GetUsers()
.Source(s => s.Join<UserSettingsInfo>("UserID", "UserSettingsUserID"))
.OnSite(site.SiteID)
.WhereEquals("UserWaitingForApproval", 1)
.Count;
}
示例5: SetSiteInfoInternal
/// <summary>
/// Sets the specified site data.
/// </summary>
/// <param name="siteInfoObj">New site info data</param>
protected override void SetSiteInfoInternal(SiteInfo siteInfoObj)
{
base.SetSiteInfoInternal(siteInfoObj);
// Log the event that the site was updated
EventLogProvider ev = new EventLogProvider();
ev.LogEvent(EventLogProvider.EVENT_TYPE_INFORMATION, DateTime.Now, "MyCustomSiteInfoProvider", "SetSiteInfo", null, "The site was updated");
}
示例6: GetHostName
private static string GetHostName(SiteInfo site)
{
if (!string.IsNullOrEmpty(site.TargetHostName))
return site.TargetHostName;
if (Uri.CheckHostName(site.HostName) != UriHostNameType.Unknown)
return site.HostName;
throw new ConfigurationErrorsException($"Cannot determine hostname for site '{site}'");
}
示例7: AuthorizationWindow
public AuthorizationWindow(SiteInfo siteInfo)
: this()
{
_siteInfo = siteInfo;
webBrowser.LoadCompleted += webBrowser_LoadCompleted;
webBrowser.NavigateToString("<html><body><h1>Loading authorization page, please wait...</h1></body></html>");
}
示例8: CreateSiteDefinition
private SiteDefinition CreateSiteDefinition(SiteInfo siteInfo)
{
return new SiteDefinition
{
HostName = siteInfo.HostName,
Name = siteInfo.Name,
IsCurrent = IsCurrent(siteInfo.Name)
};
}
示例9: LogMessage
public static void LogMessage(string message, SiteInfo siteInfo)
{
StringBuilder msg = new StringBuilder(Environment.NewLine);
msg.Append("*** MESSAGE ***\r\n")
.Append("SITE:\t").Append(siteInfo.SiteCode).Append("\r\n")
.Append("DATE:\t").Append(DateTime.Now.ToString()).Append("\r\n")
.Append("CONTENT:\t").Append(message).Append("\r\n");
File.AppendAllText(LOG_FILE, msg.ToString(), Encoding.UTF8);
}
示例10: LogError
public static void LogError(Exception ex, SiteInfo siteInfo)
{
StringBuilder err = new StringBuilder(Environment.NewLine);
err.Append("=== EXCEPTION ===\r\n")
.Append("SITE:\t").Append(siteInfo.SiteCode).Append("\r\n")
.Append("DATE:\t").Append(DateTime.Now.ToString()).Append("\r\n")
.Append("MESSAGE:").Append(ex.Message).Append("\r\n")
.Append("STACKTRACE:").Append("\r\n")
.Append(ex.StackTrace);
File.AppendAllText(LOG_FILE, err.ToString(), Encoding.UTF8);
}
示例11: GetSiteRootItem
private Item GetSiteRootItem(SiteInfo site)
{
if (site == null)
throw new ArgumentNullException(nameof(site));
if (string.IsNullOrEmpty(site.Database))
return null;
var database = Database.GetDatabase(site.Database);
var item = database?.GetItem(site.RootPath);
if (item == null || !IsSite(item))
return null;
return item;
}
示例12: GetDataSources_ShouldReturnSourceTemplateFromSiteDefinition
public void GetDataSources_ShouldReturnSourceTemplateFromSiteDefinition([Frozen]ISettingsProvider settingsProvider, [Greedy]ConfigurationDatasourceProvider provider, string settingName, Item contextItem, DbItem sourceDbItem, Db db)
{
provider.Database = db.Database;
db.Add(sourceDbItem);
var sourceTemplate = db.GetItem(sourceDbItem.ID);
var attributeName = $"{settingName}.{ConfigurationDatasourceProvider.DatasourceTemplatePostfix}";
var siteInfo = new SiteInfo(new StringDictionary { { attributeName, sourceTemplate.ID.ToString() } });
settingsProvider.GetCurrentSiteInfo(Arg.Any<Item>()).Returns(siteInfo);
var sources = provider.GetDatasourceTemplate(settingName, contextItem);
sources.Should().NotBeNull();
sources.ID.ShouldBeEquivalentTo(sourceTemplate.ID);
}
示例13: GetNumberOfPendingPages
/// <summary>
/// Gets number of total pages waiting for the approval.
/// </summary>
/// <param name="siteInfo">Site the pages belongs to</param>
/// <param name="userInfo">The user providing the approval</param>
/// <returns>Total number of waiting pages</returns>
private int GetNumberOfPendingPages(SiteInfo siteInfo, UserInfo userInfo)
{
int siteId = siteInfo.SiteID;
// Get correct pending steps which may current user manage
var steps = new IDQuery<WorkflowStepInfo>().Where(WorkflowStepInfoProvider.GetWorkflowPendingStepsWhereCondition(userInfo, siteId));
var docs = new IDQuery<TreeNode>()
.OnSite(siteId)
.WhereIn("DocumentWorkflowStepID", steps);
return docs.Count;
}
示例14: GetCarPmData
/// <summary>
/// 获取carPm数据
/// </summary>
/// <param name="siteInfo"></param>
/// <param name="log"></param>
/// <param name="tag"></param>
/// <param name="xmlSql"></param>
private void GetCarPmData(SiteInfo siteInfo, StringBuilder log, object tag, XmlDocument xmlSql, Database db, Database dbMultekApps)
{
// 从配置文件中获取,以分号隔开
string customerStr = xmlSql.SelectSingleNode("/Root/CarPm/Customers").InnerText.Trim();
string querySql = xmlSql.SelectSingleNode("/Root/CarPm/Select").InnerText;
string insertSql = xmlSql.SelectSingleNode("/Root/CarPm/Insert").InnerText;
string countSql = xmlSql.SelectSingleNode("/Root/CarPm/QueryCount").InnerText;
string updateSql = xmlSql.SelectSingleNode("/Root/CarPm/Update").InnerText;
// 拆分用户字段
string[] customs = customerStr.Split(new char[] {';', ',', ';', ','});
foreach (string custom in customs)
{
if (!string.IsNullOrWhiteSpace(custom))
{
DataTable dtCarPm = dbMultekApps.CustomSql(string.Format(querySql, custom)).ToDataTable();
foreach (DataRow drCarPm in dtCarPm.Rows)
{// 插入每行数据, 如存在则更新,否则插入
int count = db.CustomSql(string.Format(countSql, drCarPm["rpm"].ToString())).ToScalar<int>();
if (count > 0)
{//存在,则更新
string updateSqlNew = string.Format(updateSql,
drCarPm["pdesc"].ToString().Replace("'", "''"),
drCarPm["compelet_date"].ToString(),
drCarPm["resolution"].ToString().Replace("'", "''"),
drCarPm["delay_date"].ToString(),
drCarPm["rpm"].ToString());
db.CustomSql(updateSqlNew).ExecuteNonQuery();
}
else
{//不存在,插入
string insertSqlNew = string.Format(insertSql,
drCarPm["rpm"].ToString(),
custom,
drCarPm["pdesc"].ToString().Replace("'", "''"),
drCarPm["occurr_date"].ToString(),
drCarPm["compelet_date"].ToString(),
drCarPm["resolution"].ToString().Replace("'", "''"),
drCarPm["delay_date"].ToString()
);
db.CustomSql(insertSqlNew).ExecuteNonQuery();
}
}
}
}
}
示例15: CreateNewSiteInfo
public void CreateNewSiteInfo()
{
var profileId = profileRepository.FindProfileId(profileReference);
siteInfoRepository.DeleteSiteInfo(profileId);
var siteInfo = new SiteInfo
{
Id = string.Empty,
ProfileId = profileId,
Theme = "blue",
Title = "Michael Quinn - .NET Developer Irvine, CA",
Description = "Michael Quinn - .NET Developer Irvine, CA"
};
siteInfoRepository.SaveSiteInfo(siteInfo);
var results = siteInfoRepository.GetSiteInfo(profileId);
Assert.AreEqual(profileId, results.ProfileId);
}