本文整理汇总了C#中Query.GetRecordCount方法的典型用法代码示例。如果您正苦于以下问题:C# Query.GetRecordCount方法的具体用法?C# Query.GetRecordCount怎么用?C# Query.GetRecordCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query.GetRecordCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataProvider_GetRecordCount
public void DataProvider_GetRecordCount()
{
Query q = new Query(Product.Schema)
.WHERE(Product.Columns.ProductID, 1)
.WHERE(Product.Columns.ProductName, "Chai");
int count = q.GetRecordCount();
Assert.IsTrue(count == 1, "Count is " + count);
}
示例2: CheckUserAlreadyVoted
public static bool CheckUserAlreadyVoted(Guid pollId, Guid userId)
{
Query qry = new Query(ACSGhana.Web.Framework.Data.Tables.PollVotes);
qry.AddWhere(PollVotes.Columns.PollId, pollId);
qry.AddWhere(PollVotes.Columns.UserId, userId);
if (qry.GetRecordCount() > 0)
{
return true;
}
else
{
return false;
}
}
示例3: CountTotalVotes
public static int CountTotalVotes(Guid pollId)
{
Query qry = new Query(ACSGhana.Web.Framework.Data.Tables.PollVotes);
qry.AddWhere(PollVotes.Columns.PollId, pollId);
return qry.GetRecordCount();
}
示例4: NumberOfVotesByAnswer
public static int NumberOfVotesByAnswer(System.Guid answerid)
{
Query qry = new Query(ACSGhana.Web.Framework.Data.Tables.PollVotes);
qry.AddWhere(PollVotes.Columns.PollAnswerId, answerid);
return qry.GetRecordCount();
}
示例5: GetNumberOfUserRegistrations
/// <summary>
/// Gets the number of user registrations.
/// </summary>
/// <param name="hostID">The host ID.</param>
/// <param name="year">The year.</param>
/// <param name="month">The month.</param>
/// <param name="day">The day.</param>
/// <returns></returns>
public static int GetNumberOfUserRegistrations(int hostID, int year, int? month, int? day)
{
string cacheKey = String.Format("Zeitgeist_UserRegistrationCount_{0}_{1}_{2}_{3}", hostID, year, month, day);
CacheManager<string, int?> countCache = GetUserRegistrationCountCache();
int? count = countCache[cacheKey];
if (count == null)
{
Query qry = new Query(User.Schema);
qry.AddWhere(User.Columns.IsBanned, false);
qry.AddWhere(User.Columns.IsValidated, true);
qry.AddWhere(User.Columns.HostID, hostID);
qry.AddWhere(User.Columns.CreatedOn, Comparison.GreaterOrEquals, StartingDate(year, month, day));
qry.AddWhere(User.Columns.CreatedOn, Comparison.LessOrEquals, EndingDate(year, month, day));
count = qry.GetRecordCount();
countCache.Insert(cacheKey, count.Value, CacheHelper.CACHE_DURATION_IN_SECONDS);
}
return count.Value;
}
示例6: GetNumberOfStoriesSubmitted
/// <summary>
/// Gets the number of stories submitted.
/// </summary>
/// <param name="hostID">The host id.</param>
/// <returns></returns>
/// <param name="year"></param>
/// <param name="month"></param>
/// <param name="day"></param>
public static int GetNumberOfStoriesSubmitted(int hostID, int year, int? month, int? day)
{
string cacheKey = String.Format("Zeitgeist_SubmittedCount_{0}_{1}_{2}_{3}", hostID, year, month, day);
CacheManager<string, int?> countCache = GetStoryCountCache();
int? count = countCache[cacheKey];
if (count == null)
{
Query qry = new Query(Story.Schema);
qry.AddWhere(Story.Columns.IsSpam, false);
qry.AddWhere(Story.Columns.HostID, hostID);
qry.AddWhere(Story.Columns.CreatedOn, Comparison.GreaterOrEquals, StartingDate(year, month, day));
qry.AddWhere(Story.Columns.CreatedOn, Comparison.LessOrEquals, EndingDate(year, month, day));
count = qry.GetRecordCount();// GetCount(Story.Columns.StoryID);
countCache.Insert(cacheKey, count.Value, CacheHelper.CACHE_DURATION_IN_SECONDS);
}
return count.Value;
}