Пример #1
0
        /// <summary>
        /// Froms the filter list.
        /// </summary>
        /// <param name="filters">The filters.</param>
        /// <param name="report">The report.</param>
        /// <returns></returns>
        public static IList <RptFilter> FromFilterList(IList <RptManifestFilter> filters, Report report)
        {
            var rptsFilters = new List <RptFilter>();

            foreach (var filter in filters.ToList())
            {
                foreach (var fv in filter.Values.ToList())
                {
                    var rptFilter = new RptFilter(report);

                    if (string.IsNullOrEmpty(fv.Name))
                    {
                        continue;
                    }

                    rptFilter.FilterType     = filter.Type;
                    rptFilter.Name           = fv.Name;
                    rptFilter.Value          = fv.Value;
                    rptFilter.IsRadioButton  = fv.IsRadioButton;
                    rptFilter.RadioGroupName = fv.RadioGroupName;

                    if (!rptsFilters.Any(f => f.FilterType == rptFilter.FilterType && f.Name.EqualsIgnoreCase(rptFilter.Name)))
                    {
                        rptsFilters.Add(rptFilter);
                    }
                }
            }

            return(rptsFilters.DistinctBy(fv => fv.Name).ToList());
            //return rptsFilters.ToList();
        }
Пример #2
0
        /// <summary>
        /// Cleans the before save.
        /// </summary>
        public override void CleanBeforeSave()
        {
            _rptfilters = Filters == null
                                        ? new List <RptFilter>()
                                        : RptFilter.FromFilterList(Filters, this).ToList();

            //if (Filters != null && Filters.Any())
            //    Filters = Filters.RemoveNullValues().Distinct().ToList();

            //if (Columns != null && Columns.Any())
            //    Columns = Columns.RemoveNullValues().Distinct().ToList();
        }
Пример #3
0
        public void AssignFrom(ReportManifest manifest)
        {
            //Filters = new List<Filter>();
            Columns            = Columns ?? new List <ReportColumn>();
            WebsitePages       = WebsitePages ?? new List <ReportWebsitePage>();
            ComparisonKeyIcons = ComparisonKeyIcons ?? new List <ComparisonKeyIconSet>();
            _rptfilters        = _rptfilters ?? new List <RptFilter>();
            Audiences          = Audiences ?? new List <Audience>();

            Columns.Clear();
            WebsitePages.Clear();
            ComparisonKeyIcons.Clear();
            _rptfilters.Clear();
            Audiences.Clear();

            ComparisonKeyIcons.AddRange(manifest.ToComparisonKeyIconSet(manifest.IconSets, this).ToList());
            Audiences.AddRange(manifest.Audiences.Select(a => a.AudienceType).ToList());
            Category   = manifest.Category;
            IsTrending = manifest.IsTrending;
            Datasets   = manifest.Datasets.Select(d => d.Name).ToList();
            manifest.Columns.ForEach(col => new ReportColumn(this, col.Name)
            {
                IsMeasure = col.IsMeasure, MeasureCode = col.MeasureCode, IsIncluded = true
            });
            manifest.WebsitePages.ForEach(wp => new ReportWebsitePage(this, wp));

            Name                      = manifest.Name;
            ReportAttributes          = manifest.ReportAttributes;
            SourceTemplate            = manifest;
            Description               = !string.IsNullOrWhiteSpace(manifest.Description) ? manifest.Description.TrimStart().TrimEnd() : null;
            Filter                    = CandidateFilters.ToReportFilter();
            RequiresCmsProviderId     = manifest.RequiresCmsProviderId;
            RequiresCostToChargeRatio = manifest.RequiresCostToChargeRatio;
            ReportType                = manifest.Name;
            ShowInterpretationText    = manifest.ShowInterpretationText;
            InterpretationText        = !string.IsNullOrWhiteSpace(manifest.InterpretationText) ? manifest.InterpretationText.TrimStart().TrimEnd() : null;
            Footnote                  = !string.IsNullOrWhiteSpace(manifest.Footer) ? manifest.Footer.TrimStart().TrimEnd() : null;
            ReportOutputSql           = !string.IsNullOrWhiteSpace(manifest.ReportOutputSql) ? manifest.ReportOutputSql.TrimStart().TrimEnd() : null;
            OutputFileName            = !string.IsNullOrWhiteSpace(manifest.OutputFileName) ? manifest.OutputFileName.TrimStart().TrimEnd() : null;
            OutputJsNamespace         = !string.IsNullOrWhiteSpace(manifest.OutputJsNamespace) ? manifest.OutputJsNamespace.TrimStart().TrimEnd() : null;

            _rptfilters.AddRange(RptFilter.FromFilterList(manifest.Filters, this).ToList());

            LastReportManifestUpdate = manifest.FileLastModifiedDate;
        }