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


C# Criteria.Add方法代码示例

本文整理汇总了C#中Criteria.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Criteria.Add方法的具体用法?C# Criteria.Add怎么用?C# Criteria.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Criteria的用法示例。


在下文中一共展示了Criteria.Add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetChildren

 private List<Channel> GetChildren(string ID)
 {
     Criteria c = new Criteria(CriteriaType.Equals, "ParentID", ID);
     c.Add(CriteriaType.Equals, "State", 1);
     //c.Add(CriteriaType.NotEquals, "ID", Channel.ID);
     return Assistant.List<Channel>(c, new Order[] {new Order("index"), new Order("ID") });
 }
开发者ID:priceLiu,项目名称:CMS,代码行数:7,代码来源:Sidebar.ChannelNav.cs

示例2: InitCriteria

        private void InitCriteria()
        {
            criteria = new Criteria(CriteriaType.None);
            if (string.IsNullOrEmpty(KeyWord))
            {
                if (IncludeChildren && Channel != null)
                {
                    criteria.Add(CriteriaType.Like, "ChannelFullUrl", Channel.FullUrl + "%");
                }
                else
                {
                    criteria.Add(CriteriaType.Equals, "OwnerID", Channel.ID);
                }
            }
            string tag = We7Helper.RemoveHtml(System.Web.HttpUtility.UrlDecode(Request["tag"]));
            if (!String.IsNullOrEmpty(tag))
            {
                criteria.Add(CriteriaType.Like, "Tags", "%" + HttpUtility.UrlDecode(tag) + "%");
            }

            string title = We7Helper.RemoveHtml(System.Web.HttpUtility.UrlDecode(Request["title"]));
            if (!String.IsNullOrEmpty(title))
            {
                criteria.Add(CriteriaType.Like, "Title", "%" + title + "%");
            }

            string channel = We7Helper.RemoveHtml(System.Web.HttpUtility.UrlDecode(Request["channel"]));
            if (!String.IsNullOrEmpty(channel))
            {
                Channel ch = HelperFactory.Instance.GetHelper<ChannelHelper>().GetChannel(channel, null);
                if (ch != null)
                {
                    criteria.Add(CriteriaType.Like, "ChannelFullUrl", ch.FullUrl + "%");
                }
            }

            string author = We7Helper.RemoveHtml(System.Web.HttpUtility.UrlDecode(Request["author"]));
            if (!String.IsNullOrEmpty(author))
            {
                criteria.Add(CriteriaType.Equals, "Author", author);
            }

            if (!string.IsNullOrEmpty(KeyWord))
            {
                Criteria keyCriteria = new Criteria(CriteriaType.None);
                keyCriteria.Mode = CriteriaMode.Or;
                keyCriteria.AddOr(CriteriaType.Like, "Title", "%" + KeyWord + "%");
                keyCriteria.AddOr(CriteriaType.Like, "Description", "%" + KeyWord + "%");
                criteria.Criterias.Add(keyCriteria);
            }

            criteria.Add(CriteriaType.Equals, "State", 1);
        }
开发者ID:priceLiu,项目名称:CMS,代码行数:53,代码来源:PagedArticleList.Default.cs

示例3: GetThisArticle

        /// <summary>
        /// 获得当前栏目下的第一篇文章
        /// </summary>
        /// <returns></returns>
        protected Article GetThisArticle()
        {
            string id = ChannelHelper.GetChannelIDFromURL();
            Channel ch = ChannelHelper.GetChannel(id, null);

            Criteria c = new Criteria(CriteriaType.Equals, "ChannelFullUrl", ch.FullUrl);
            c.Add(CriteriaType.Equals, "State", 1);
            Order[] os = new Order[] { new Order("Updated", OrderMode.Desc) };
            List<Article> aList = Assistant.List<Article>(c, os, 0, 1, new string[]
                                                                           {
                                                                               "ID", "Title", "ChannelFullUrl",
                                                                               "Created","Clicks",
                                                                               "SN","Content","OwnerID","Updated","State"
                                                                           });
            if (aList != null && aList.Count > 0)
            {
                return aList[0];
            }
            else
            {
                return new Article();
            }
        }
开发者ID:priceLiu,项目名称:CMS,代码行数:27,代码来源:ArticleView.Default.cs

示例4: GetRealData

        /// <summary>
        /// 获取真实数据
        /// </summary>
        private List<Article> GetRealData()
        {
            Criteria c = new Criteria(CriteriaType.None);
            if (IncludeChildren)
            {
                c.Add(CriteriaType.Like, "ChannelFullUrl", Channel.FullUrl + "%");
            }
            else
            {
                c.Add(CriteriaType.Equals, "OwnerID", OwnerID);
            }
            c.Add(CriteriaType.Equals, "State", 1);
            if (!String.IsNullOrEmpty(Tags))
            {
                c.Add(CriteriaType.Like, "Tags", "%'" + Tags + "'%");
            }

            Order[] os = new Order[] { new Order("IsShow", OrderMode.Desc), new Order("Updated", OrderMode.Desc) };
            articles = Assistant.List<Article>(c, os, 0, PageSize, new string[]
                                                                       {
                                                                           "ID", "Title", "ChannelFullUrl",
                                                                           "Created",
                                                                           "SN"
                                                                       });
            return articles;
        }
开发者ID:priceLiu,项目名称:CMS,代码行数:29,代码来源:ArticleList.SideList.cs

示例5: IsOnSchedule

		protected bool IsOnSchedule ()
		{
			IEnumerable<ScheduledSessionEntity> sessions = null;
			
			if (UnitOfWork.IsUnitOfWorkStarted ()) {
				var repo = new LocalScheduledSessionsRepository ();
				var criteria = new Criteria ();
				criteria.Add (Condition.Equal<ScheduledSessionEntity> (x => x.Title, _session.Title));
				sessions = repo.Find (criteria);			
			} else {
				using (UnitOfWork.Start()) {
					var repo = new LocalScheduledSessionsRepository ();
					var criteria = new Criteria ();
					criteria.Add (Condition.Equal<ScheduledSessionEntity> (x => x.Title, _session.Title));
					sessions = repo.Find (criteria);
				}
			}
			
			if (sessions != null && sessions.Count () > 0) {
				return true;
			} else {
				return false;
			}
				
		}
开发者ID:RobGibbens,项目名称:ArtekSoftware.Codemash,代码行数:25,代码来源:SessionDetailViewController.cs

示例6: QueryArticlesByChannel

 /// <summary>
 /// 根据栏目获取文章
 /// </summary>
 /// <param name="ch">栏目</param>
 /// <param name="includechildren">包含子栏目</param>
 /// <param name="from"></param>
 /// <param name="PageSize">页大小</param>
 List<Article> QueryArticlesByChannel(Channel ch, int from, int PageSize)
 {
     Criteria c = new Criteria(CriteriaType.None);
     if (HasChildrenChannel)
     {
         c.Add(CriteriaType.Like, "ChannelFullUrl", ch.FullUrl + "%");
         c.Add(CriteriaType.Equals, "State", 1);
     }
     else
     {
         c.Add(CriteriaType.Equals, "OwnerID", ch.ID);
         c.Add(CriteriaType.Equals, "State", 1);
     }
     if (!String.IsNullOrEmpty(Tags))
     {
         c.Add(CriteriaType.Like, "Tags", "%'" + Tags + "'%");
     }
     Order[] os = IsShow
                      ? new Order[] { new Order("IsShow", OrderMode.Desc), new Order("Updated", OrderMode.Desc) }
                      : new Order[] { new Order("Updated", OrderMode.Desc) };
     return Assistant.List<Article>(c, os, from, PageSize,
                                    new string[] { "ID", "Title", "Updated", "ChannelFullUrl", "Created", "SN" });
 }
开发者ID:priceLiu,项目名称:CMS,代码行数:30,代码来源:LatestNews.LatestTopPicture.cs

示例7: GetChildren

 private List<Channel> GetChildren()
 {
     Criteria c = new Criteria(CriteriaType.Like, "FullUrl", Channel.FullUrl + "%");
     c.Add(CriteriaType.Equals, "State", 1);
     c.Add(CriteriaType.NotEquals, "ID", Channel.ID);
     return Assistant.List<Channel>(c, new Order[] { new Order("ID") });
 }
开发者ID:priceLiu,项目名称:CMS,代码行数:7,代码来源:Search.SearchUI.cs

示例8: QueryArticlesByChannels

        /// <summary>
        /// 根据栏目获取文章
        /// </summary>
        protected List<Article> QueryArticlesByChannels()
        {
            #region 将非空的栏目ID添加到 ListOwnerID
            List<string> ListOwnerID = new List<string>(); ;
            if (!string.IsNullOrEmpty(OwnerID1))
                ListOwnerID.Add(OwnerID1);
            if (!string.IsNullOrEmpty(OwnerID2))
                ListOwnerID.Add(OwnerID2);
            if (!string.IsNullOrEmpty(OwnerID3))
                ListOwnerID.Add(OwnerID3);
            if (!string.IsNullOrEmpty(OwnerID4))
                ListOwnerID.Add(OwnerID4);
            if (!string.IsNullOrEmpty(OwnerID5))
                ListOwnerID.Add(OwnerID5);
            if (!string.IsNullOrEmpty(OwnerID6))
                ListOwnerID.Add(OwnerID6);
            if (!string.IsNullOrEmpty(OwnerID7))
                ListOwnerID.Add(OwnerID7);
            if (!string.IsNullOrEmpty(OwnerID8))
                ListOwnerID.Add(OwnerID8);
            if (!string.IsNullOrEmpty(OwnerID9))
                ListOwnerID.Add(OwnerID9);
            if (!string.IsNullOrEmpty(OwnerID10))
                ListOwnerID.Add(OwnerID10);
            #endregion

            Criteria c = new Criteria(CriteriaType.None);
            //c.Add(CriteriaType.Like, "ChannelFullUrl", ch.FullUrl + "%");
            c.Add(CriteriaType.Equals, "State", 1);
            if (!String.IsNullOrEmpty(Tags))
            {
                c.Add(CriteriaType.Like, "Tags", "%'" + Tags + "'%");
            }
            if (ListOwnerID.Count > 0)
            {
                Criteria cOr = new Criteria(CriteriaType.None);
                cOr.Mode = CriteriaMode.Or;
                foreach (string  chID in ListOwnerID)
                {
                    cOr.AddOr(CriteriaType.Equals, "OwnerID", chID);
                }
                c.Criterias.Add(cOr);
            }

            Order[] os = IsShow ? new Order[] { new Order("IsShow", OrderMode.Desc), new Order("Updated", OrderMode.Desc), new Order("ID", OrderMode.Desc) } : new Order[] { new Order("Updated", OrderMode.Desc), new Order("ID", OrderMode.Desc) };
            return Assistant.List<Article>(c, os, 0, PageSize,
                                           new string[] {"ID", "Title", "ChannelFullUrl", "Created", "SN"});
        }
开发者ID:priceLiu,项目名称:CMS,代码行数:51,代码来源:NewsTab.Speeches.cs


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