public static void ReportDroprates(List <IItemDropRuleChainAttempt> ChainedRules, float personalDropRate, List <DropRateInfo> drops, DropRateInfoChainFeed ratesInfo)
 {
     foreach (IItemDropRuleChainAttempt ChainedRule in ChainedRules)
     {
         ChainedRule.ReportDroprates(personalDropRate, drops, ratesInfo);
     }
 }
Beispiel #2
0
        /// <summary>
        /// suppose to generate query like this
        /// Where(x => x.propertyA.ToLower().Contains(TargetValue.ToLower()));
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="MemberName"></param>
        /// <param name="TargetValue"></param>
        /// <returns></returns>
        public IQueryable <T> AppendQueryWithContains <T>(string MemberName, string TargetValue, IQueryable <T> queryableData, SortingFilterModel Model)
        {
            //create chainedrules at two-level deep, tolower as level1 and contains as level2
            var root = new ChainedRule(MemberName, Operator.ToLower, null);

            root.ChildRule = new ChainedRule(MemberName, Operator.Contains, TargetValue.ToLower());
            ParameterExpression p     = Expression.Parameter(typeof(T), "x");
            Expression          right = ExpBuilder.EvaluateChainedRule <T>(root, p);
            var whereExp = Expression.Lambda <Func <T, bool> >(right, new ParameterExpression[] { p });

            var whereMethodExpression = ExpBuilder.BuildMethodExpression(queryableData, Where, whereExp, typeArguments: new Type[] { queryableData.ElementType });


            IQueryable <T> results = queryableData.EvalQueryMethodCallExpression(whereMethodExpression);

            //ShouldResetPageIndex value is set at the front end, when freetext search is triggered, always get the content from pageindex1
            if (Model.ShouldResetPageIndex)
            {
                ResetPageIndex(Model);
            }
            return(results);
        }