Files
linqpad/StarterSet API/Starter Set API With Report Setup.linq
T

908 lines
26 KiB
C#

<Query Kind="Program">
<Output>DataGrids</Output>
<NuGetReference>Newtonsoft.Json</NuGetReference>
<NuGetReference>RestSharp</NuGetReference>
<Namespace>RestSharp</Namespace>
<Namespace>Newtonsoft.Json.Converters</Namespace>
<Namespace>Newtonsoft.Json</Namespace>
<Namespace>System.Dynamic</Namespace>
</Query>
private string BaseUrl =
//"https://starterset-api.dev.k8s.sdt.local/api/v1/";
"https://localhost:44325/api/v1/";
void Main()
{
RestClient client = new RestClient();
var reports = GetList<ReportDto>(client, "Reports");
var rpts = reports
.Where(r => r.Name.StartsWith("TL Fiscal Month Test"))
.OrderBy(r => r.Name)
.ToList()
.Select(rpt => new { rpt.Id, rpt.Name, setup = GetList(client, $"Reports\\{rpt.Id}\\Setup") })
//.Where(x => ((IDictionary<String, object>)x.setup).ContainsKey("ServiceLines"))
;
rpts.Dump(nameof(rpts),6);
var definitions = GetList<DefinitionDto>(client, "Definitions")
.Where(dd => dd.DimensionId == "e18e27ea-52ec-4793-9209-c6259c78474a"
|| dd.DimensionId == "Fiscan Month");
definitions.Dump();
/*
var setups = rpts.Select(r => r.setup);
setups.Dump(nameof(setups));
var serviceLines = setups.Where(x => ((IDictionary<String, object>)x).ContainsKey("ServiceLines"))
.SelectMany(s => ((List<Object>)s.ServiceLines)
.Select(x => x));
serviceLines.Dump(nameof(serviceLines));
var dataSources = setups.SelectMany(s => ((List<Object>)s.DataSources)
.Select(x => JsonConvert.DeserializeObject<StrataSphereAdHocReportDataSource>(JsonConvert.SerializeObject(x))))
.GroupBy(ds => ds.DataSourceGuid, (g, d) => d.First());
dataSources.Dump(nameof(dataSources));
// var globalParameters = setups.SelectMany(s => ((List<Object>)s.Parameters)
// .Select(x => JsonConvert.DeserializeObject<StrataSphereAdHocReportParameter>(JsonConvert.SerializeObject(x))));
// globalParameters.Dump(nameof(globalParameters));
var sections = setups.SelectMany(s => ((List<Object>)s.Sections)
.Select(x => JsonConvert.DeserializeObject<StrataSphereAdHocReportSection>(JsonConvert.SerializeObject(x))));
var attributes = sections.SelectMany(s => s.Attributes)
.Select(x => JsonConvert.DeserializeObject<StrataSphereAdHocReportAttribute>(JsonConvert.SerializeObject(x)));
attributes.Dump(nameof(attributes));
var attrParms = attributes.SelectMany(a => a.Parameters);
attrParms.Dump(nameof(attrParms));
var calculations = sections.SelectMany(s => s.Calculations)
.Select(x => JsonConvert.DeserializeObject<StrataSphereAdHocReportCalculation>(JsonConvert.SerializeObject(x)));
calculations.Dump(nameof(calculations));
*/
}
dynamic GetList(RestClient client, string something)
{
client.BaseUrl = new Uri(BaseUrl + something);
RestRequest request = new RestRequest();
request.Method = Method.GET;
var converter = new ExpandoObjectConverter();
return JsonConvert.DeserializeObject<ExpandoObject>(client.Execute(request).Content, converter);
}
//void other()
//{
// StandardDefinitionMappings.Select(sdm => new
// {
// sdm.MappingId,
// sdm.StandardDefinitionGUID,
// sdm.StandardDefinitionType,
// MappingMemberValue = JsonConvert.DeserializeObject<StrataSphereMappingValues>(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<T> GetList<T>(RestClient client, string something)
{
return Get<List<T>>(client, something);
}
T Get<T>(RestClient client, string something)
{
client.BaseUrl = new Uri(BaseUrl + something);
RestRequest request = new RestRequest();
request.Method = Method.GET;
return JsonConvert.DeserializeObject<T>(client.Execute(request).Content,
new JsonSerializerSettings
{
Error = delegate (object sender, Newtonsoft.Json.Serialization.ErrorEventArgs args)
{
args.ErrorContext.Error.Message.Dump();
args.ErrorContext.Handled = true;
}
});
}
void stuff(RestClient client)
{
client.BaseUrl = new Uri(BaseUrl + "Definitions");
RestRequest request = new RestRequest();
request.Method = Method.GET;
var definitions = JsonConvert.DeserializeObject<List<DefinitionDto>>(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<List<MDXScoreToCubeDto>>(client.Execute(request).Content);
mdx.Dump("MDX");
client.BaseUrl = new Uri(BaseUrl + "Reports");
var reports = JsonConvert.DeserializeObject<List<ReportDto>>(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<ReportDto>(client.Execute(request).Content);
rpt.DefinitionIds.ForEach(d =>
{
client.BaseUrl = new Uri(BaseUrl + $"Defintions/{d}");
var definition = JsonConvert.DeserializeObject<List<DefinitionDto>>(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 = $"<root>{ParameterXML}</root>"
.RemoveAllNamespacesAsString()
.Replace("string>", "valueId>")
.Replace("<Value2 i:nil=\"true\" />", "<Value2 />")
.Replace("<_", "<").Replace("</_", "</")
.Replace("p5:nil=\"true\" xmlns:p5=\"http://www.w3.org/2001/XMLSchema-instance\"", "");
XmlDocument doc = new XmlDocument();
doc.LoadXml(parameterXml);
Parameter = JsonConvert.SerializeObject(
JsonConvert.DeserializeObject<dynamic>(
JsonConvert.SerializeXmlNode(doc.SelectSingleNode("root")
)
)
,
Newtonsoft.Json.Formatting.Indented);
}
}
public class StrataSphereMappingValues
{
public string HierarchyGUID { get; set; }
public string DimensionGUID { get; set; }
public List<string> values { get; set; }
public List<MappingValue> mappings { get; set; }
public List<string> hierarchyPaths { get; set; }
public StrataSphereMappingValues()
{
mappings = new List<MappingValue>();
}
}
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<object> attributeValues { get; set; }
public List<string> hierarchyPaths { get; set; }
public MappingValue()
{
attributeValues = new List<object>();
hierarchyPaths = new List<string>();
}
}
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<Guid> DefinitionIds { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateLastModified { get; set; }
public int DownloadCount { get; set; }
public ReportDto()
{
ReportSetupJson = "{}";
DefinitionIds = new List<Guid>();
}
}
public class DefinitionDto
{
public Guid Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public Guid HierarchyGuid { get; set; }
public Guid DimensionGuid { get; set; }
public Guid AttributeGuid { get; set; }
public string HierarchyId { get; set; }
public string DimensionId { get; set; }
public string AttributeId { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateLastModified { get; set; }
}
public enum MDXMemberIDTypeEnum
{
Attribute,
Name,
Text,
Id,
HierarchyPath
}
public enum MDXFormatTypeEnum
{
None,
MDX,
Hierarchy,
MDXMemberId
}
public class MDXScoreToCubeDto
{
public string OrgPin { get; set; }
public Guid DatabaseGuid { get; set; }
public string ScoreDimensionName { get; set; }
public string ScoreHierarchyName { get; set; }
public string CubeDimensionName { get; set; }
public string CubeHierarchyName { get; set; }
public MDXMemberIDTypeEnum MDXMemberIDType { get; set; }
public MDXFormatTypeEnum MDXFormatType { get; set; }
}
public class ValueIDArray
{
public List<string> 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 string AttributeId { get; set; }
public string DimensionId { get; set; }
public int Index { get; set; }
public string Name { get; set; }
public IList<string> 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<object> Parameters { get; set; } = new List<object>();
//public List<StrataSphereAdHocReportParameter> Parameters { get; set; } = new List<StrataSphereAdHocReportParameter>();
}
internal class StrataSphereAdHocReportCalculation : IStrataSphereAdHocReportSectionItem
{
public StrataSphereAdHocReportCalculation()
{
}
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<StrataSphereAdHocReportConditionalFormat> ConditionalFormats { get; set; } = new List<StrataSphereAdHocReportConditionalFormat>();
}
internal class StrataSphereAdHocReportConditionalFormat
{
public StrataSphereAdHocReportConditionalFormat()
{
}
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<Guid> YAxisSectionItemGuids { get; set; } = new List<Guid>();
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 Guid DataSourceGuid { get; set; }
public string Name { get; set; }
public int DataSourceType { get; set; }
}
internal class StrataSphereAdHocReportMeasure : IStrataSphereAdHocReportSectionItem
{
public StrataSphereAdHocReportMeasure()
{
}
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<StrataSphereAdHocReportParameter> Parameters { get; set; } = new List<StrataSphereAdHocReportParameter>();
public List<StrataSphereAdHocReportConditionalFormat> ConditionalFormats { get; set; } = new List<StrataSphereAdHocReportConditionalFormat>();
}
internal class StrataSphereAdHocReportSection
{
public StrataSphereAdHocReportSection()
{
}
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<object> Attributes { get; set; } = new List<object>();
public List<object> Measures { get; set; } = new List<object>();
public List<object> Calculations { get; set; } = new List<object>();
}
internal class StrataSphereAdHocReportSetup
{
public string Style { get; set; }
public StrataSphereAdHocReportSortArgs SortArgs { get; set; }
public List<StrataSphereAdHocReportDataSource> DataSources { get; set; } = new List<StrataSphereAdHocReportDataSource>();
public StrataSphereAdHocReportConfig ChartConfig { get; set; } = null;
public List<StrataSphereAdHocReportSection> Sections { get; set; } = new List<StrataSphereAdHocReportSection>();
public List<StrataSphereAdHocReportParameter> Parameters { get; set; } = new List<StrataSphereAdHocReportParameter>();
public List<StrataSphereAdHocScoreDimensionInfo> ServiceLines { get; set; } =
new List<StrataSphereAdHocScoreDimensionInfo>();
}
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 class StrataSphereAdHocReportTupleInfo
{
public Dictionary<string, string> PartialRowTuple { get; set; }
public Dictionary<string, string> 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<string, string>();
PartialColTuple = new Dictionary<string, string>();
ColumnSectionGUID = Guid.Empty;
ColMeasureGUID = Guid.Empty;
}
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 static implicit operator ReportTupleInfo(StrataSphereAdHocReportTupleInfo tupleInfo)
{
if (tupleInfo == null) return null;
var result = new ReportTupleInfo
{
PartialRowTuple = new Dictionary<string, string>(),
PartialColTuple = new Dictionary<string, string>(),
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;
}
}
internal interface IStrataReportParameter
{
string DimensionId { get; set; }
string AttributeId { get; set; }
}
internal abstract class StrataSphereAdHocReportParameter : IStrataReportParameter
{
protected StrataSphereAdHocReportParameter()
{
}
public string Name { get; set; }
public string DimensionId { get; set; }
public string AttributeId { get; set; }
public string MeasureId { get; set; }
public int DisplayOrder { get; set; }
public bool IsUserEditable { get; set; }
public bool IsAttributeParameter => string.IsNullOrWhiteSpace(MeasureId);
}
public class StrataSphereAdHocScoreDimensionInfo
{
public Guid DimensionGUID { get; set; }
public string FriendlyName { get; set; }
public string GlobalID { get; set; }
public string AttributeId { get; set; }
public string MDXMemberID { get; set; }
public bool IsRollup { get; set; }
internal Regex ServiceLineRegex = new Regex(@"^Service Line (\d)$", RegexOptions.IgnoreCase);
// internal string MDXMemberName => AnalysisServicesUtils.GetHierarchyMDXName("Patient Encounter",
// ServiceLineRegex.IsMatch(FriendlyName) && IsRollup
// ? $"{ServiceLineRegex.Replace(FriendlyName, "Service Line Rollup ${1}")}"
// : $"{FriendlyName}{(IsRollup ? " Rollup" : "")}");
internal string Name => $"Patient Encounter - {FriendlyName}{(IsRollup ? " Rollup" : "")}";
internal StrataSphereAdHocScoreDimensionInfo()
{
MDXMemberID = string.Empty;
IsRollup = false;
}
}
#endregion
#region Other Stuff
public interface IAdHocReportSectionMeasure //: IAdHocReportSectionItem
{
string ColumnName { get; set; }
string DisplayFormat { get; }
string CSSClass { get; }
List<Guid> LinkedSectionGUIDs { get; }
void Hide();
string MeasureID { get; }
bool IsPartial { get; }
bool IsAttributeMember { get; }
eAggregateFunction AggregationTypeEnum { get; }
IAdHocReportSectionMeasure CopyMeasure();
}
public interface ITGuid<T>
{
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
}
public enum eAggregateFunction
{
Sum = 0,
Count = 1,
Avg = 2,
Min = 3,
Max = 4,
None = 5
}
public interface IAdHocReportSectionAttribute //: IAdHocReportSectionItem
{
ITGuid<IAdHocReportSectionAttribute> 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<string> FilterMembers { get; set; }
List<string> FilterMembersVisible { get; }
}
public class ReportTupleInfo
{
public ReportTupleInfo()
{
this.PartialRowTuple = new Dictionary<string, string>();
this.PartialColTuple = new Dictionary<string, string>();
}
private Dictionary<string, string> _Tuple;
public Dictionary<string, string> Tuple
{
get
{
return _Tuple;
}
set { _Tuple = value; }
}
public Dictionary<string, string> PartialRowTuple { get; set; }
public Dictionary<string, string> PartialColTuple { get; set; }
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;
}
}
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 class AxisSetting
{
public string XAxisLabel { get; set; }
public string YAxisLabel { get; set; }
public double? YAxisLowerBound { get; set; }
public double? YAxisUpperBound { get; set; }
public double? YAxisTickInterval { get; set; }
public double? YAxisPlotLineValue { get; set; }
public bool ShowDataLabel { get; set; }
public override bool Equals(object obj)
{
var config = (AxisSetting)obj;
if (config == null) return false;
if (config.XAxisLabel != this.XAxisLabel) return false;
if (config.YAxisLabel != this.YAxisLabel) return false;
if (config.YAxisLowerBound != this.YAxisLowerBound) return false;
if (config.YAxisUpperBound != this.YAxisUpperBound) return false;
if (config.YAxisTickInterval != this.YAxisTickInterval) return false;
if (config.YAxisPlotLineValue != this.YAxisPlotLineValue) return false;
if (config.ShowDataLabel != this.ShowDataLabel) return false;
return true;
}
}
public abstract class BaseConfig
{
public abstract DataTable GetData(object report);
public abstract string Name { get; }
public string Title { get; set; }
public string Description { get; set; }
public string[] Colors { get; set; }
public AxisSetting AxisSettings { get; set; }
public virtual string IconName { get { return ""; } }
public virtual string XType { get { return ""; } }
public virtual string SectionName { get { return ""; } }
public virtual int ColumnNumber { get { return -1; } }
public virtual int RowNumber { get { return -1; } }
public virtual bool YAxisMultiSelect { get { return true; } }
protected BaseConfig()
{
this.Colors = new string[] { };
this.AxisSettings = new AxisSetting();
}
public override bool Equals(object obj)
{
var config = (BaseConfig)obj;
if (config == null) return false;
if (config.Title != Title || config.Description != Description) return false;
if (config.Colors.Length != Colors.Length) return false;
if (config.Colors.Any(p => !Colors.Contains(p))) return false;
if (!config.AxisSettings.Equals(this.AxisSettings)) return false;
if (config.GetType().Name != this.GetType().Name) return false;
return true;
}
}
#endregion