Esempio n. 1
0
        /// <summary>
        /// 度量日志
        /// </summary>
        /// <param name="methodName"></param>
        /// <param name="CostTime"></param>
        /// <param name="bgDt"></param>
        /// <param name="endDt"></param>
        /// <param name="pageModel"></param>
        /// <returns></returns>
        public ListResult <WXQ.Enties.Metrics> GetMetricsList(string methodName, int CostTime, DateTime bgDt, DateTime endDt, PageModel pageModel)
        {
            MetricsManager metricsManager          = new MetricsManager();
            ListResult <WXQ.Enties.Metrics> result = new ListResult <Enties.Metrics>();

            System.Linq.Expressions.Expression <Func <Enties.Metrics, bool> > express = Expressionable.Create <WXQ.Enties.Metrics>()
                                                                                        .AndIF(!string.IsNullOrEmpty(methodName), m => SqlFunc.Contains(m.MethodName, methodName))
                                                                                        .AndIF(bgDt < DateTime.Now, m => m.AddDateTime >= bgDt)
                                                                                        .AndIF(endDt >= bgDt, m => m.AddDateTime <= endDt)
                                                                                        .AndIF(CostTime > 0, m => m.CostTime > CostTime)
                                                                                        .ToExpression();//拼接表达式
            result.Result = metricsManager.GetPageList(express, pageModel);


            result.PageSize  = pageModel.PageSize;
            result.PageIndex = pageModel.PageIndex;
            result.Total     = pageModel.PageCount;
            return(result);
        }