public GraphWithTabularCompare<Platform, PlatformType> GetGraphWithPlatformCompare(Guid graphGuid, Guid applicationId,
DateTime dateStart, DateTime dateEnd)
{
GraphWithTabularCompare<Platform, PlatformType> graphWithPlatformCompare =
new GraphWithTabularCompare<Platform, PlatformType>();
try
{
Application applicationMain = this.applicationRepository.Find(applicationId);
IEnumerable<PlatformType> platformIdsToCompare = applicationMain.Platforms.Select(x => x.Type);
IEnumerable<Platform> platformsToCompare = this.platformRepository.FindAll();
platformsToCompare = platformsToCompare.Where(x => platformIdsToCompare.Contains(x.Type)).ToList();
if (platformsToCompare.Count() != 0)
{
graphWithPlatformCompare.Options = platformsToCompare.ToList();
graphWithPlatformCompare.Selected = platformsToCompare.Select(x => x.Type).Take(2).ToList();
graphWithPlatformCompare.Consume
(
this.GetGraphPlatform
(
graphGuid,
applicationId,
graphWithPlatformCompare.Selected,
dateStart,
dateEnd
)
);
graphWithPlatformCompare.Tabular = graphWithPlatformCompare.Data.Series;
}
else
{
graphWithPlatformCompare.NotEnoughData = true;
}
}
catch (BaseException)
{
throw;
}
catch (Exception ex)
{
throw new ServiceLayerException(ex);
}
return graphWithPlatformCompare;
}