public static Dictionary <Entity, List <Incubation> > GetHistory() { var fundIcubations = IncubationDataAccess.GetAllFundIncubations(); Dictionary <Entity, List <Incubation> > gp = new Dictionary <Entity, List <Incubation> >(); List <FundIncubation> update = new List <FundIncubation>(); foreach (var fund in fundIcubations) { gp.Add(fund.Fund, fund.Incubations); } return(gp); }
public static Dictionary <Entity, List <Incubation> > CorrectFundIncubations() { var fundIncubations = IncubationDataAccess.GetAllFundIncubations(); var toto = fundIncubations.GroupBy(f => f.Fund.Id); int count = toto.Count(); if (fundIncubations.Count != count) { Log.Error("IncubationStream.GetHistory", "Duplicated fund"); } Dictionary <Entity, List <Incubation> > gp = new Dictionary <Entity, List <Incubation> >(); List <FundIncubation> update = new List <FundIncubation>(); foreach (var fund in toto) { gp.Add(fund.First().Fund, fund.SelectMany(e => e.Incubations).ToList()); var all = fund.SelectMany(e => e.Incubations).ToList(); List <Incubation> distincIncubations = fund.SelectMany(e => e.Incubations).Distinct(new IncubationComparer()).ToList(); if (all.Count() != distincIncubations.Count) { Console.WriteLine("distinct"); } update.Add(new FundIncubation() { Fund = fund.First().Fund, Incubations = distincIncubations, LastUpdate = DateTime.UtcNow }); } IncubationDataAccess.DeleteFundIncubationCollection(); IncubationDataAccess.SaveDailyActivity(update); return(gp); }
/// <summary> /// Used for the rss feed /// </summary> /// <returns>all the last funds' investments</returns> public static List <FundIncubation> GetAllFundIncubationList() { return(IncubationDataAccess.GetAllFundIncubations()); }