本文整理汇总了C#中Field.MarkOld方法的典型用法代码示例。如果您正苦于以下问题:C# Field.MarkOld方法的具体用法?C# Field.MarkOld怎么用?C# Field.MarkOld使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field.MarkOld方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillFields
/// <summary>
/// Gets all categories in database
/// </summary>
/// <returns>List of categories</returns>
public override List<Field> FillFields()
{
List<Field> fields = new List<Field>();
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 FieldID,FieldName,Description " +
"FROM " + tablePrefix + "Fields ";
cmd.CommandText = sqlQuery;
cmd.CommandType = CommandType.Text;
conn.Open();
using (DbDataReader rdr = cmd.ExecuteReader())
{
if (rdr.HasRows)
{
while (rdr.Read())
{
Field fld = new Field();
fld.FieldName = rdr.GetString(1);
if (rdr.IsDBNull(2))
fld.Description = "";
else
fld.Description = rdr.GetString(2);
fld.Id = new Guid(rdr.GetGuid(0).ToString());
fields.Add(fld);
fld.MarkOld();
}
}
}
}
}
return fields;
}
示例2: SelectField
/// <summary>
/// Returns a field
/// </summary>
/// <param name="id">Id of field to return</param>
/// <returns></returns>
public override Field SelectField(Guid id)
{
List<Field> fields = Field.Fields;
Field field = new Field();
foreach (Field cat in fields)
{
if (cat.Id == id)
field = cat;
}
field.MarkOld();
return field;
}