/// <summary> /// Initializes a new instance of the <see cref="DatasetSummaryHelper"/> class. /// </summary> /// <param name="element">The element.</param> public DatasetSummaryHelper(XElement element) { var progElement = element.Element(progessName); Progress = new ProgressState( int.Parse(progElement.Attribute(countName).Value), int.Parse(progElement.Attribute(totalName).Value)); MappingsHelper = new MappingsHelper(element); }
/// <summary> /// Initializes a new instance of the <see cref="DatasetSummaryHelper"/> class. /// </summary> /// <param name="context">The context.</param> /// <param name="progress">The progress.</param> /// <param name="required">The required.</param> /// <param name="optional">The optional.</param> public DatasetSummaryHelper( DatasetContext context, ProgressState progress, MappingDictionary required, MappingDictionary optional) { Progress = progress ?? new ProgressState(0, 1); MappingsHelper = new MappingsHelper(required, optional); var attrs = new List <XAttribute>(); if (!string.IsNullOrEmpty(context.Year)) { attrs.Add(new XAttribute("Year", context.Year ?? string.Empty)); } if (context.Quarter.HasValue) { attrs.Add(new XAttribute("Quarter", context.Quarter.GetValueOrDefault())); } ReportingPeriod = new XElement("ReportingPeriod", attrs.ToArray()); }