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


C# DetachedCriteria.Add方法代码示例

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


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

示例1: VisitMethodCall

		protected override Expression VisitMethodCall(MethodCallExpression expr)
		{
			Type = BinaryCriterionType.Criteria;

			//TODO: don't hardcode this alias 'sub'
			Criteria = DetachedCriteria.ForEntityName(rootCriteria.GetEntityOrClassName(), "sub");

			EntityExpression rootEntity = EntityExpressionVisitor.RootEntity(expr);
			if (rootEntity != null)
			{
				string identifierName = rootEntity.MetaData.IdentifierPropertyName;
				Criteria.Add(Restrictions.EqProperty(rootCriteria.Alias + "." + identifierName, "sub." + identifierName));
			}

			if (SelectArgumentsVisitor.SupportsMethod(expr.Method.Name))
			{
				var projectionVisitor = new SelectArgumentsVisitor(Criteria.Adapt(session), session);
				projectionVisitor.Visit(expr);
				Criteria.SetProjection(projectionVisitor.Projection);
			}

			return expr;
		}
开发者ID:560889223,项目名称:56.NHibernate.Linq,代码行数:23,代码来源:BinaryCriterionVisitor.cs

示例2: SetPartySearchCriteria

 public static void SetPartySearchCriteria(DetachedCriteria criteria, string propertyName, string userCode)
 {
     DetachedCriteria[] partyCrieteria = SecurityHelper.GetPartyPermissionCriteria(userCode);
     criteria.Add(
         Expression.Or(
             Subqueries.PropertyIn(propertyName, partyCrieteria[0]),
             Subqueries.PropertyIn(propertyName, partyCrieteria[1])
     ));
 }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:9,代码来源:SecurityHelper.cs

示例3: SetPartyToSearchCriteria

        public static void SetPartyToSearchCriteria(DetachedCriteria selectCriteria, DetachedCriteria selectCountCriteria, string partyToCode, string orderType, string userCode)
        {
            if (partyToCode != null && partyToCode.Trim() != string.Empty)
            {
                //如果用户选择了PartyTo,直接用用户选择的值查询
                selectCriteria.Add(Expression.Eq("pt.Code", partyToCode.Trim()));
                selectCountCriteria.Add(Expression.Eq("pt.Code", partyToCode.Trim()));
            }
            else  //如果用户没有选择PartyFrom,根据用户权限过滤
            {
                if (orderType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT)
                {
                    //供货路线
                    DetachedCriteria[] ptCrieteria = SecurityHelper.GetPartyPermissionCriteria(userCode,
                        BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_REGION, BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_CUSTOMER);

                    selectCriteria.Add(
                        Expression.Or(
                            Subqueries.PropertyIn("pt.Code", ptCrieteria[0]),
                            Subqueries.PropertyIn("pt.Code", ptCrieteria[1])
                    ));

                    selectCountCriteria.Add(
                        Expression.Or(
                            Subqueries.PropertyIn("pt.Code", ptCrieteria[0]),
                            Subqueries.PropertyIn("pt.Code", ptCrieteria[1])
                    ));
                }
                else if (orderType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
                {
                    //发货路线
                    DetachedCriteria[] ptCrieteria = SecurityHelper.GetPartyPermissionCriteria(userCode,
                        BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_REGION, BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_CUSTOMER);

                    selectCriteria.Add(
                        Expression.Or(
                            Subqueries.PropertyIn("pt.Code", ptCrieteria[0]),
                            Subqueries.PropertyIn("pt.Code", ptCrieteria[1])
                    ));

                    selectCountCriteria.Add(
                        Expression.Or(
                            Subqueries.PropertyIn("pt.Code", ptCrieteria[0]),
                            Subqueries.PropertyIn("pt.Code", ptCrieteria[1])
                    ));
                }
                else if (orderType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
                {
                    DetachedCriteria[] regionCrieteria = SecurityHelper.GetRegionPermissionCriteria(userCode);

                    //生产
                    selectCriteria.Add(
                        Expression.Or(
                            Subqueries.PropertyIn("pt.Code", regionCrieteria[0]),
                            Subqueries.PropertyIn("pt.Code", regionCrieteria[1])
                    ));

                    selectCountCriteria.Add(
                        Expression.Or(
                            Subqueries.PropertyIn("pt.Code", regionCrieteria[0]),
                            Subqueries.PropertyIn("pt.Code", regionCrieteria[1])
                    ));
                }
                else if (orderType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_INSPECTION)
                {
                    //检验路线
                    DetachedCriteria[] regionCrieteria = SecurityHelper.GetRegionPermissionCriteria(userCode);
                    selectCriteria.Add(
                        Expression.Or(
                            Subqueries.PropertyIn("pt.Code", regionCrieteria[0]),
                            Subqueries.PropertyIn("pt.Code", regionCrieteria[1])
                    ));

                    selectCountCriteria.Add(
                        Expression.Or(
                            Subqueries.PropertyIn("pt.Code", regionCrieteria[0]),
                            Subqueries.PropertyIn("pt.Code", regionCrieteria[1])
                    ));
                }
                else if (orderType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_TRANSFER)
                {
                    //移库路线
                    DetachedCriteria[] regionCrieteria = SecurityHelper.GetRegionPermissionCriteria(userCode);
                    selectCriteria.Add(
                        Expression.Or(
                            Subqueries.PropertyIn("pt.Code", regionCrieteria[0]),
                            Subqueries.PropertyIn("pt.Code", regionCrieteria[1])
                    ));

                    selectCountCriteria.Add(
                        Expression.Or(
                            Subqueries.PropertyIn("pt.Code", regionCrieteria[0]),
                            Subqueries.PropertyIn("pt.Code", regionCrieteria[1])
                    ));
                }
                //else if (orderType == BusinessConstants.ORDER_MODULETYPE_VALUE_PROCUREMENTCONFIRM)
                //{
                //    //发货确认
                //    DetachedCriteria[] ptCrieteria = SecurityHelper.GetPartyPermissionCriteria(userCode, BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_CUSTOMER);

//.........这里部分代码省略.........
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:101,代码来源:SecurityHelper.cs

示例4: addDisjunction

 private void addDisjunction(String[] values, String columnLabel, ref DetachedCriteria criteria)
 {
     if (values != null && values.Length > 0)
     {
         Disjunction dis = Expression.Disjunction();
         foreach (String value in values)
         {
             dis.Add(Expression.Eq(columnLabel, value));
         }
         criteria.Add(dis);
     }
 }
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:12,代码来源:LocationMgr.cs

示例5: BuildCriteria

 /// <summary>
 /// Builds the criteria.
 /// </summary>
 /// <param name="criteria">The criteria.</param>
 /// <param name="dependencyCriterion">The dependency criterion.</param>
 public override void BuildCriteria(DetachedCriteria criteria, Junction dependencyCriterion)
 {
     if (criteria == null)
     {
         ThrowHelper.ThrowArgumentNullException("criteria");
     }
     if (dependencyCriterion != null)
     {
         dependencyCriterion.Add(mCriterion);
     }
     else
     {
         criteria.Add(this.mCriterion);
     }
 }
开发者ID:JZO001,项目名称:Forge,代码行数:20,代码来源:AllCriteria.cs

示例6: SetOpenOrderStatusCriteria

 /// <summary>
 /// Status: Submit,In-Process
 /// </summary>
 /// <param name="criteria"></param>
 /// <param name="propertyName"></param>
 public static void SetOpenOrderStatusCriteria(DetachedCriteria criteria, string propertyName)
 {
     criteria.Add(Expression.In(propertyName, new string[] {
         BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT,
         BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS}));
 }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:11,代码来源:OrderHelper.cs

示例7: SetActiveOrderStatusCriteria

 /// <summary>
 /// Status: Submit,In-Process,Complete,Close
 /// </summary>
 /// <param name="criteria"></param>
 /// <param name="propertyName"></param>
 public static void SetActiveOrderStatusCriteria(DetachedCriteria criteria, string propertyName)
 {
     criteria.Add(Expression.In(propertyName, new object[] {
         BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT,
         BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS,
         BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE,
         BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE}));
 }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:13,代码来源:OrderHelper.cs

示例8: AddPermissionsToQuery

 ///<summary>Adds the permissions to the criteria query for the given usersgroup
 ///</summary>
 ///<param name="usersgroup">The usersgroup. Only permissions directly related to this usergroup
 /// are taken into account</param>
 ///<param name="operation">The operation</param>
 ///<param name="criteria">The criteria</param>
 public void AddPermissionsToQuery(UsersGroup usersgroup, string operation, DetachedCriteria criteria)
 {            
     ICriterion allowed = GetPermissionQueryInternal(usersgroup, operation, GetSecurityKeyProperty(criteria));
     criteria.Add(allowed);
 }	    
开发者ID:reharik,项目名称:KnowYourTurf.SystemSupport,代码行数:11,代码来源:AuthorizationService.cs


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