本文整理汇总了C#中Query.AddWhere方法的典型用法代码示例。如果您正苦于以下问题:C# Query.AddWhere方法的具体用法?C# Query.AddWhere怎么用?C# Query.AddWhere使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query.AddWhere方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMostPopularDomains
/// <summary>
/// Gets the most popular domains.
/// Measured by number of kicks per domain
/// </summary>
/// <param name="hostID">The host ID.</param>
/// <param name="storyCount">The story count.</param>
/// <param name="year">The year.</param>
/// <param name="month">The month.</param>
/// <param name="day">The day.</param>
/// <returns></returns>
public static Dictionary<string, int> GetMostPopularDomains(int hostID, int storyCount, int year, int? month, int? day)
{
string cacheKey = String.Format("Zeitgeist_MostPopularDomains_{0}_{1}_{2}_{3}_{4}", hostID, storyCount, year, month, day);
CacheManager<string, Dictionary<string, int>> domainCache = GetMostPopularDomainsCache();
Dictionary<string, int> domainList = domainCache[cacheKey];
if (domainList == null)
{
//get all stories, then loop and make our own domain list
Query qry = new Query(Story.Schema);
qry.OrderBy = OrderBy.Desc(Story.Columns.KickCount);
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));
qry.AddWhere(Story.Columns.KickCount, Comparison.GreaterOrEquals, 1);
StoryCollection stories = new StoryCollection();
stories.LoadAndCloseReader(Story.FetchByQuery(qry));
domainList = new Dictionary<string, int>();
Regex rx = new Regex(@"^(?=[^&])(?:(?<scheme>[^:/?#]+):)?(?://(?<authority>[^/?#]*))?(?<path>[^?#]*)(?:\?(?<query>[^#]*))?(?:#(?<fragment>.*))?");
foreach (Story s in stories)
{
Match uriMatch = rx.Match(s.Url);
if (!uriMatch.Success)
continue;
string authority = uriMatch.Groups["authority"].Value;
if (string.IsNullOrEmpty(authority))
continue;
if (domainList.ContainsKey(authority))
domainList[authority] += s.KickCount;
else
domainList.Add(authority, s.KickCount);
}
//sort and trim to storyCount
List<KeyValuePair<string, int>> sortedPairs = new List<KeyValuePair<string, int>>(domainList);
sortedPairs.Sort(
delegate(KeyValuePair<string, int> obj1, KeyValuePair<string, int> obj2)
{ return obj2.Value.CompareTo(obj1.Value); }
);
domainList.Clear();//clear and add top X values
if (sortedPairs.Count < storyCount)
storyCount = sortedPairs.Count;
for (int i = 0; i < storyCount; i++)
domainList.Add(sortedPairs[i].Key, sortedPairs[i].Value);
domainCache.Insert(cacheKey, domainList, CacheHelper.CACHE_DURATION_IN_SECONDS);
}
return domainList;
}
示例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: SetUp
public void SetUp()
{
Query qry = new Query(Product.Schema);
qry.QueryType = QueryType.Delete;
qry.AddWhere(Product.Columns.ProductName, Comparison.Like, "Unit Test%");
qry.Execute();
}
示例4: Delete
public bool Delete(string CustomerID,string CustomerTypeID)
{
Query qry = new Query(CustomerCustomerDemo.Schema);
qry.QueryType = QueryType.Delete;
qry.AddWhere("CustomerID", CustomerID).AND("CustomerTypeID", CustomerTypeID);
qry.Execute();
return (true);
}
示例5: Delete
public bool Delete(int ProductId,int DownloadId)
{
Query qry = new Query(ProductDownloadMap.Schema);
qry.QueryType = QueryType.Delete;
qry.AddWhere("ProductId", ProductId).AND("DownloadId", DownloadId);
qry.Execute();
return (true);
}
示例6: Delete
public bool Delete(int IdCapphat,int IdDonthuoc,int IdChitietdonthuoc)
{
Query qry = new Query(TPhieuCapphatChitiet.Schema);
qry.QueryType = QueryType.Delete;
qry.AddWhere("IdCapphat", IdCapphat).AND("IdDonthuoc", IdDonthuoc).AND("IdChitietdonthuoc", IdChitietdonthuoc);
qry.Execute();
return (true);
}
示例7: Delete
public bool Delete(int IdThuoc,short IdKho,string KieuThuocVt)
{
Query qry = new Query(TDutruThuoc.Schema);
qry.QueryType = QueryType.Delete;
qry.AddWhere("IdThuoc", IdThuoc).AND("IdKho", IdKho).AND("KieuThuocVt", KieuThuocVt);
qry.Execute();
return (true);
}
示例8: Delete
public bool Delete(int CategoryID,int ProductID)
{
Query qry = new Query(ProductCategoryMap.Schema);
qry.QueryType = QueryType.Delete;
qry.AddWhere("CategoryID", CategoryID).AND("ProductID", ProductID);
qry.Execute();
return (true);
}
示例9: Delete
public bool Delete(string Ma,string Loai)
{
Query qry = new Query(DmucChung.Schema);
qry.QueryType = QueryType.Delete;
qry.AddWhere("Ma", Ma).AND("Loai", Loai);
qry.Execute();
return (true);
}
示例10: Delete
public bool Delete(string SUID,long IRoleID,long IParentRoleID,string FpSBranchID)
{
Query qry = new Query(SysRolesForUser.Schema);
qry.QueryType = QueryType.Delete;
qry.AddWhere("SUID", SUID).AND("IRoleID", IRoleID).AND("IParentRoleID", IParentRoleID).AND("FpSBranchID", FpSBranchID);
qry.Execute();
return (true);
}
示例11: Delete
public bool Delete(int OrderID,int ProductID)
{
Query qry = new Query(OrderDetail.Schema);
qry.QueryType = QueryType.Delete;
qry.AddWhere("OrderID", OrderID).AND("ProductID", ProductID);
qry.Execute();
return (true);
}
示例12: Query_Select
public void Query_Select()
{
Query qry = new Query(Product.Schema);
qry.AddWhere("productID", 1);
int pk = Convert.ToInt32(qry.ExecuteScalar()); // sqlite: Specified cast is not valid.
Assert.IsTrue(pk == 1, "Bad Select");
}
示例13: Delete
public bool Delete(int EmployeeID,string TerritoryID)
{
Query qry = new Query(EmployeeTerritory.Schema);
qry.QueryType = QueryType.Delete;
qry.AddWhere("EmployeeID", EmployeeID).AND("TerritoryID", TerritoryID);
qry.Execute();
return (true);
}
示例14: Delete
public bool Delete(int IdThuoc,int IdThuoctuongduong)
{
Query qry = new Query(QheThuoctuongduong.Schema);
qry.QueryType = QueryType.Delete;
qry.AddWhere("IdThuoc", IdThuoc).AND("IdThuoctuongduong", IdThuoctuongduong);
qry.Execute();
return (true);
}
示例15: Delete
public bool Delete(short IdNhanvien,string Ma,string Loai)
{
Query qry = new Query(QheNhanvienQuyensudung.Schema);
qry.QueryType = QueryType.Delete;
qry.AddWhere("IdNhanvien", IdNhanvien).AND("Ma", Ma).AND("Loai", Loai);
qry.Execute();
return (true);
}