本文整理汇总了C#中Referrer.MarkOld方法的典型用法代码示例。如果您正苦于以下问题:C# Referrer.MarkOld方法的具体用法?C# Referrer.MarkOld怎么用?C# Referrer.MarkOld使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Referrer
的用法示例。
在下文中一共展示了Referrer.MarkOld方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertReferrer
/// <summary>
/// Inserts a Referrer.
/// </summary>
/// <param name="referrer">
/// Must be a valid Referrer object.
/// </param>
public override void InsertReferrer(Referrer referrer)
{
Referrer.Referrers.Add(referrer);
referrer.MarkOld();
var day = Referrer.Referrers.FindAll(r => r.Day.ToShortDateString() == referrer.Day.ToShortDateString());
this.WriteReferrerFile(day, referrer.Day);
}
示例2: FillReferrers
/// <summary>
/// Gets all Referrers from the database.
/// </summary>
/// <returns>List of Referrers.</returns>
public override List<Referrer> FillReferrers()
{
deleteOldReferrers();
List<Referrer> referrers = new List<Referrer>();
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;
conn.Open();
using (DbCommand cmd = conn.CreateCommand())
{
string sqlQuery = "SELECT ReferrerId, ReferralDay, ReferrerUrl, ReferralCount, Url, IsSpam " +
"FROM " + tablePrefix + "Referrers ";
cmd.CommandText = sqlQuery;
cmd.CommandType = CommandType.Text;
using (DbDataReader rdr = cmd.ExecuteReader())
{
if (rdr.HasRows)
{
while (rdr.Read())
{
Referrer refer = new Referrer()
{
Id = rdr.GetGuid(0),
Day = rdr.GetDateTime(1),
ReferrerUrl = new Uri(rdr.GetString(2)),
Count = rdr.GetInt32(3),
Url = rdr.IsDBNull(4) ? null : new Uri(rdr.GetString(4)),
PossibleSpam = rdr.IsDBNull(5) ? false : rdr.GetBoolean(5)
};
referrers.Add(refer);
refer.MarkOld();
}
}
}
}
}
return referrers;
}
示例3: FillReferrers
/// <summary>
/// Gets all Referrers from the database.
/// </summary>
/// <returns>
/// List of Referrers.
/// </returns>
public override List<Referrer> FillReferrers()
{
this.DeleteOldReferrers();
var referrers = new List<Referrer>();
using (var conn = this.CreateConnection())
{
if (conn.HasConnection)
{
using (var cmd = conn.CreateTextCommand(string.Format("SELECT ReferrerId, ReferralDay, ReferrerUrl, ReferralCount, Url, IsSpam FROM {0}Referrers WHERE BlogId = {1}blogid ", this.tablePrefix, this.parmPrefix)))
{
cmd.Parameters.Add(conn.CreateParameter(FormatParamName("blogid"), Blog.CurrentInstance.Id.ToString()));
using (var rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
var refer = new Referrer
{
Id = rdr.GetGuid(0),
Day = rdr.GetDateTime(1),
ReferrerUrl = new Uri(rdr.GetString(2)),
Count = rdr.GetInt32(3),
Url = rdr.IsDBNull(4) ? null : new Uri(rdr.GetString(4)),
PossibleSpam = rdr.IsDBNull(5) ? false : rdr.GetBoolean(5)
};
referrers.Add(refer);
refer.MarkOld();
}
}
}
}
}
return referrers;
}
示例4: FillReferrers
/// <summary>
/// Gets all Referrers from the database.
/// </summary>
/// <returns>
/// List of Referrers.
/// </returns>
public override List<Referrer> FillReferrers()
{
this.DeleteOldReferrers();
var referrers = new List<Referrer>();
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;
conn.Open();
using (var cmd = conn.CreateCommand())
{
var sqlQuery = string.Format("SELECT ReferrerId, ReferralDay, ReferrerUrl, ReferralCount, Url, IsSpam FROM {0}Referrers ", this.tablePrefix);
cmd.CommandText = sqlQuery;
cmd.CommandType = CommandType.Text;
using (var rdr = cmd.ExecuteReader())
{
if (rdr.HasRows)
{
while (rdr.Read())
{
var refer = new Referrer
{
Id = rdr.GetGuid(0),
Day = rdr.GetDateTime(1),
ReferrerUrl = new Uri(rdr.GetString(2)),
Count = rdr.GetInt32(3),
Url = rdr.IsDBNull(4) ? null : new Uri(rdr.GetString(4)),
PossibleSpam = rdr.IsDBNull(5) ? false : rdr.GetBoolean(5)
};
referrers.Add(refer);
refer.MarkOld();
}
}
}
}
}
}
return referrers;
}