Example #1
0
        /// <summary>
        /// 查询的数据
        /// </summary>
        /// <param name="id">额外的参数</param>
        /// <param name="page">页码</param>
        /// <param name="rows">每页显示的行数</param>
        /// <param name="order">排序字段</param>
        /// <param name="sort">升序asc(默认)还是降序desc</param>
        /// <param name="search">查询条件</param>
        /// <param name="total">结果集的总数</param>
        /// <returns>结果集</returns>
        public List <SysRole> GetByParam(string id, int page, int rows, string order, string sort, string search, ref int total)
        {
            IQueryable <SysRole> queryData = repository.DaoChuData(db, order, sort, search);

            total = queryData.Count();
            if (total > 0)
            {
                if (page <= 1)
                {
                    queryData = queryData.Take(rows);
                }
                else
                {
                    queryData = queryData.Skip((page - 1) * rows).Take(rows);
                }

                foreach (var item in queryData)
                {
                    if (item.SysPerson != null)
                    {
                        item.SysPersonId = string.Empty;
                        foreach (var it in item.SysPerson)
                        {
                            item.SysPersonId += it.Name + ' ';
                        }
                    }
                }
            }
            return(queryData.ToList());
        }
Example #2
0
 /// <summary>
 /// 导出Flexigrid中查询的数据
 /// </summary>
 /// <param name="param">客户端传进的数据</param>
 /// <param name="id">额外的参数</param>
 /// <returns></returns>
 public SysRole[] DaoChu(string id, FlexigridParam param)
 {
     return(repository.DaoChuData(db, param).ToArray());
 }