public CategoryAreaDataWriter(IAreasReader areasReader, IGroupDataReader groupDataReader, WorksheetInfo worksheet,
            ProfileDataWriter profileDataWriter, CategoryAreaType categoryAreaType)
            : base(areasReader, groupDataReader, worksheet, profileDataWriter)
        {
            _categoryAreaTypeId = categoryAreaType.CategoryTypeId;

            categories = areasReader.GetCategories(_categoryAreaTypeId);

                subnationalCategoryIdToCategoryAreaMap = categories
                    .ToDictionary<Category, int, IArea>(
                    category => category.Id,
                    category => CategoryArea.New(category)
                    );
        }
 public TrendMarkerWriter(ProfileDataWriter profileDataWriter, TrendMarkersProvider trendMarkersProvider, 
     TrendMarkerLabelProvider trendMarkerLabelProvider)
 {
     _profileDataWriter = profileDataWriter;
     _trendMarkersProvider = trendMarkersProvider;
     _trendMarkerLabelProvider = trendMarkerLabelProvider;
 }
 protected ParentDataWriter(IAreasReader areasReader, IGroupDataReader groupDataReader, WorksheetInfo worksheetInfo, ProfileDataWriter profileDataWriter)
 {
     AreasReader = areasReader;
     GroupDataReader = groupDataReader;
     Worksheet = worksheetInfo;
     ProfileDataWriter = profileDataWriter;
 }
 public static ParentDataWriter New(IAreasReader areasReader, IGroupDataReader groupDataReader, WorksheetInfo worksheetInfo, 
     ProfileDataWriter profileDataWriter, IAreaType parentAreaType)
 {
     var categoryAreaType = parentAreaType as CategoryAreaType;
     return categoryAreaType != null
         ? (ParentDataWriter)new CategoryAreaDataWriter(areasReader, groupDataReader, worksheetInfo, profileDataWriter, categoryAreaType)
         : (ParentDataWriter)new SubnationalAreaDataWriter(areasReader, groupDataReader, worksheetInfo, profileDataWriter, parentAreaType);
 }
        public ProfileDataBuilder(ComparatorMap comparatorMap, Profile profile, List<int> restrictSearchProfileIds,
            IList<ParentArea> parentAreas, IAreaType subnationalAreaType)
        {
            this._comparatorMap = comparatorMap;
            this._profile = profile;
            this._restrictSearchProfileIds = restrictSearchProfileIds;
            this._parentAreas = parentAreas;

            _profileDataWriter = new ProfileDataWriter(profile);

            _profileDataWriter.AddOrganisationDetails(profile.Id);

            _nationalArea = comparatorMap.GetNationalComparator().Area;

            this._subnationalAreaType = subnationalAreaType;
        }
        public static ITrendMarkerWriter New(ProfileDataWriter profileDataWriter, int polarityId, IList<TimePeriod> timePeriods, bool hasTrendMarkers)
        {
            if (hasTrendMarkers && timePeriods.Count >= TrendMarkerCalculator.MinimumNumberOfPoints)
            {
                // Use null for TrendReader as all data will be provided to the provider
                var trendMarkerLabelProvider = new TrendMarkerLabelProvider(polarityId);
                var trendMarkerProvider = new TrendMarkersProvider(null, new TrendMarkerCalculator());
                return new TrendMarkerWriter(profileDataWriter, trendMarkerProvider, trendMarkerLabelProvider);
            }

            return new NullTrendMarkerWriter();
        }