本文整理汇总了C#中Blog.MarkOld方法的典型用法代码示例。如果您正苦于以下问题:C# Blog.MarkOld方法的具体用法?C# Blog.MarkOld怎么用?C# Blog.MarkOld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blog
的用法示例。
在下文中一共展示了Blog.MarkOld方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillBlogs
/// <summary>
/// Fills an unsorted list of Blogs.
/// </summary>
/// <returns>
/// A List<Blog> of all Blogs
/// </returns>
public override List<Blog> FillBlogs()
{
var blogs = new List<Blog>();
// we want the folder of the primary blog instance, as "Blogs" is site-wide, not per-blog.
// pass null to GetFolder() to get the base storage location.
var fileName = this.GetFolder(null) + "blogs.xml";
if (!File.Exists(fileName))
{
return blogs;
}
var doc = new XmlDocument();
doc.Load(fileName);
var nodes = doc.SelectNodes("blogs/item");
if (nodes != null)
{
foreach (XmlNode node in nodes)
{
var b = new Blog()
{
Id = node.Attributes["id"] == null ? Guid.NewGuid() : new Guid(node.Attributes["id"].Value),
Name = node.Attributes["name"] == null ? string.Empty : node.Attributes["name"].Value,
StorageContainerName = node.Attributes["storageContainerName"] == null ? string.Empty : node.Attributes["storageContainerName"].Value,
Hostname = node.Attributes["hostName"] == null ? string.Empty : node.Attributes["hostName"].Value,
IsAnyTextBeforeHostnameAccepted = node.Attributes["isAnyTextBeforeHostnameAccepted"] == null ? false : bool.Parse(node.Attributes["isAnyTextBeforeHostnameAccepted"].Value),
VirtualPath = node.Attributes["virtualPath"] == null ? string.Empty : node.Attributes["virtualPath"].Value,
IsPrimary = node.Attributes["isPrimary"] == null ? false : bool.Parse(node.Attributes["isPrimary"].Value),
IsActive = node.Attributes["isActive"] == null ? false : bool.Parse(node.Attributes["isActive"].Value),
IsSiteAggregation = node.Attributes["isSiteAggregation"] == null ? false : bool.Parse(node.Attributes["isSiteAggregation"].Value)
};
blogs.Add(b);
b.MarkOld();
}
}
return blogs;
}
示例2: FillBlogs
/// <summary>
/// Gets all Blogs in database
/// </summary>
/// <returns>
/// List of Blogs
/// </returns>
public override List<Blog> FillBlogs()
{
var blogs = new List<Blog>();
using (var conn = this.CreateConnection())
{
if (conn.HasConnection)
{
using (var cmd = conn.CreateTextCommand(string.Format("SELECT BlogId, BlogName, Hostname, IsAnyTextBeforeHostnameAccepted, StorageContainerName, VirtualPath, IsPrimary, IsActive, IsSiteAggregation FROM {0}Blogs ", this.tablePrefix)))
{
using (var rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
var b = new Blog
{
Id = rdr.GetGuid(0),
Name = rdr.GetString(1),
Hostname = rdr.GetString(2),
IsAnyTextBeforeHostnameAccepted = rdr.GetBoolean(3),
StorageContainerName = rdr.GetString(4),
VirtualPath = rdr.GetString(5),
IsPrimary = rdr.GetBoolean(6),
IsActive = rdr.GetBoolean(7),
IsSiteAggregation = rdr.GetBoolean(8)
};
blogs.Add(b);
b.MarkOld();
}
}
}
}
}
return blogs;
}