public static void AppendScenarios(StringBuilder keyNameString, ContextProperty cp) { foreach (Scenario s in cp.Scenarios) { keyNameString.Append(InstanceUtils.BuildSegmentScenarioName(s)).Append(Environment.NewLine); } }
public static void BuildSharedKeyParts(StringBuilder keyNameString, ContextProperty cp, bool includeEntityID) { if (includeEntityID) { keyNameString.Append(TraceUtility.FormatStringResource("DragonView.Data.EntityIDColon", cp.EntityValue)); keyNameString.Append(Environment.NewLine); } foreach (Segment s in cp.Segments) { keyNameString.Append(InstanceUtils.BuildSegmentScenarioName(s)).Append(Environment.NewLine); } if (cp.PeriodType == Element.PeriodType.duration) { keyNameString.Append(string.Format("{0} - {1}", cp.PeriodStartDate.ToString("d"), cp.PeriodEndDate.ToString("d"))); } else if (cp.PeriodType == Element.PeriodType.instant) { // instant keyNameString.Append(cp.PeriodStartDate.ToString("d")); } else //forever { keyNameString.Append(TraceUtility.FormatStringResource("DragonView.Data.Forever")); } keyNameString.Append(Environment.NewLine); }
public string GetSegmentsString(bool includeScenarios, bool includePromotedLabels, bool includePrevReportScenario, bool includeAdjustmentLabel, bool includeCurrency, string reportName) { StringBuilder sbSegment = new StringBuilder(); int idxLastParen = reportName.LastIndexOf('('); string promotedLabels = idxLastParen > 0 ? reportName.Substring(idxLastParen) : string.Empty; for (int index = 0; index < this.Segments.Count; index++) { Segment s = this.Segments[index] as Segment; string strSegment = InstanceUtils.BuildSegmentScenarioName(s); if (includePromotedLabels || !promotedLabels.Contains(strSegment)) { if (!includePrevReportScenario && s.DimensionInfo != null && s.DimensionInfo.dimensionId == InstanceUtils._ScenarioAxis && s.DimensionInfo.Id == InstanceUtils._ScenarioAsPreviouslyReport) { //If the caller does not want to include the "As Previously Reported" scenario in the label //and we are on that scenario, we need to skip it continue; } if (!includeAdjustmentLabel && s.DimensionInfo != null && s.DimensionInfo.dimensionId == InstanceUtils._ScenarioAxis && s.DimensionInfo.Id == InstanceUtils._ScenarioAdjustment) { //If the caller does not want to include the "Adjustment" scenario in the label //and we are on that scenario, we need to skip it continue; } //Not the first value appended to the string, append the delimeter if (sbSegment.Length > 0) { sbSegment.Append(" | "); } sbSegment.Append(strSegment); } } if (includeScenarios && this.hasScenarios) { for (int index = 0; index < this.Scenarios.Count; index++) { Scenario s = this.Scenarios[index] as Scenario; string strScenario = InstanceUtils.BuildSegmentScenarioName(s); if (includePromotedLabels || !reportName.Contains(strScenario)) { if (!includePrevReportScenario && s.DimensionInfo != null && s.DimensionInfo.dimensionId == InstanceUtils._ScenarioAxis && s.DimensionInfo.Id == InstanceUtils._ScenarioAsPreviouslyReport) { //If the caller does not want to include the "As Previously Reported" scenario in the label //and we are on that scenario, we need to skip it continue; } if (!includeAdjustmentLabel && s.DimensionInfo != null && s.DimensionInfo.dimensionId == InstanceUtils._ScenarioAxis && s.DimensionInfo.Id == InstanceUtils._ScenarioAdjustment) { //If the caller does not want to include the "Adjustment" scenario in the label //and we are on that scenario, we need to skip it continue; } //Not the first value appended to the string, append the delimeter if (sbSegment.Length > 0) { sbSegment.Append(" | "); } sbSegment.Append(strScenario); } } } if (includeCurrency) { string curCode = InstanceUtils.GetCurrencyCodeFromMCU(this.MCU); sbSegment.Append(curCode); } return(sbSegment.ToString()); }