Ejemplo n.º 1
0
        /// <summary>
        /// 获取历史明细列表
        /// </summary>
        /// <param name="pager"></param>
        /// <returns></returns>
        public List <ManagerDetailInfo> GetManagerDetailList(ref GridPager pager)
        {
            var queryData = ManagerDetailRepository.GetManagerDetailList();

            // 排序
            //if (pager.Order == "desc")
            //{
            //    switch (pager.Order)
            //    {
            //        case "ModifiedTime":
            //            queryData = queryData.OrderByDescending(c => c.ModifiedTime);
            //            break;
            //        case "ManagerId":
            //            queryData = queryData.OrderByDescending(c => c.ManagerId);
            //            break;
            //        default:
            //            queryData = queryData.OrderByDescending(c => c.ManagerDetailId);
            //            break;
            //    }
            //}
            //else
            //{
            //    switch (pager.Order)
            //    {
            //        case "ModifiedTime":
            //            queryData = queryData.OrderBy(c => c.ModifiedTime);
            //            break;
            //        case "ManagerId":
            //            queryData = queryData.OrderBy(c => c.ManagerId);
            //            break;
            //        default:
            //            queryData = queryData.OrderBy(c => c.ManagerDetailId);
            //            break;
            //    }
            //}

            queryData = LinqHelper.DataSorting(queryData, pager.Sort, pager.Order);

            return(CreateModelList(ref pager, ref queryData));
        }
Ejemplo n.º 2
0
        public List <ManagerDetailInfo> GetManagerDetailListByQuery(string queryStr, ref GridPager pager)
        {
            var queryData = ManagerDetailRepository.GetManagerDetailList();

            // *负责人* / 当前渠道级别 / 历史渠道级别 / 渠道等级状态
            string[] queryArr          = queryStr.Split(new char[] { '/' });
            string   queryByName       = queryArr[0];
            string   queryByCurRank    = queryArr[1];
            int      curRank           = Convert.ToInt32(Enum.Parse(typeof(ChannelRank), queryByCurRank));
            string   queryByOldRank    = queryArr[2];
            int      oldRank           = Convert.ToInt32(Enum.Parse(typeof(ChannelRank), queryByOldRank));
            string   queryByRankStatus = queryArr[3];
            int      rankStatus        = Convert.ToInt32(Enum.Parse(typeof(ChannelRankChangeStatus), queryByRankStatus));

            if (!string.IsNullOrEmpty(queryByName) && !queryByName.Equals("输入*负责人*关键字"))
            {
                queryData = queryData.Where(d => d.Manager.ManagerName.Contains(queryByName));
            }
            if (!string.IsNullOrEmpty(queryByCurRank) && !queryByCurRank.Equals("-1"))
            {
                queryData = queryData.Where(d => d.CurrentRank == curRank);
            }
            if (!string.IsNullOrEmpty(queryByOldRank) && !queryByOldRank.Equals("-1"))
            {
                queryData = queryData.Where(d => d.OldRank == oldRank);
            }
            if (!string.IsNullOrEmpty(queryByRankStatus) && !queryByRankStatus.Equals("-1"))
            {
                queryData = queryData.Where(d => d.RankStatus == rankStatus);
            }

            // 排序
            //if (pager.Order == "desc")
            //{
            //    switch (pager.Order)
            //    {
            //        case "ModifiedTime":
            //            queryData = queryData.OrderByDescending(c => c.ModifiedTime);
            //            break;
            //        case "ManagerId":
            //            queryData = queryData.OrderByDescending(c => c.ManagerId);
            //            break;
            //        default:
            //            queryData = queryData.OrderByDescending(c => c.ManagerDetailId);
            //            break;
            //    }
            //}
            //else
            //{
            //    switch (pager.Order)
            //    {
            //        case "ModifiedTime":
            //            queryData = queryData.OrderBy(c => c.ModifiedTime);
            //            break;
            //        case "ManagerId":
            //            queryData = queryData.OrderBy(c => c.ManagerId);
            //            break;
            //        default:
            //            queryData = queryData.OrderBy(c => c.ManagerDetailId);
            //            break;
            //    }
            //}

            queryData = LinqHelper.DataSorting(queryData, pager.Sort, pager.Order);

            return(CreateModelList(ref pager, ref queryData));
        }