本文整理汇总了C#中Category.MarkOld方法的典型用法代码示例。如果您正苦于以下问题:C# Category.MarkOld方法的具体用法?C# Category.MarkOld怎么用?C# Category.MarkOld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category.MarkOld方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillCategories
/// <summary>
/// Fills an unsorted list of categories.
/// </summary>
/// <returns>A list of Category objects got from the XML data document</returns>
public override List<Category> FillCategories()
{
string fileName = _Folder + "Categories.xml";
if (!File.Exists(fileName))
return null;
XmlDocument doc = new XmlDocument();
doc.Load(fileName);
List<Category> categories = new List<Category>();
foreach (XmlNode node in doc.SelectNodes("categories/category"))
{
Category category = new Category();
category.Id = new Guid(node.Attributes["id"].InnerText);
category.Title = node.InnerText;
if (node.Attributes["description"] != null)
category.Description = node.Attributes["description"].InnerText;
else
category.Description = string.Empty;
categories.Add(category);
category.MarkOld();
}
return categories;
}
示例2: SelectCategory
/// <summary>
/// Gets a Category based on a Guid
/// </summary>
/// <param name="id">The category's Guid.</param>
/// <returns>A matching Category</returns>
public override Category SelectCategory(Guid id)
{
List<Category> categories = Category.Categories;
Category category = new Category();
foreach (Category cat in categories)
{
if (cat.Id == id)
category = cat;
}
category.MarkOld();
return category;
}
示例3: FillCategories
/// <summary>
/// Gets all categories in database
/// </summary>
/// <returns>List of categories</returns>
public override List<Category> FillCategories()
{
List<Category> categories = new List<Category>();
string connString = ConfigurationManager.ConnectionStrings[connStringName].ConnectionString;
string providerName = ConfigurationManager.ConnectionStrings[connStringName].ProviderName;
DbProviderFactory provider = DbProviderFactories.GetFactory(providerName);
using (DbConnection conn = provider.CreateConnection())
{
conn.ConnectionString = connString;
using (DbCommand cmd = conn.CreateCommand())
{
string sqlQuery = "SELECT CategoryID, CategoryName, description, ParentID " +
"FROM " + tablePrefix + "Categories ";
cmd.CommandText = sqlQuery;
cmd.CommandType = CommandType.Text;
conn.Open();
using (DbDataReader rdr = cmd.ExecuteReader())
{
if (rdr.HasRows)
{
while (rdr.Read())
{
Category cat = new Category();
cat.Title = rdr.GetString(1);
if (rdr.IsDBNull(2))
cat.Description = "";
else
cat.Description = rdr.GetString(2);
if (rdr.IsDBNull(3))
cat.Parent = null;
else
cat.Parent = new Guid(rdr.GetGuid(3).ToString());
cat.Id = new Guid(rdr.GetGuid(0).ToString());
categories.Add(cat);
cat.MarkOld();
}
}
}
}
}
return categories;
}
示例4: FillCategories
/// <summary>
/// Gets all categories in database
/// </summary>
/// <returns>
/// List of categories
/// </returns>
public override List<Category> FillCategories(Blog blog)
{
var categories = new List<Category>();
using (var conn = this.CreateConnection())
{
if (conn.HasConnection)
{
using (var cmd = conn.CreateTextCommand(string.Format("SELECT CategoryID, CategoryName, description, ParentID FROM {0}Categories WHERE BlogId = {1}blogid ", this.tablePrefix, this.parmPrefix)))
{
cmd.Parameters.Add(conn.CreateParameter(FormatParamName("blogid"), blog.Id.ToString()));
using (var rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
var cat = new Category
{
Title = rdr.GetString(1),
Description = rdr.IsDBNull(2) ? string.Empty : rdr.GetString(2),
Parent = rdr.IsDBNull(3) ? (Guid?)null : new Guid(rdr.GetGuid(3).ToString()),
Id = new Guid(rdr.GetGuid(0).ToString())
};
categories.Add(cat);
cat.MarkOld();
}
}
}
}
}
return categories;
}
示例5: SelectCategory
/// <summary>
/// Returns a category
/// </summary>
/// <param name="id">Id of category to return</param>
/// <returns>A category.</returns>
public override Category SelectCategory(Guid id)
{
var categories = Category.Categories;
var category = new Category();
foreach (var cat in categories.Where(cat => cat.Id == id))
{
category = cat;
}
category.MarkOld();
return category;
}
示例6: Update
public void Update(int CategoryID,string CategoryName,string Description,byte[] Picture)
{
Category item = new Category();
item.MarkOld();
item.IsLoaded = true;
item.CategoryID = CategoryID;
item.CategoryName = CategoryName;
item.Description = Description;
item.Picture = Picture;
item.Save(UserName);
}
示例7: FillCategories
/// <summary>
/// Fills an unsorted list of categories.
/// </summary>
/// <returns>
/// A List<Category> of all Categories.
/// </returns>
public override List<Category> FillCategories()
{
var fileName = this.Folder + "categories.xml";
if (!File.Exists(fileName))
{
return null;
}
var doc = new XmlDocument();
doc.Load(fileName);
var categories = new List<Category>();
foreach (XmlNode node in doc.SelectNodes("categories/category"))
{
var category = new Category { Id = new Guid(node.Attributes["id"].InnerText), Title = node.InnerText };
if (node.Attributes["description"] != null)
{
category.Description = node.Attributes["description"].InnerText;
}
else
{
category.Description = string.Empty;
}
if (node.Attributes["parent"] != null)
{
if (String.IsNullOrEmpty(node.Attributes["parent"].InnerText))
{
category.Parent = null;
}
else
{
category.Parent = new Guid(node.Attributes["parent"].InnerText);
}
}
else
{
category.Parent = null;
}
categories.Add(category);
category.MarkOld();
}
return categories;
}
示例8: FillCategories
/// <summary>
/// Gets all categories in database
/// </summary>
/// <returns>
/// List of categories
/// </returns>
public override List<Category> FillCategories()
{
var categories = new List<Category>();
var connString = ConfigurationManager.ConnectionStrings[this.connStringName].ConnectionString;
var providerName = ConfigurationManager.ConnectionStrings[this.connStringName].ProviderName;
var provider = DbProviderFactories.GetFactory(providerName);
using (var conn = provider.CreateConnection())
{
if (conn != null)
{
conn.ConnectionString = connString;
using (var cmd = conn.CreateCommand())
{
var sqlQuery = string.Format("SELECT CategoryID, CategoryName, description, ParentID FROM {0}Categories ", this.tablePrefix);
cmd.CommandText = sqlQuery;
cmd.CommandType = CommandType.Text;
conn.Open();
using (var rdr = cmd.ExecuteReader())
{
if (rdr.HasRows)
{
while (rdr.Read())
{
var cat = new Category
{
Title = rdr.GetString(1),
Description = rdr.IsDBNull(2) ? string.Empty : rdr.GetString(2),
Parent = rdr.IsDBNull(3) ? (Guid?)null : new Guid(rdr.GetGuid(3).ToString()),
Id = new Guid(rdr.GetGuid(0).ToString())
};
categories.Add(cat);
cat.MarkOld();
}
}
}
}
}
}
return categories;
}
示例9: Update
public void Update(int CategoryId,Guid CategoryGuid,int ParentId,string Name,string ImageFile,string Description,int SortOrder,string CreatedBy,DateTime CreatedOn,string ModifiedBy,DateTime ModifiedOn)
{
Category item = new Category();
item.CategoryId = CategoryId;
item.CategoryGuid = CategoryGuid;
item.ParentId = ParentId;
item.Name = Name;
item.ImageFile = ImageFile;
item.Description = Description;
item.SortOrder = SortOrder;
item.CreatedBy = CreatedBy;
item.CreatedOn = CreatedOn;
item.ModifiedBy = ModifiedBy;
item.ModifiedOn = ModifiedOn;
item.MarkOld();
item.Save(UserName);
}
示例10: Update
public void Update(int CategoryID,string URLRewrite,string CatName,int? Parent,int Lang,int? Arrange)
{
Category item = new Category();
item.MarkOld();
item.IsLoaded = true;
item.CategoryID = CategoryID;
item.URLRewrite = URLRewrite;
item.CatName = CatName;
item.Parent = Parent;
item.Lang = Lang;
item.Arrange = Arrange;
item.Save(UserName);
}