Exemple #1
0
        /// <summary>
        /// 用户查询
        /// 添加人:周 鹏
        /// 添加时间:2014-01-03
        /// </summary>
        /// <history>
        /// 修改描述:时间+作者+描述
        /// </history>
        /// <param name="search">查询实体</param>
        /// <param name="pageIndex">页索引</param>
        /// <param name="pageSize">分页大小</param>
        /// <returns></returns>
        public PageJqDatagrid <CrmUserEntity> GetSearchResult(CrmUserEntity search, int pageSize = 10, int pageIndex = 1)
        {
            var queryCondition = QueryCondition.Instance.AddEqual(CrmUserEntity.Parm_CrmUser_RowStatus, "1");

            if (!string.IsNullOrEmpty(search.Account))
            {
                OrCondition orCondition = OrCondition.Instance.AddLike(CrmUserEntity.Parm_CrmUser_Account,
                                                                       search.Account);
                orCondition.AddLike(CrmUserEntity.Parm_CrmUser_RealName, search.Account);
                queryCondition.AddOr(orCondition);
            }
            if (!string.IsNullOrEmpty(search.DepartmentId))
            {
                queryCondition.AddEqual(CrmUserEntity.Parm_CrmUser_DepartmentId, search.DepartmentId);
            }
            //排序
            queryCondition.AddOrderBy(CrmUserEntity.Parm_CrmUser_SortCode, true);
            queryCondition.SetPager(pageIndex, pageSize);
            int totalRecord, totalPage;
            //计时
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var list = Query(queryCondition, out totalRecord, out totalPage);

            stopwatch.Stop();
            return(new PageJqDatagrid <CrmUserEntity>
            {
                page = pageIndex,
                rows = list,
                total = totalPage,
                records = totalRecord,
                costtime = stopwatch.ElapsedMilliseconds.ToString()
            });
        }