Exemple #1
0
        public ActionResult Index()
        {
            var model = new SearchProducerReportsModel();

            model.Enable           = true;
            model.CurrentPageIndex = 0;

            ViewBag.ProducerList = GetProducerList();
            return(View(model));
        }
Exemple #2
0
        public ActionResult SearchResult(SearchProducerReportsModel param)
        {
            var schedulerName = ReportHelper.GetSchedulerName();
            var query         = DbSession.Query <Job>().Fetch(x => x.Owner).Fetch(x => x.Producer)
                                .Where(x => x.SchedName == schedulerName);

            if (param.Enable.HasValue)
            {
                query = query.Where(x => x.Enable == param.Enable);
            }
            if (param.Producer.HasValue)
            {
                query = query.Where(x => x.Producer.Id == param.Producer);
            }
            if (param.ReportType.HasValue)
            {
                query = query.Where(x => (int)x.ReportType == param.ReportType);
            }
            if (!string.IsNullOrEmpty(param.ReportName))
            {
                query = query.Where(x => x.CustomName.Contains(param.ReportName));
            }
            if (param.RunFrom.HasValue)
            {
                query = query.Where(x => x.LastRun >= param.RunFrom);
            }
            if (param.RunTo.HasValue)
            {
                query = query.Where(x => x.LastRun <= param.RunTo);
            }

            var itemsCount   = query.Count();
            var itemsPerPage = Convert.ToInt32(ConfigurationManager.AppSettings["ReportCountPage"]);
            var info         = new SortingPagingInfo()
            {
                CurrentPageIndex = param.CurrentPageIndex,
                ItemsCount       = itemsCount,
                ItemsPerPage     = itemsPerPage
            };

            ViewBag.Info = info;

            var model =
                query.OrderByDescending(x => x.CreationDate).Skip(param.CurrentPageIndex * itemsPerPage).Take(itemsPerPage).ToList();

            ViewData["DeleteOldReportsTerm"] = int.Parse(ConfigurationManager.AppSettings["DeleteOldReportsTerm"]);
            return(View(model));
        }
Exemple #3
0
 public ActionResult Index(SearchProducerReportsModel model)
 {
     ViewBag.ProducerList = GetProducerList();
     return(View(model));
 }