コード例 #1
0
ファイル: ServScheduleBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 获取资产巡检列表
 /// </summary>
 /// <param name="pageIndex"></param>
 /// <param name="pageSize"></param>
 /// <param name="assetType"></param>
 /// <param name="regionId"></param>
 /// <param name="startTime"></param>
 /// <param name="endTime"></param>
 /// <param name="totalNumber"></param>
 /// <returns></returns>
 public List <RetCameraPatrolSchedule> GetAssetInspectionByPage(int pageIndex, int pageSize, int assetType, int regionId, string startTime, string endTime, out int totalNumber)
 {
     try
     {
         List <RetCameraPatrolSchedule> retList  = new List <RetCameraPatrolSchedule>();
         RetCameraPatrolSchedule        retModel = null;
         AssetInspectionQuery           query    = new AssetInspectionQuery();
         ServScheduleTimeConfigDAL      scheduleTimeConfigDal = new ServScheduleTimeConfigDAL();
         BaseRegionConfigDAL            baseRegionConfigDal   = new BaseRegionConfigDAL();
         query.assetType = assetType;
         query.endTime   = endTime;
         query.pageIndex = pageIndex;
         query.pageSize  = pageSize;
         query.regionId  = regionId;
         query.startTime = startTime;
         List <ServScheduleModel> list = servScheduleDal.GetAssetInspectionPage(query, out totalNumber);
         //获取全部园区配置
         List <BaseRegionConfigModel> regionConfigList = baseRegionConfigDal.GetAllRegionConfig();
         for (int i = 0; i < list.Count; i++)
         {
             retModel             = new RetCameraPatrolSchedule();
             retModel.content     = list[i].content;
             retModel.create_time = list[i].create_time;
             retModel.cronTime    = CSM.Utils.TimeExpression.GetCronTimeModel(list[i].period_expression);//生成时间表达式model
             retModel.span_time   = list[i].span_time;
             #region 查询时间配置
             ServScheduleTimeConfigQuery timeQuery = new ServScheduleTimeConfigQuery();
             timeQuery.schedule_id = list[i].id;
             timeQuery.time_type   = 1;//查询开始时间
             ServScheduleTimeConfigModel timeModel = scheduleTimeConfigDal.GetScheduleTimeConfigByIdAndTimeType(timeQuery).FirstOrDefault();
             retModel.start_execute_time = timeModel == null ? "" : timeModel.schedule_time;
             retModel.execute_date       = timeModel == null ? "" : timeModel.schedule_date;
             #endregion
             retModel.id = list[i].id;
             retModel.end_execute_time  = "";
             retModel.end_time          = list[i].end_time;
             retModel.period_expression = list[i].period_expression;
             retModel.region_id         = list[i].region_id;
             retModel.schedule_name     = list[i].schedule_name;
             retModel.schedule_state    = list[i].schedule_state;
             retModel.schedule_type     = list[i].schedule_type;
             retModel.start_time        = list[i].start_time;
             var regionModel = regionConfigList.Where(n => n.id == list[i].region_id).FirstOrDefault();
             retModel.ext10 = regionModel == null ? "" : regionModel.region_name; //备用字段10用于存储园区名称
             retModel.ext7  = list[i].end_time > DateTime.Now ? "1" : "2";        //1:未过期,2:过期
             retModel.ext9  = retModel.cronTime.describe;                         //获取表达式描述
             retList.Add(retModel);
         }
         return(retList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
 /// <summary>
 /// 分页获取资产巡检
 /// </summary>
 /// <param name="query"></param>
 /// <param name="totalNumber"></param>
 /// <returns></returns>
 public List <ServScheduleModel> GetAssetInspectionPage(AssetInspectionQuery query, out int totalNumber)
 {
     try
     {
         string sql = CSM.Utils.IBatisHelper.GetRuntimeSql(mapContext, "QueryAssetInspectionPage", query);
         List <ServScheduleModel> list = mapContext.QueryForList <ServScheduleModel>("QueryAssetInspectionPage", query).ToList();
         totalNumber = mapContext.QueryForObject <int>("QueryAssetInspectionCount", query);
         return(list);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }