public CompanyProfileDataItem GetCompanyProfile(string companyId) { Equity equity = edisRepo.getEquityById(companyId); DateTime? priceDate = edisRepo.GetLastPriceDateForEquity(companyId); CompanyProfileDataItem model = new CompanyProfileDataItem { id = equity.Id, ticker = equity.Ticker, fullName = equity.Name, closingPrice = equity.LatestPrice, sector = equity.Sector, priceDate = priceDate == null? DateTime.MinValue : (DateTime)priceDate, assetClass = equity.EquityType.ToString(), changeAmount = edisRepo.GetResearchValueForEquitySync(ResearchValueKeys.changeAmount, equity.Ticker) == null ? 0 : (double)edisRepo.GetResearchValueForEquitySync(ResearchValueKeys.changeAmount, equity.Ticker), changeRatePercentage = edisRepo.GetResearchValueForEquitySync(ResearchValueKeys.changeRatePercentage, equity.Ticker) == null ? 0 : (double)edisRepo.GetResearchValueForEquitySync(ResearchValueKeys.changeRatePercentage, equity.Ticker), weeksDifferenceAmount = (double)edisRepo.GetResearchValueForEquitySync(ResearchValueKeys.fivtyTwoWkHighPrice, equity.Ticker), weeksDifferenceRatePercentage = (double)(edisRepo.GetResearchValueForEquitySync(ResearchValueKeys.fivtyTwoWkLowPrice, equity.Ticker) / edisRepo.GetResearchValueForEquitySync(ResearchValueKeys.fivtyTwoWkHighPrice, equity.Ticker) == null ? 1 : edisRepo.GetResearchValueForEquitySync(ResearchValueKeys.fivtyTwoWkHighPrice, equity.Ticker)), suitabilityScore = equity.GetRating().TotalScore, suitsTypeOfClients = edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.suitsTypeOfClients, equity.Ticker), country = edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.Country, equity.Ticker), exchange = edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.Exchange, equity.Ticker), marketCapitalisation = edisRepo.GetResearchValueForEquitySync(ResearchValueKeys.MarketCap, equity.Ticker).ToString(), currencyType = edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.Currency, equity.Ticker), reasons = edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.reasons, equity.Ticker), companyBriefing = edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.companyBriefing, equity.Ticker), companyStrategies = edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.companyStrategies, equity.Ticker), investment = edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.investment, equity.Ticker), investmentName = edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.investmentName, equity.Ticker), indexData = new List<CompanyProfileIndexData>(), currentAnalysis = new CurrentAnalysisPayload { metaProperties = new List<AnalysisPayloadMetaProperty> { new AnalysisPayloadMetaProperty{propertyName="baseInformation",displayName="Base Information"}, new AnalysisPayloadMetaProperty{propertyName="morningstar",displayName="Morningstar"}, new AnalysisPayloadMetaProperty{propertyName="brokerX",displayName="Broker X"}, new AnalysisPayloadMetaProperty{propertyName="ASX200Accumulation",displayName="ASX 200 Accumulation"}, }, groups = new List<AnalysisPayloadGroupModel> { new AnalysisPayloadGroupModel{ name="Recommendation", data=new List<AnalysisPayloadGroupDataItem>{ new AnalysisPayloadGroupDataItem{ name= "Current Short Term Recommendation", baseInformation= edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.baseInformationShort, equity.Ticker), morningstar= edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.morningstarShort, equity.Ticker), brokerX= edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.brokerXShort, equity.Ticker), ASX200Accumulation= edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.ASX200AccumulationShort, equity.Ticker), },new AnalysisPayloadGroupDataItem{ name= "Current Long Term Recommendation", baseInformation= edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.baseInformationLong, equity.Ticker), morningstar= edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.morningstarLong, equity.Ticker), brokerX= edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.brokerXLong, equity.Ticker), ASX200Accumulation= edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.ASX200AccumulationLong, equity.Ticker), },new AnalysisPayloadGroupDataItem{ name= "Price Target", baseInformation= edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.baseInformationPrice, equity.Ticker), morningstar= edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.morningstarPrice, equity.Ticker), brokerX= edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.brokerXPrice, equity.Ticker), ASX200Accumulation= edisRepo.GetStringResearchValueForEquitySync(ResearchValueKeys.ASX200AccumulationPrice, equity.Ticker), }, } },new AnalysisPayloadGroupModel{ name="Income", data=new List<AnalysisPayloadGroupDataItem>{ new AnalysisPayloadGroupDataItem{ name= "Current Short Term Recommendation", baseInformation= "base information", morningstar= "Morning star information", brokerX= "brokerX information", ASX200Accumulation= "Accumulation Details" },new AnalysisPayloadGroupDataItem{ name= "Current Long Term Recommendation", baseInformation= "base information", morningstar= "Morning star information", brokerX= "brokerX information", ASX200Accumulation= "Accumulation Details" },new AnalysisPayloadGroupDataItem{ name= "Price Target", baseInformation= "base information", morningstar= "Morning star information", brokerX= "brokerX information", ASX200Accumulation= "Accumulation Details" }, } } } }, }; List<AssetPrice> assetPrices = edisRepo.getPricesByEquityIdAndDates(companyId, Period.LastSixMonths.ToString()); foreach(var price in assetPrices){ model.indexData.Add(new CompanyProfileIndexData { company = price.Price.Value, month = price.CreatedOn.Value.Date.ToString("yy-MM-dd"), date = (DateTime)price.CreatedOn }); } return model; //return advisorRepo.GetCompanyProfile(User.Identity.GetUserId(), companyId); }
public CompanyProfileDataItem GetCompanyProfile(string companyId) { Equity equity = edisRepo.GetAllEquities().SingleOrDefault(eq => eq.Id == companyId); CompanyProfileDataItem model = new CompanyProfileDataItem { id = equity.Id, ticker = equity.Ticker, fullName = equity.Name, closingPrice = equity.LatestPrice, sector = equity.Sector, assetClass = equity.EquityType.ToString(), changeAmount = edisRepo.GetResearchValueForEquitySync("changeAmount", equity.Ticker) == null ? 0 : (double)edisRepo.GetResearchValueForEquitySync("changeAmount", equity.Ticker), changeRatePercentage = edisRepo.GetResearchValueForEquitySync("changeRatePercentage", equity.Ticker) == null ? 0 : (double)edisRepo.GetResearchValueForEquitySync("changeRatePercentage", equity.Ticker), weeksDifferenceAmount = edisRepo.GetResearchValueForEquitySync("weeksDifferenceAmount", equity.Ticker) == null ? 0 : (double)edisRepo.GetResearchValueForEquitySync("weeksDifferenceAmount", equity.Ticker), weeksDifferenceRatePercentage = edisRepo.GetResearchValueForEquitySync("weeksDifferenceRatePercentage", equity.Ticker) == null ? 0 : (double)edisRepo.GetResearchValueForEquitySync("weeksDifferenceRatePercentage", equity.Ticker), suitabilityScore = edisRepo.GetResearchValueForEquitySync("suitabilityScore", equity.Ticker) == null ? 0 : (double)edisRepo.GetResearchValueForEquitySync("suitabilityScore", equity.Ticker), suitsTypeOfClients = edisRepo.GetStringResearchValueForEquitySync("suitsTypeOfClients", equity.Ticker), country = edisRepo.GetStringResearchValueForEquitySync("country", equity.Ticker), exchange = edisRepo.GetStringResearchValueForEquitySync("exchange", equity.Ticker), marketCapitalisation = edisRepo.GetStringResearchValueForEquitySync("marketCapitalisation", equity.Ticker), currencyType = edisRepo.GetStringResearchValueForEquitySync("currencyType", equity.Ticker), reasons = edisRepo.GetStringResearchValueForEquitySync("reasons", equity.Ticker), companyBriefing = edisRepo.GetStringResearchValueForEquitySync("companyBriefing", equity.Ticker), companyStrategies = edisRepo.GetStringResearchValueForEquitySync("companyStrategies", equity.Ticker), investment = edisRepo.GetStringResearchValueForEquitySync("investment", equity.Ticker), investmentName = edisRepo.GetStringResearchValueForEquitySync("investmentName", equity.Ticker), //priceDate = DateTime.Now, currentAnalysis = new CurrentAnalysisPayload { metaProperties = new List<AnalysisPayloadMetaProperty> { new AnalysisPayloadMetaProperty{propertyName="baseInformation",displayName="Base Information"}, new AnalysisPayloadMetaProperty{propertyName="morningstar",displayName="Morningstar"}, new AnalysisPayloadMetaProperty{propertyName="brokerX",displayName="Broker X"}, new AnalysisPayloadMetaProperty{propertyName="ASX200Accumulation",displayName="ASX 200 Accumulation"}, }, groups = new List<AnalysisPayloadGroupModel> { new AnalysisPayloadGroupModel{ name="Recommendation", data=new List<AnalysisPayloadGroupDataItem>{ new AnalysisPayloadGroupDataItem{ name= "Current Short Term Recommendation", baseInformation= edisRepo.GetStringResearchValueForEquitySync("baseInformationShort", equity.Ticker), morningstar= edisRepo.GetStringResearchValueForEquitySync("morningstarShort", equity.Ticker), brokerX= edisRepo.GetStringResearchValueForEquitySync("brokerXShort", equity.Ticker), ASX200Accumulation= edisRepo.GetStringResearchValueForEquitySync("ASX200AccumulationShort", equity.Ticker), },new AnalysisPayloadGroupDataItem{ name= "Current Long Term Recommendation", baseInformation= edisRepo.GetStringResearchValueForEquitySync("baseInformationLong", equity.Ticker), morningstar= edisRepo.GetStringResearchValueForEquitySync("morningstarLong", equity.Ticker), brokerX= edisRepo.GetStringResearchValueForEquitySync("brokerXLong", equity.Ticker), ASX200Accumulation= edisRepo.GetStringResearchValueForEquitySync("ASX200AccumulationLong", equity.Ticker), },new AnalysisPayloadGroupDataItem{ name= "Price Target", baseInformation= edisRepo.GetStringResearchValueForEquitySync("baseInformationPrice", equity.Ticker), morningstar= edisRepo.GetStringResearchValueForEquitySync("morningstarPrice", equity.Ticker), brokerX= edisRepo.GetStringResearchValueForEquitySync("brokerXPrice", equity.Ticker), ASX200Accumulation= edisRepo.GetStringResearchValueForEquitySync("ASX200AccumulationPrice", equity.Ticker), }, } },new AnalysisPayloadGroupModel{ name="Income", data=new List<AnalysisPayloadGroupDataItem>{ new AnalysisPayloadGroupDataItem{ name= "Current Short Term Recommendation", baseInformation= "base information", morningstar= "Morning star information", brokerX= "brokerX information", ASX200Accumulation= "Accumulation Details" },new AnalysisPayloadGroupDataItem{ name= "Current Long Term Recommendation", baseInformation= "base information", morningstar= "Morning star information", brokerX= "brokerX information", ASX200Accumulation= "Accumulation Details" },new AnalysisPayloadGroupDataItem{ name= "Price Target", baseInformation= "base information", morningstar= "Morning star information", brokerX= "brokerX information", ASX200Accumulation= "Accumulation Details" }, } } } }, }; return model; return advisorRepo.GetCompanyProfile(User.Identity.GetUserId(), companyId); }