Пример #1
0
        public List <StationSearchMiddlecs> Station_Search(StationSearchViewModel stationSearchViewModel)
        {
            List <Bus_Station> line_Infos = _IBusStationRepository.SearchInfoByWhere(stationSearchViewModel);

            List <StationSearchMiddlecs> lineSearches = new List <StationSearchMiddlecs>();

            foreach (var item in line_Infos)
            {
                var stationSearchMiddlecs = _IMapper.Map <Bus_Station, StationSearchMiddlecs>(item);

                if (stationSearchMiddlecs.OnWorkDate != null)
                {
                    //把上班时间格式转为时和分
                    stationSearchMiddlecs.OnDate = stationSearchMiddlecs.OnWorkDate.Value.ToString("HH:mm");
                }

                if (stationSearchMiddlecs.OffWorkDate != null)
                {
                    //把下班时间格式转为时和分
                    stationSearchMiddlecs.OffDate = stationSearchMiddlecs.OffWorkDate.Value.ToString("HH:mm");
                }

                lineSearches.Add(stationSearchMiddlecs);
            }
            return(lineSearches);
        }
Пример #2
0
        //根据条件查询站点
        private Expression <Func <Bus_Station, bool> > SearchStationWhere(StationSearchViewModel stationSearchViewModel)
        {
            var predicate = WhereExtension.True <Bus_Station>();//初始化where表达式

            predicate = predicate.And(p => p.Code.Contains(stationSearchViewModel.Code));
            predicate = predicate.And(p => p.StationName.Contains(stationSearchViewModel.StationName));
            predicate = predicate.And(p => p.status.Contains(stationSearchViewModel.status));
            //if(stationSearchViewModel.Expense!=null)
            //predicate = predicate.And(p => p.Expense.Value.ToString().Contains(stationSearchViewModel.Expense.Value.ToString()));
            return(predicate);
        }
Пример #3
0
        public List <Bus_Station> SearchInfoByWhere(StationSearchViewModel stationSearchViewModel)
        {
            int SkipNum = stationSearchViewModel.pageViewModel.CurrentPageNum * stationSearchViewModel.pageViewModel.PageSize;

            //查询条件
            var predicate = SearchStationWhere(stationSearchViewModel);
            var result    = DbSet.Where(predicate)
                            .Skip(SkipNum)
                            .Take(stationSearchViewModel.pageViewModel.PageSize)
                            .OrderBy(o => o.AddDate).ToList();


            return(result);
        }
Пример #4
0
        public ActionResult <StationSearchResModel> Manage_Station_Search(StationSearchViewModel stationSearchViewModel)
        {
            StationSearchResModel stationSearchResModel = new StationSearchResModel();
            var StationSearchResult = _stationService.Station_Search(stationSearchViewModel);
            var TotalNum            = _stationService.Station_Get_ALLNum(stationSearchViewModel);

            stationSearchResModel.station_Infos              = StationSearchResult;
            stationSearchResModel.isSuccess                  = true;
            stationSearchResModel.baseViewModel.Message      = "查询成功";
            stationSearchResModel.baseViewModel.ResponseCode = 200;
            stationSearchResModel.TotalNum = TotalNum;
            _ILogger.Information("查询站点信息成功");
            return(Ok(stationSearchResModel));
        }
Пример #5
0
        /// <summary>
        /// 站点总数量
        /// </summary>
        /// <param name="stationSearchViewModel"></param>
        /// <returns></returns>
        public IQueryable <Bus_Station> GetStationAll(StationSearchViewModel stationSearchViewModel)
        {
            var predicate = SearchStationWhere(stationSearchViewModel);

            return(DbSet.Where(predicate));
        }
Пример #6
0
 /// <summary>
 /// 站点数量
 /// </summary>
 /// <param name="stationSearchViewModel"></param>
 /// <returns></returns>
 public int Station_Get_ALLNum(StationSearchViewModel stationSearchViewModel)
 {
     return(_IBusStationRepository.GetStationAll(stationSearchViewModel).Count());
 }