77b65bea-e766-4e3c-a1ed-c4c2534b6019 true D0001-SQL-11.sdt.local jazz dev master Prod 20190708.1 true <ProgramFilesX64>\Microsoft SDKs\Azure\.NET SDK\v2.9\bin\plugins\Diagnostics\Newtonsoft.Json.dll Amazon.Lambda.S3Events AWSSDK.Core AWSSDK.S3 RestSharp Amazon Amazon.Auth.AccessControlPolicy Amazon.Auth.AccessControlPolicy.ActionIdentifiers Amazon.Internal Amazon.Lambda.S3Events Amazon.MissingTypes Amazon.Runtime Amazon.Runtime.CredentialManagement Amazon.Runtime.CredentialManagement.Internal Amazon.Runtime.EventStreams Amazon.Runtime.EventStreams.Internal Amazon.Runtime.Internal Amazon.Runtime.Internal.Auth Amazon.Runtime.Internal.Settings Amazon.Runtime.Internal.Transform Amazon.Runtime.Internal.Util Amazon.Runtime.SharedInterfaces Amazon.Runtime.SharedInterfaces.Internal Amazon.S3 Amazon.S3.Encryption Amazon.S3.Encryption.Internal Amazon.S3.Internal Amazon.S3.IO Amazon.S3.Model Amazon.S3.Model.Internal.MarshallTransformations Amazon.S3.Transfer Amazon.S3.Util Amazon.Util Amazon.Util.Internal Amazon.Util.Internal.PlatformServices Newtonsoft.Json Newtonsoft.Json.Converters Newtonsoft.Json.Linq Newtonsoft.Json.Schema Newtonsoft.Json.Serialization System System.Diagnostics System.Diagnostics.Tracing System.IO.Compression ThirdParty.BouncyCastle.Asn1 ThirdParty.BouncyCastle.Asn1.Utilities ThirdParty.BouncyCastle.Math ThirdParty.BouncyCastle.OpenSsl ThirdParty.BouncyCastle.Utilities.IO.Pem ThirdParty.Ionic.Zlib ThirdParty.Json.LitJson ThirdParty.MD5 RestSharp private string BaseUrl = "https://api-prod.sdt.local/StrataSphere.Web.API.Service/api/v1/"; void Main() { RestClient client = new RestClient(); var definitions = GetList(client, "Definitions"); var hierarchies = (from scoreHierarchy in ViewScoreHierarchy select new { scoreHierarchy.HierarchyGUID, scoreHierarchy.FriendlyName, scoreHierarchy.DimensionGUID}).ToList() .Where(sh => definitions.Select(d => d.HierarchyGuid).Contains(sh.HierarchyGUID)) .GroupBy(sh => sh.HierarchyGUID, (grp, data) => new { HierarchyGUID = grp, DimensionGUID = data.First().DimensionGUID, FriendlyName = data.First().FriendlyName }); //179B6541-2285-4196-4209-08D7469CC7F2 definitions //.Where(d => d.HierarchyId == "UB Revenue Code") .Where(d => d.DimensionId == "Patient Encounter") .OrderBy(d => d.DimensionId).ThenBy(d => d.AttributeId).ThenBy(d => d.Name).Dump("Definitions"); hierarchies.Dump("Hierarchies"); var mdx = GetList(client, "MDXScoreToCube"); mdx .Where(m => m.OrgPin == "0430") //.Where(m => m.CubeDimensionName.Contains("Patient")) .OrderBy(m => m.ScoreHierarchyName) .ThenBy(m => m.OrgPin).Dump("MDX Score to Cube"); } void other() { StandardDefinitionMappings.Select(sdm => new { sdm.MappingId, sdm.StandardDefinitionGUID, sdm.StandardDefinitionType, MappingMemberValue = JsonConvert.DeserializeObject(sdm.MappingMemberValue) }).Dump("StandardDefinitionMappings"); REReports.Join(REDSCubeReportParameters, r => r.ReportGUID, p => p.ReportGUID, (r, p) => new ReportInfo(p.ParameterXML) { Report = r.Name, DimensionID = p.DimensionID, AttributeID = p.AttributeID }).Dump("Cube Reports"); REReports.Join(REClientReportParameters, r => r.ReportGUID, p => p.ReportGUID, (r, p) => new ReportInfo(p.ParameterXML) { Report = r.Name, DimensionID = p.DimensionID, AttributeID = p.AttributeID }).Dump("Client Reports"); } IEnumerable GetList(RestClient client, string something) { return Get>(client, something); } T Get(RestClient client, string something) { client.BaseUrl = new Uri(BaseUrl + something); RestRequest request = new RestRequest(); request.Method = Method.GET; return JsonConvert.DeserializeObject(client.Execute(request).Content); } void stuff(RestClient client) { client.BaseUrl = new Uri(BaseUrl + "Definitions"); RestRequest request = new RestRequest(); request.Method = Method.GET; var definitions = JsonConvert.DeserializeObject>(client.Execute(request).Content); definitions.Where(d => d.DimensionGuid == new Guid("6EF6B1F7-A50C-4198-8866-140BB82E2DDA")).Dump("Definitions"); client.BaseUrl = new Uri(BaseUrl + "MDXScoreToCube"); var mdx = JsonConvert.DeserializeObject>(client.Execute(request).Content); mdx.Dump("MDX"); client.BaseUrl = new Uri(BaseUrl + "Reports"); var reports = JsonConvert.DeserializeObject>(client.Execute(request).Content); reports.Dump("Reports"); var reportSetupUrl = new Uri(BaseUrl + "Reports/{0}/Setup"); reports.Where(r => r.Id == new Guid("a4a12e21-954b-4889-d5c8-08d71f2ff590")).ToList().ForEach(r => { client.BaseUrl = new Uri(BaseUrl + $"Reports/{r.Id}"); var rpt = JsonConvert.DeserializeObject(client.Execute(request).Content); rpt.DefinitionIds.ForEach(d => { client.BaseUrl = new Uri(BaseUrl + $"Defintions/{d}"); var definition = JsonConvert.DeserializeObject>(client.Execute(request).Content); definition.Dump($"Report {r.Name} Definition {d}"); }); }); } // Define other methods and classes here public class ReportInfo { public string Report { get; set; } public string DimensionID { get; set; } public string AttributeID { get; set; } public string ParameterXML { get; set; } internal XmlDocument doc; public string Parameter { get; set; } public ReportInfo(string parameterXML) { ParameterXML = parameterXML; var parameterXml = ParameterXML = $"{ParameterXML}" .RemoveAllNamespacesAsString() .Replace("string>", "valueId>") .Replace("", "") .Replace("<_", "<").Replace("( JsonConvert.SerializeXmlNode(doc.SelectSingleNode("root") ) ) , Newtonsoft.Json.Formatting.Indented); } } public class StrataSphereMappingValues { public string HierarchyGUID { get; set; } public string DimensionGUID { get; set; } public List values { get; set; } public List mappings { get; set; } public List hierarchyPaths { get; set; } public StrataSphereMappingValues() { mappings = new List(); } } public class MappingValue { public string id { get; set; } public string displayHierarchyName { get; set; } public string text { get; set; } public string name { get; set; } public List attributeValues { get; set; } public List hierarchyPaths { get; set; } public MappingValue() { attributeValues = new List(); hierarchyPaths = new List(); } } public enum eStrataSphereItemCategory { Report, Dashboard } public enum StrataSphereReportEnum { Report, DSCubeReport, SQLReport, ClientReport } public class ReportDto { public Guid Id { get; set; } public string Name { get; set; } public string Description { get; set; } public string Author { get; set; } public eStrataSphereItemCategory Category => eStrataSphereItemCategory.Report; public string Tagline => $"Report | {Module} | {DateCreated.ToString("MMM-dd-YYYY")} | {DownloadCount} downloads"; public StrataSphereReportEnum ReportType { get; set; } public string Module { get; set; } public string MinJazzVersion { get; set; } public string MaxJazzVersion { get; set; } public string ReportSetupJson { get; set; } public List DefinitionIds { get; set; } public DateTime DateCreated { get; set; } public DateTime DateLastModified { get; set; } public int DownloadCount { get; set; } public ReportDto() { ReportSetupJson = "{}"; DefinitionIds = new List(); } } public class DefinitionDto { /// /// Definition Guid in StrataSphere /// /// 00000000-0000-0000-0000-000000000000 public Guid Id { get; set; } /// /// The name of the report /// /// TOP 10 DRGs BY SERVICE LINE public string Name { get; set; } /// /// A short description of the definition's content /// /// Top 10 DRGs by Service Line filtered per service line rollup public string Description { get; set; } /// /// The type of report (i.e. PatientPopulation, Metric) /// /// PatientPopulation public Guid HierarchyGuid { get; set; } /// /// The type of report (i.e. PatientPopulation, Metric) /// /// PatientPopulation public Guid DimensionGuid { get; set; } /// /// The Value of the Object Type /// /// All Cause 30 Day Readmits public Guid AttributeGuid { get; set; } /// /// The string of the Definition's dimension Id /// /// [Patient Encounter] public string HierarchyId { get; set; } /// /// The string of the Definition's dimension Id /// /// [Patient Encounter] public string DimensionId { get; set; } /// /// The string of the Definition's attribute Id /// /// [Patient Encounter].[Service Line Strata Decision] public string AttributeId { get; set; } /// /// When the definition was uploaded to StrataSphere /// public DateTime DateCreated { get; set; } /// /// When the definition was last updated in StrataSphere /// public DateTime DateLastModified { get; set; } } public enum MDXMemberIDTypeEnum { Attribute, Name, Text, Id, HierarchyPath } public enum MDXFormatTypeEnum { None, MDX, Hierarchy, MDXMemberId } public class MDXScoreToCubeDto { /// /// The orgpin or the item /// /// 0000 public string OrgPin { get; set; } /// /// The database guid of the item /// /// 00000000-0000-0000-0000-000000000000 public Guid DatabaseGuid { get; set; } /// /// The Score Dimension Name of the item /// /// Patient Type Rollup public string ScoreDimensionName { get; set; } /// /// The Score Hierarchy Name of the item /// /// Patient Type Rollup public string ScoreHierarchyName { get; set; } /// /// The Cube Dimension Name of the item /// /// Patient Type public string CubeDimensionName { get; set; } /// /// The Cube Hierarchy Name of the item /// /// Rollup public string CubeHierarchyName { get; set; } /// /// Indicates if the MDX should use the Attribute, Name, or Text value /// public MDXMemberIDTypeEnum MDXMemberIDType { get; set; } public MDXFormatTypeEnum MDXFormatType { get; set; } } public class ValueIDArray { public List valueId { get; set; } } public class DSCubeSearchCondition { public string FilterOp { get; set; } public string SearchType { get; set; } public string Value2 { get; set; } public string Value { get; set; } public ValueIDArray ValueIDArray { get; set; } } public class SearchConditions { public DSCubeSearchCondition DSCubeSearchCondition { get; set; } } public class DSCubeSearchParameterValue { public string ParameterGUID { get; set; } public string ParameterValueGUID { get; set; } public SearchConditions SearchConditions { get; set; } } public class Root { public DSCubeSearchParameterValue DSCubeSearchParameterValue { get; set; } } public class RootObject { public Root root { get; set; } } #region StrataSphereAdHocReportSetup public interface IStrataSphereAdHocReportSectionItem { string Name { get; set; } bool IsOnChartXAxis { get; set; } bool IsOnChartYAxis { get; set; } } internal class StrataSphereAdHocReportAttribute : IStrataSphereAdHocReportSectionItem { public StrataSphereAdHocReportAttribute() { } public StrataSphereAdHocReportAttribute(IAdHocReportSectionAttribute attribute) { AttributeId = attribute.AttributeID; DimensionId = attribute.DimensionID; Index = attribute.DisplayOrder; Name = attribute.Name; FilterMembers = attribute.FilterMembers; VisibilityStatusValue = (int)attribute.VisibilityStatus; ShowSubtotal = attribute.ShowSubtotal; } public string AttributeId { get; set; } public string DimensionId { get; set; } public int Index { get; set; } public string Name { get; set; } public IList FilterMembers { get; set; } public int VisibilityStatusValue { get; set; } public bool ShowSubtotal { get; set; } public bool IsOnChartXAxis { get; set; } public bool IsOnChartYAxis { get; set; } // section level filters public List Parameters { get; set; } = new List(); } internal class StrataSphereAdHocReportCalculation : IStrataSphereAdHocReportSectionItem { public StrataSphereAdHocReportCalculation() { } public StrataSphereAdHocReportCalculation(IAdHocReportSectionCalculation calculation) { Name = calculation.Name; CalcType = calculation.CalculationType.ID; DisplayOrder = calculation.DisplayOrder; ColumnWidth = calculation.ColumnWidth; DisplayFormat = calculation.DisplayFormat; CalculationJson = JsonConvert.SerializeObject(calculation.CalculationType); CssClass = calculation.CSSClass; IsAttributeMember = calculation.IsAttributeMember; } public string Name { get; set; } public string CalcType { get; set; } public int DisplayOrder { get; set; } public string DisplayFormat { get; set; } public int ColumnWidth { get; set; } public string CalculationJson { get; set; } public string CssClass { get; set; } public bool IsAttributeMember { get; set; } public bool IsOnChartXAxis { get; set; } public bool IsOnChartYAxis { get; set; } public List ConditionalFormats { get; set; } = new List(); } internal class StrataSphereAdHocReportConditionalFormat { public StrataSphereAdHocReportConditionalFormat() { } public StrataSphereAdHocReportConditionalFormat(IAdHocConditionalFormat conditionalFormat) { DisplayOrder = conditionalFormat.DisplayOrder; Comment = conditionalFormat.Comment; ColumnTupleInfo = conditionalFormat.ColumnTupleInfo; } public string Comment { get; set; } public int DisplayOrder { get; set; } public ReportTupleInfo ColumnTupleInfo { get; set; } public string CssClass { get; set; } public string ValueToCompareAsString { get; set; } public int OperatorValue { get; set; } } internal class StrataSphereAdHocReportConfig { public string Title { get; set; } public string Description { get; set; } public string[] Colors { get; set; } public AxisSetting AxisSettings { get; set; } public string XType { get; set; } public bool YAxisMultiSelect { get; set; } public Guid XAxisSectionItemGuid { get; set; } public List YAxisSectionItemGuids { get; set; } = new List(); public StrataSphereAdHocReportConfig(BaseConfig source) { if (source == null) return; Title = source.Title; Description = source.Description; Colors = source.Colors; AxisSettings = source.AxisSettings; XType = source.XType; YAxisMultiSelect = source.YAxisMultiSelect; } public BaseConfig GetChartConfig() { var chartConfig = default(BaseConfig); // Try decoding the xType by the name first var asm = typeof(AreaConfig).Assembly; var type = asm.GetType($"{asm.GetName().Name}.Reporting.ChartConfigs.{XType}"); if (type != null) { chartConfig = (BaseConfig)Activator.CreateInstance(type); } else // if that failed then use the hard coded selector, this is an issue if new types are supported { switch (XType) { case "AreaConfig": chartConfig = new AreaConfig(); break; case "BarConfig": chartConfig = new BarConfig(); break; case "BubbleConfig": chartConfig = new BubbleConfig(); break; case "ColumnConfig": chartConfig = new ColumnConfig(); break; case "ComboColumnAndLineConfig": chartConfig = new ComboColumnAndLineConfig(); break; case "ComboColumnAndLineWithSecondaryAxisConfig": chartConfig = new ComboColumnAndLineWithSecondaryAxisConfig(); break; case "DonutConfig": chartConfig = new DonutConfig(); break; case "LineConfig": chartConfig = new LineConfig(); break; case "PieConfig": chartConfig = new PieConfig(); break; case "ScatterConfig": chartConfig = new ScatterConfig(); break; case "SplineConfig": chartConfig = new SplineConfig(); break; case "StackedBarConfig": chartConfig = new StackedBarConfig(); break; case "StackedBarPercentConfig": chartConfig = new StackedBarPercentConfig(); break; case "StackedColumnConfig": chartConfig = new StackedColumnConfig(); break; case "StackedColumnPercentConfig": chartConfig = new StackedColumnPercentConfig(); break; } } if (chartConfig == null) return chartConfig; chartConfig.Title = Title; chartConfig.Description = Description; chartConfig.Colors = Colors; chartConfig.AxisSettings = AxisSettings; if (chartConfig is XYConfig xyConfig) { xyConfig.XAxisSectionItemGuid = XAxisSectionItemGuid; xyConfig.YAxisSectionItemGuids.AddRange(YAxisSectionItemGuids); } return chartConfig; } } internal class StrataSphereAdHocReportDataSource { public StrataSphereAdHocReportDataSource() { } public StrataSphereAdHocReportDataSource(IDataSourceLink dataSourceLink) { DataSourceGuid = dataSourceLink.DataSourceGUID; Name = dataSourceLink.DataSourceProvider.Name; DataSourceType = (int)dataSourceLink.DataSourceProvider.DataSourceType; } public Guid DataSourceGuid { get; set; } public string Name { get; set; } public int DataSourceType { get; set; } } internal class StrataSphereAdHocReportMeasure : IStrataSphereAdHocReportSectionItem { public StrataSphereAdHocReportMeasure() { } public StrataSphereAdHocReportMeasure(IAdHocReportSectionMeasure measure) { MeasureId = measure.MeasureID; Index = measure.DisplayOrder; Name = measure.Name; DisplayFormat = measure.DisplayFormat; ColumnWidth = measure.ColumnWidth; } public string MeasureId { get; set; } public string Name { get; set; } public int Index { get; set; } public string DisplayFormat { get; set; } public int ColumnWidth { get; set; } public bool IsOnChartXAxis { get; set; } public bool IsOnChartYAxis { get; set; } // section level filters public List Parameters { get; set; } = new List(); public List ConditionalFormats { get; set; } = new List(); } internal class StrataSphereAdHocReportSection { public StrataSphereAdHocReportSection() { } public StrataSphereAdHocReportSection(IReportDataGenerationSection section) { Name = section.Name; DisplayOrder = section.DisplayOrder; IsOnColumn = section.IsOnColumn; IsTimeRelative = section.IsTimeRelative; IsFinancialReportSectionHidable = section.IsFinancialReportSectionHidable; IsMergingRepeatHeader = section.IsMergingRepeatHeader; IsSpaceAbove = section.IsSpaceAbove; IsHidden = section.IsHidden; DisplayLabel = section.DisplayText; ShowSectionLabel = section.ShowSectionLabel; ShowGrandTotal = section.ShowGrandTotal; ShowMargin = section.ShowMargin; } public string Name { get; set; } public bool IsOnColumn { get; set; } public int DisplayOrder { get; set; } public bool IsTimeRelative { get; set; } public bool IsFinancialReportSectionHidable { get; set; } public bool IsMergingRepeatHeader { get; set; } public bool IsSpaceAbove { get; set; } public bool IsHidden { get; set; } public string DisplayLabel { get; set; } public bool ShowSectionLabel { get; set; } public bool ShowGrandTotal { get; set; } public bool IsAutoNameFilter { get; set; } public bool ShowMargin { get; set; } public List Attributes { get; set; } = new List(); public List Measures { get; set; } = new List(); public List Calculations { get; set; } = new List(); } internal class StrataSphereAdHocReportSetup { public string Style { get; set; } public StrataSphereAdHocReportSortArgs SortArgs { get; set; } public List DataSources { get; set; } = new List(); public StrataSphereAdHocReportConfig ChartConfig { get; set; } = null; public List Sections { get; set; } = new List(); public List Parameters { get; set; } = new List(); public List ServiceLines { get; set; } = new List(); } public class StrataSphereAdHocReportSortArgs { public StrataSphereAdHocReportTupleInfo TupleInfo { get; set; } public bool IsAscending { get; set; } public int SortCount { get; set; } public int Top { get; set; } public bool IsTopPercent { get; set; } public bool IsIncludeAllOthers { get; set; } public StrataSphereAdHocReportSortArgs() { TupleInfo = new StrataSphereAdHocReportTupleInfo(); } public StrataSphereAdHocReportSortArgs(IReportDataGenerationSetup reportSetup) : this() { if (reportSetup.SortArgs == null) return; TupleInfo = new StrataSphereAdHocReportTupleInfo(reportSetup); IsAscending = reportSetup.SortArgs.IsAscending; SortCount = reportSetup.SortArgs.SortCount; Top = reportSetup.SortArgs.Top; IsTopPercent = reportSetup.SortArgs.IsTopPercent; IsIncludeAllOthers = reportSetup.SortArgs.IsIncludeAllOthers; } public static implicit operator ReportSortArgs(StrataSphereAdHocReportSortArgs sortArgs) { var result = sortArgs.TupleInfo != null ? new ReportSortArgs(sortArgs.TupleInfo) : new ReportSortArgs(); result.IsAscending = sortArgs.IsAscending; result.SortCount = sortArgs.SortCount; result.Top = sortArgs.Top; result.IsTopPercent = sortArgs.IsTopPercent; result.IsIncludeAllOthers = sortArgs.IsIncludeAllOthers; return result; } } public class StrataSphereAdHocReportTupleInfo { public Dictionary PartialRowTuple { get; set; } public Dictionary PartialColTuple { get; set; } public string MainMeasureName { get; private set; } public string RowMeasureName { get; set; } public string ColMeasureName { get; set; } public Guid ColMeasureGUID { get; set; } public string FormatString { get; set; } public int rowIndex { get; set; } public int colIndex { get; set; } public Guid ColumnSectionGUID { get; set; } public IAdHocReportSectionMeasure MainMeasure { get; set; } public StrataSphereAdHocReportTupleInfo() { PartialRowTuple = new Dictionary(); PartialColTuple = new Dictionary(); ColumnSectionGUID = Guid.Empty; ColMeasureGUID = Guid.Empty; } private IAdHocReportSectionMeasure _mainMeasure; protected virtual IAdHocReportSectionMeasure InMemoryMeasure { get { if (_mainMeasure != null) return _mainMeasure; _mainMeasure = new InMemoryReportMeasure { ColumnName = string.IsNullOrEmpty(RowMeasureName) ? RowMeasureName : ColMeasureName }; return _mainMeasure; } } public StrataSphereAdHocReportTupleInfo(ReportTupleInfo tupleInfo) : this() { if (tupleInfo == null) return; tupleInfo.PartialRowTuple.Keys.ToList() .ForEach(key => PartialRowTuple.Add(key, tupleInfo.PartialRowTuple[key])); tupleInfo.PartialColTuple.Keys.ToList() .ForEach(key => PartialColTuple.Add(key, tupleInfo.PartialColTuple[key])); //MainMeasure = tupleInfo.MainMeasure; MainMeasureName = tupleInfo.MainMeasureName; RowMeasureName = tupleInfo.RowMeasureName; ColMeasureName = tupleInfo.ColMeasureName; ColMeasureGUID = tupleInfo.ColMeasureGUID; FormatString = tupleInfo.FormatString; rowIndex = tupleInfo.rowIndex; colIndex = tupleInfo.colIndex; ColumnSectionGUID = tupleInfo.ColumnSectionGUID; } public StrataSphereAdHocReportTupleInfo(IReportDataGenerationSetup reportSetup) : this(reportSetup.SortArgs.TupleInfo) { if (reportSetup.SortArgs.TupleInfo?.MainMeasure == null) return; switch (reportSetup) { case DSCubeReportSetup cubeReportSetup: MainMeasure = cubeReportSetup.SortArgs.TupleInfo.MainMeasure as DSCubeReportSectionMeasure; break; case ClientReportSetup clientReportSetup: MainMeasure = clientReportSetup.SortArgs.TupleInfo.MainMeasure as ClientReportSectionMeasure; break; default: MainMeasure = InMemoryMeasure; break; } switch (MainMeasure) { case DSCubeReportSectionMeasure cubeMeasure: cubeMeasure.Re portSetup = null; break; case ClientReportSectionMeasure clientMeasure: clientMeasure.ReportSetup = null; break; } } public static implicit operator ReportTupleInfo(StrataSphereAdHocReportTupleInfo tupleInfo) { if (tupleInfo == null) return null; var result = new ReportTupleInfo { PartialRowTuple = new Dictionary(), PartialColTuple = new Dictionary(), MainMeasure = tupleInfo.MainMeasure?.CopyMeasure(), RowMeasureName = tupleInfo.RowMeasureName, ColMeasureName = tupleInfo.ColMeasureName, ColMeasureGUID = tupleInfo.ColMeasureGUID, FormatString = tupleInfo.FormatString, rowIndex = tupleInfo.rowIndex, colIndex = tupleInfo.colIndex, ColumnSectionGUID = tupleInfo.ColumnSectionGUID }; tupleInfo.PartialRowTuple.Keys.ToList() .ForEach(key => result.PartialRowTuple.Add(key, tupleInfo.PartialRowTuple[key])); tupleInfo.PartialColTuple.Keys.ToList() .ForEach(key => result.PartialColTuple.Add(key, tupleInfo.PartialColTuple[key])); return result; } } #endregion #region Other Stuff public interface IReportDataGenerationSection : IStrataTreeNode { bool IsDeleted { get; } IReportDataGenerationSetup ReportSetup { get; } ITGuid ReportSectionGUIDTyped { get; } Guid SectionGUID { get; } string Name { get; } bool IsOnColumn { get; } int DisplayOrder { get; } bool IsTimeRelative { get; } bool IsFinancialReportSectionHidable { get; } bool IsMergingRepeatHeader { get; } bool IsSpaceAbove { get; } void AddAttribute(IAdHocReportSectionAttribute attr); bool RemoveAttribute(IAdHocReportSectionAttribute attr); void RemoveAttributeAt(int attrIndex); void AddMeasure(IAdHocReportSectionMeasure meas); bool RemoveMeasure(IAdHocReportSectionMeasure meas); void RemoveMeasureAt(int attrIndex); void AddCalculation(IAdHocReportSectionCalculation calc); bool RemoveCalculation(IAdHocReportSectionCalculation calc); void RemoveCalculationAt(int calcIndex); IEnumerable Calculations { get; } IEnumerable Attributes { get; } IEnumerable Measures { get; } IEnumerable GetAdditionalSelectColumns(); IEnumerable GetCostMeasureFilter(); IList GetValidVisibleAttributes(bool isDrillDown); void RefreshVisibilityStatuses(IAdHocReportSectionAttribute drilledAttr, eReportDrilldownStatus ddStatus); List ChildMeasuresAndCalcs { get; } List VisibleMeasuresAndCalcs { get; } IAdHocReportSectionMeasure GetPrimaryMeasureForUseInCalculation(); List GetAllSectionItems { get; } IEnumerable GetExtractAttributes(); List GetAllSectionItemGUIDs(); bool HasParameters(); void RefreshDrilldownStatuses(); void HidePartiallyVisibleItems(); #region " Rendering " bool IsHidden { get; } bool ShowSectionLabel { get; } bool ShowGrandTotal { get; set; } string GrandTotalDisplayTextOverride { get; } string GrandTotalDisplayFormatOverride { get; } bool ShowMargin { get; } string SectionLabelCSSClassName { get; } #endregion } public class ReportTupleInfo { public ReportTupleInfo() { this.PartialRowTuple = new Dictionary(); this.PartialColTuple = new Dictionary(); } [NonSerialized] private IReportTupleFactory _TupleFactory; public IReportTupleFactory TupleFactory { get { return _TupleFactory; } set { _TupleFactory = value; } } private Dictionary _Tuple; public Dictionary Tuple { get { if (_Tuple == null) { RefreshTuple(); } return _Tuple; } set { _Tuple = value; } } [DataMember] public Dictionary PartialRowTuple { get; set; } [DataMember] public Dictionary PartialColTuple { get; set; } [DataMember] public string MainMeasureName { get; private set; } private IAdHocReportSectionMeasure _MainMeasure; public IAdHocReportSectionMeasure MainMeasure { get { return _MainMeasure; } set { _MainMeasure = value; MainMeasureName = (value == null) ? string.Empty : value.ColumnName; } } [DataMember] public string RowMeasureName { get; set; } [DataMember] public string ColMeasureName { get; set; } [DataMember] public Guid ColMeasureGUID { get; set; } [DataMember] public string FormatString { get; set; } [DataMember] public int rowIndex { get; set; } [DataMember] public int colIndex { get; set; } [DataMember] public Guid ColumnSectionGUID { get; set; } public Dictionary RefreshTuple() { _Tuple = new Dictionary(); if (PartialRowTuple != null) { _Tuple.MergeUnsafe(PartialRowTuple); } if (PartialColTuple != null) { _Tuple.Merge(PartialColTuple); } return _Tuple; } public ReportTupleInfo MakeCopy() { var copy = new ReportTupleInfo() { TupleFactory = this.TupleFactory, PartialColTuple = new Dictionary(this.PartialColTuple), PartialRowTuple = new Dictionary(this.PartialRowTuple), MainMeasure = this.MainMeasure, RowMeasureName = this.RowMeasureName, ColMeasureName = this.ColMeasureName, ColMeasureGUID = this.ColMeasureGUID, ColumnSectionGUID = this.ColumnSectionGUID, FormatString = this.FormatString, rowIndex = this.rowIndex, colIndex = this.colIndex }; return copy; } public void MergeTuples(ReportTupleInfo tupleToMerge) { PartialColTuple = (Dictionary)PartialColTuple.MergeCopy(tupleToMerge.PartialColTuple); PartialRowTuple = (Dictionary)PartialRowTuple.MergeCopy(tupleToMerge.PartialRowTuple); RefreshTuple(); } public override bool Equals(object obj) { if (!(obj is ReportTupleInfo)) { return false; } var y = (ReportTupleInfo)obj; if (this.MainMeasure == null) { return false; } if (!this.MainMeasure.ID.Equals(y.MainMeasure.ID)) { return false; } if (!this.Tuple.ValueEquals(y.Tuple)) { return false; } return true; } public override int GetHashCode() { return base.GetHashCode(); //not sure how else we can do GetHashCode without being super slow so we will need the base class decide } } public interface IAdHocReportSectionAttribute : IAdHocReportSectionItem { ITGuid AttributeGUIDTyped { get; } string DimensionID { get; } string AttributeID { get; } bool ShowSubtotal { get; set; } SortOrder SortOrder { get; } eClientReportVisibilityStatus VisibilityStatus { get; set; } eReportDrilldownStatus DrilldownStatus { get; set; } string FilterMemberCSV { get; set; } List FilterMembers { get; set; } List FilterMembersVisible { get; } } public interface IAdHocReportSectionItem //: IDisplayOrder, IStrataTreeNode { Guid ReportSectionGUID { get; } Guid ReportSectionItemGUID { get; } string Name { get; set; } string ColumnName { get; } bool IsHidden { get; } bool IsDeleted { get; } eClientReportSectionItemType ItemType { get; } void SetID(Guid newGUID); int ColumnWidth { get; set; } string DetailReportGUIDsCSV { get; } Guid BeforeCopyGUID { get; set; } } public interface ITGuid { Guid Value { get; set; } bool IsEmpty { get; set; } } public enum eClientReportSectionItemType { Attribute = 0, Hierarchy = 1, Measure = 2, Calculation = 3 } public enum eReportDrilldownStatus { None = 0, Drilldown = 1, Drillup = 2 } public enum eClientReportVisibilityStatus { Hidden = 0, CompletelyVisible = 1, PartiallyVisible = 2 } #endregion