155 lines
5.4 KiB
C#
155 lines
5.4 KiB
C#
<Query Kind="Program">
|
|
<Connection>
|
|
<ID>580b3b8d-cc02-4a68-8fbd-d1ec374a25f2</ID>
|
|
<Persist>true</Persist>
|
|
<Server>D0001-sql-11.sdt.local</Server>
|
|
<Database>jazz dev master Prod</Database>
|
|
<ShowServer>true</ShowServer>
|
|
</Connection>
|
|
<Namespace>Newtonsoft.Json</Namespace>
|
|
<Namespace>Newtonsoft.Json.Linq</Namespace>
|
|
</Query>
|
|
|
|
void Main()
|
|
{
|
|
var oppGuid = Guid.Parse("ebe53c65-af17-4372-b7c1-18a6011f7d23");
|
|
var opp = from eo in EncounterOpportunities
|
|
where eo.OpportunityGUID == oppGuid
|
|
select eo;
|
|
|
|
var pti = from eopti in EncounterOpportunityPerformanceTrackingItems
|
|
where eopti.OpportunityGUID == oppGuid
|
|
orderby eopti.LevelID, eopti.Type
|
|
select new { performanceTrackingItem = JsonConvert.DeserializeObject<PerformanceTrackingItem>(eopti.PerformanceTrackingItem) };
|
|
|
|
var metrics = from eopemd in EncounterOpportunityPerformanceEngineMetricData
|
|
where eopemd.OpportunityGUID == oppGuid
|
|
orderby eopemd.LevelID, eopemd.IsBaseline, eopemd.Type
|
|
select new
|
|
{
|
|
eopemd.LevelID,
|
|
eopemd.Type,
|
|
eopemd.IsBaseline,
|
|
months = new[] {
|
|
new {Name = "Month01", Value = eopemd.Month01},
|
|
new {Name = "Month02", Value = eopemd.Month02},
|
|
new {Name = "Month03", Value = eopemd.Month03},
|
|
new {Name = "Month04", Value = eopemd.Month04},
|
|
new {Name = "Month05", Value = eopemd.Month05},
|
|
new {Name = "Month06", Value = eopemd.Month06},
|
|
new {Name = "Month07", Value = eopemd.Month07},
|
|
new {Name = "Month09", Value = eopemd.Month08},
|
|
new {Name = "Month09", Value = eopemd.Month09},
|
|
new {Name = "Month10", Value = eopemd.Month10},
|
|
new {Name = "Month11", Value = eopemd.Month11},
|
|
new {Name = "Month12", Value = eopemd.Month12}
|
|
}
|
|
};
|
|
|
|
//var jsonPti = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(pti[1]), Newtonsoft.Json.Formatting.Indented);
|
|
//jsonPti.Dump();
|
|
opp.Dump(nameof(EncounterOpportunities));
|
|
metrics.Dump(nameof(EncounterOpportunityPerformanceEngineMetricData));
|
|
pti.FirstOrDefault().Dump(nameof(EncounterOpportunityPerformanceTrackingItems));
|
|
}
|
|
|
|
// Define other methods and classes here
|
|
|
|
public class PerformanceMonthlyUnitData
|
|
{
|
|
public int MonthID { get; set; }
|
|
public double RampUp { get; set; }
|
|
public double Units { get; set; }
|
|
public double UnitsYTD { get; set; }
|
|
public double Stats { get; set; }
|
|
public double StatsYTD { get; set; }
|
|
|
|
/// <summary>
|
|
/// Units DivideBy Stats
|
|
/// </summary>
|
|
public double UnitsPerStat { get; set; }
|
|
public double UnitsPerStatYTD { get; set; }
|
|
}
|
|
|
|
public class PerformanceMonthlySavingsData : PerformanceMonthlyUnitData
|
|
{
|
|
public double Savings { get; set; }
|
|
public double SavingsYTD { get; set; }
|
|
}
|
|
|
|
public class YearMonth
|
|
{
|
|
public int FiscalYear { get; set; }
|
|
public int CalendarYear { get; set; }
|
|
|
|
public DateTime FiscalYearMonth { get; set; }
|
|
public DateTime CalendarYearMonth { get; set; }
|
|
|
|
public int FiscalYearID;
|
|
public int FiscalMonthID;
|
|
}
|
|
|
|
public class TrackingYearMonth : YearMonth
|
|
{
|
|
public bool IsAfterEffectiveDate { get; set; }
|
|
public bool IsBeforeTrackingDate { get; set; }
|
|
public bool IsCurrentMonth { get; set; }
|
|
public bool IsTrackedMonth { get; set; }
|
|
}
|
|
|
|
public interface IPerformanceTrackingMonth
|
|
{
|
|
TrackingYearMonth Month { get; set; }
|
|
double RampUp { get; set; }
|
|
double GoalUnits { get; set; }
|
|
double GoalUnitsYTD { get; set; }
|
|
double CommittedUnits { get; }
|
|
double CommittedUnitsYTD { get; set; }
|
|
double GoalUnitsOverall { get; set; }
|
|
double BaselineUnitsOverall { get; set; }
|
|
double BaselineStatsOverall { get; set; }
|
|
double TrackingUnitsOverall { get; set; }
|
|
double TrackingStatsOverall { get; set; }
|
|
PerformanceMonthlyUnitData BaselineMonthlyUnitData { get; set; }
|
|
PerformanceMonthlyUnitData TrackingMonthlyUnitData { get; set; }
|
|
PerformanceMonthlySavingsData GoalSavings { get; set; }
|
|
PerformanceMonthlySavingsData CommittedSavings { get; set; }
|
|
PerformanceMonthlySavingsData ActualSavings { get; set; }
|
|
double GoalUnitVariance { get; }
|
|
double ActualUnitVariance { get; }
|
|
double CommittedUnitVariance { get; }
|
|
double CommittedRate { get; }
|
|
}
|
|
|
|
public class PerformanceTrackingMonth : IPerformanceTrackingMonth
|
|
{
|
|
public TrackingYearMonth Month { get; set; }
|
|
public PerformanceMonthlyUnitData BaselineMonthlyUnitData { get; set; }
|
|
public PerformanceMonthlyUnitData TrackingMonthlyUnitData { get; set; }
|
|
public PerformanceMonthlySavingsData GoalSavings { get; set; }
|
|
public PerformanceMonthlySavingsData CommittedSavings { get; set; }
|
|
public PerformanceMonthlySavingsData ActualSavings { get; set; }
|
|
public double RampUp { get; set; }
|
|
public double BaselineUnitsOverall { get; set; }
|
|
public double BaselineStatsOverall { get; set; }
|
|
public double TrackingUnitsOverall { get; set; }
|
|
public double TrackingStatsOverall { get; set; }
|
|
public double GoalUnits { get; set; }
|
|
public double GoalUnitsYTD { get; set; }
|
|
public double GoalUnitsOverall { get; set; }
|
|
public double GoalUnitVariance { get; set; }
|
|
public double ActualUnitVariance { get; set; }
|
|
public double CommittedStats { get; set; }
|
|
public double CommittedUnits { get; set; }
|
|
public double CommittedUnitsYTD { get; set; }
|
|
public double CommittedUnitVariance { get; set; }
|
|
public double CommittedRate { get; set; }
|
|
}
|
|
|
|
public class PerformanceTrackingItem
|
|
{
|
|
public int GroupID { get; set; }
|
|
public string GroupName { get; set; }
|
|
|
|
public IEnumerable<PerformanceTrackingMonth> MonthlyTrackingData { get; set; }
|
|
} |