Example #1
0
        public override List <ReportJobLogView> GetListEx(
            Expression <Func <ReportJobLogEntity, bool> > predicate, PageCondition ConPage)
        {
            predicate = predicate.AndAlso(a => JobStatus.Success.ToString().Equals(a.JobStatus));

            var list = new List <ReportJobLogView>();

            ConPage.SortConditions.Add(new SortCondition("CreatedDate", System.ComponentModel.ListSortDirection.Descending));

            //var resultList = _reportJobLogService.GetQueryable(predicate).GroupBy(x => x.JobName).Select(x => new { DateTo = x.Max(y => y.DateTo), JobName = x.Key })
            //    .ToList().Select(x => new ReportJobLogEntity
            //    {
            //        JobName = x.JobName,
            //        DateTo = x.DateTo
            //    }).ToList();

            var resultList = _reportJobLogService.GetQueryable(predicate).OrderByDescending(x => x.Id).Take(5).ToList();

            list = CreateJobList(resultList.Select(
                                     n => (ReportJobLogView)(new ReportJobLogView().ConvertAPIModel(n))).ToList());

            ConPage.RowCount  = 4;
            ConPage.PageIndex = 1;
            ConPage.PageSize  = 4;

            return(list);
        }
Example #2
0
        //private static IList<JobName> jobLogs = new List<JobName> { JobName.AppAccessJob, JobName.ArticleReportJob, JobName.MenuReportJob };

        public IList <ReportJobLog> ManualStartJob(IList <JobName> runJobs)
        {
            foreach (var job in runJobs.Select(jobName => _JobManager.GetJob(jobName)).Where(job => job != null))
            {
                job.ManuallyRunJob();
            }

            var predicate = PredicateBuilder.False <ReportJobLog>();

            predicate = (from object job in Enum.GetValues(typeof(JobName)) select job.ToString()).Aggregate(predicate, (current, jobName) => current.Or(x => x.JobName == jobName));

            var status = JobStatus.Success.ToString();

            predicate = predicate.And(x => x.JobStatus == status);

            return(_reportJobLogService.GetQueryable(predicate).OrderByDescending(x => x.CreatedDate).GroupBy(x => x.JobName).Select(x => x.FirstOrDefault()).ToList());
        }