コード例 #1
0
ファイル: ReportAdapter.cs プロジェクト: asdlvs/MinStat
        public IEnumerable<StatisticDataModel> Convert(IEnumerable<StatisticData> statisticData)
        {
            List<StatisticDataModel> statisticDataModelsCollection = new List<StatisticDataModel>();

            foreach (var data in statisticData)
            {
                StatisticDataModel statisticDataModel = new StatisticDataModel();
                statisticDataModel.Titles = data.Titlesk__BackingField;
                statisticDataModel.Values = data.Linesk__BackingField.Select(x => new StatisticDataItemModel
                {
                    Title = x.Titlek__BackingField,
                    Values = x.Valuesk__BackingField != null ? x.Valuesk__BackingField.ToList() : null,
                    BoldLevel = x.StrongLevelk__BackingField,
                    Id = x.Idk__BackingField
                });
                statisticDataModelsCollection.Add(statisticDataModel);
            }

            return statisticDataModelsCollection;
        }
コード例 #2
0
        public ActionResult CustomReport(SelectionChecks selectionChecks, string reportType)
        {
            if (!selectionChecks.HorizontalChecks.Any() || !selectionChecks.VerticalChecks.Any())
            {
                ModelState.AddModelError("nochecks", "Для составления отчета необходимо указать виды деятельности и категории работников!");
                return Index((int?)Session["enterpriseId"], (int?)Session["federalSubjectId"], (int?)Session["federalDistrictId"],
                             (string)Session["startDate"], (string)Session["endDate"]);
            }

            ViewBag.RenderGraphic = true;
            IEnumerable<StatisticDataModel> model = new StatisticDataModel[0];
            FillReportMetaData(model, selectionChecks.VerticalChecks, selectionChecks.HorizontalChecks);
            if (reportType.EndsWith("#static") || String.IsNullOrWhiteSpace(reportType))
            {
                Session["startDate"] = null;
                DateTime startDate = new DateTime(DateTime.Parse((string)Session["endDate"]).Year, 1, 1);
                model = _selectionReport.GetQtyStaticData(
                    (int)Session["enterpriseId"],
                    (int)Session["federalSubjectId"],
                    (int)Session["federalDistrictId"],
                    startDate.ToShortDateString(),
                    (string)Session["endDate"],
                    selectionChecks.VerticalChecks, selectionChecks.HorizontalChecks);
                FillReportMetaData(model, selectionChecks.VerticalChecks, selectionChecks.HorizontalChecks);
                return View("StaticStatisticData", model);
            }
            if (reportType.EndsWith("#dynamic"))
            {
                model = _selectionReport.GetQtyDynamicData(
                    (int)Session["enterpriseId"],
                    (int)Session["federalSubjectId"],
                    (int)Session["federalDistrictId"],
                    (string)Session["startDate"],
                    (string)Session["endDate"],
                    selectionChecks.VerticalChecks, selectionChecks.HorizontalChecks);
                FillReportMetaData(model, selectionChecks.VerticalChecks, selectionChecks.HorizontalChecks);
                return View("DynamicStatisticData", model);
            }
            FillReportMetaData(model, selectionChecks.VerticalChecks, selectionChecks.HorizontalChecks);
            return View("Index", model);
        }
コード例 #3
0
 public ActionResult Index()
 {
     IEnumerable<StatisticDataModel> model = new StatisticDataModel[0];
     return View(model);
 }