当前位置: 首页>>代码示例>>C#>>正文


C# Query.AddWhere方法代码示例

本文整理汇总了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;
        }
开发者ID:Letractively,项目名称:dotnetkicks,代码行数:66,代码来源:ZeitgeistCache.cs

示例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;
     }
 }
开发者ID:okyereadugyamfi,项目名称:softlogik,代码行数:14,代码来源:Poll.cs

示例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();
 }
开发者ID:khurram063,项目名称:SubSonic-2.0,代码行数:7,代码来源:ActiveListTests.cs

示例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);
 }
开发者ID:RyanDansie,项目名称:SubSonic-2.0,代码行数:8,代码来源:CustomerCustomerDemoController.cs

示例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);
 }
开发者ID:89sos98,项目名称:dashcommerce-3,代码行数:8,代码来源:ProductDownloadMapController.cs

示例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);
 }
开发者ID:khaha2210,项目名称:VXIS,代码行数:8,代码来源:TPhieuCapphatChitietController.cs

示例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);
 }
开发者ID:khaha2210,项目名称:VXIS,代码行数:8,代码来源:TDutruThuocController.cs

示例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);
 }
开发者ID:RyanDansie,项目名称:SubSonic-2.0,代码行数:8,代码来源:ProductCategoryMapController.cs

示例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);
 }
开发者ID:khaha2210,项目名称:CodeNewHis,代码行数:8,代码来源:DmucChungController.cs

示例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);
 }
开发者ID:khaha2210,项目名称:VXIS,代码行数:8,代码来源:SysRolesForUserController.cs

示例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);
 }
开发者ID:RyanDansie,项目名称:SubSonic-2.0,代码行数:8,代码来源:OrderDetailController.cs

示例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");
        }
开发者ID:howgoo,项目名称:SubSonic-2.0,代码行数:8,代码来源:QueryTest.cs

示例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);
 }
开发者ID:RyanDansie,项目名称:SubSonic-2.0,代码行数:8,代码来源:EmployeeTerritoryController.cs

示例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);
 }
开发者ID:khaha2210,项目名称:VXIS,代码行数:8,代码来源:QheThuoctuongduongController.cs

示例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);
 }
开发者ID:vmshis2015,项目名称:VMSPharmacy,代码行数:8,代码来源:QheNhanvienQuyensudungController.cs


注:本文中的Query.AddWhere方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。