AppActs.Client.Service.ReportService.GetGraphWithPlatformCompare C# (CSharp) Method

GetGraphWithPlatformCompare() public method

Gets the graph.
public GetGraphWithPlatformCompare ( System.Guid graphGuid, System.Guid applicationId, System.DateTime dateStart, System.DateTime dateEnd ) : PlatformType>.GraphWithTabularCompare
graphGuid System.Guid
applicationId System.Guid
dateStart System.DateTime
dateEnd System.DateTime
return PlatformType>.GraphWithTabularCompare
        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;
        }