private Dictionary <Guid, FootnotesIndicatorsMetaViewModel> GetIndicators(Guid subjectId)
 {
     return(_indicatorGroupService.GetIndicatorGroups(subjectId)
            .OrderBy(group => group.Label, LabelComparer)
            .ToDictionary(
                group => group.Id,
                group => new FootnotesIndicatorsMetaViewModel
     {
         Label = group.Label,
         Options = group.Indicators
                   .OrderBy(indicator => indicator.Label, LabelComparer)
                   .Select(
             indicator => new IndicatorMetaViewModel
         {
             Label = indicator.Label,
             Name = indicator.Name,
             Unit = indicator.Unit.GetEnumValue(),
             Value = indicator.Id.ToString(),
             DecimalPlaces = indicator.DecimalPlaces
         }
             )
                   .ToList()
     }
                ));
 }
Ejemplo n.º 2
0
 private Dictionary <string, IndicatorsMetaViewModel> GetIndicators(Guid subjectId)
 {
     return(_indicatorGroupService.GetIndicatorGroups(subjectId)
            .OrderBy(group => group.Label, LabelComparer)
            .ToDictionary(
                group => group.Label.PascalCase(),
                group => new IndicatorsMetaViewModel
     {
         Label = group.Label,
         Options = BuildIndicatorViewModels(group.Indicators)
     }
                ));
 }
Ejemplo n.º 3
0
        public ActionResult Add(DocumentTypeAddModel addDocumentType)
        {
            var documentType = Mapper.Map <DocumentTypeAddModel, DocumentType>(addDocumentType);

            if (addDocumentType.IndicatorGroupSelect != null)
            {
                documentType.IndicatorsGroups = _indicatorGroupService
                                                .GetIndicatorGroups(i => addDocumentType.IndicatorGroupSelect.Contains(i.IndicatorGroupID))
                                                .ToList();
            }
            if (ModelState.IsValid)
            {
                _documentTypeService.CreateDocumentType(documentType);
                this.AddStatus(StatusType.SUCCESS, "Успешно добавлен!");
                return(RedirectToAction("Index"));
            }
            return(null);
        }
Ejemplo n.º 4
0
        public ActionResult Index()
        {
            var indicatorGroupViewModel = new IndicatorGroupViewModel();
            var indicatorGroups         = _indicatorGroupService.GetIndicatorGroups();
            var indicatorGroupsDetails  = Mapper.Map <IEnumerable <IndicatorGroup>, IEnumerable <IndicatorGroupFormModel> >(indicatorGroups);
            var indicators = _indicatorService.GetIndicatorWithIndicatorGroup();

            foreach (var indicatorGroup in indicatorGroupsDetails)
            {
                indicatorGroup.Indicators = indicators.Where(ct => ct.IndicatorGroup != null &&
                                                             ct.IndicatorGroup.IndicatorGroupID == indicatorGroup.IndicatorGroupID)
                                            .Select(ct => new SelectListItem
                {
                    Value    = ct.IndicatorID.ToString(),
                    Text     = ct.Name,
                    Selected = ct.IndicatorGroup == null ? false : ct.IndicatorGroup.IndicatorGroupID == indicatorGroup.IndicatorGroupID
                });
            }
            indicatorGroupViewModel.IndicatorGroups = indicatorGroupsDetails;
            indicatorGroupViewModel.IndicatorSelect = Mapper.Map <IEnumerable <Indicator>, IEnumerable <IndicatorSelect> >
                                                          (indicators.Where(ct => ct.IndicatorGroup == null)).ToList();
            return(View(indicatorGroupViewModel));
        }