/// <summary> /// Retrieves investors and their industries from AngelList and stores them in a database. /// </summary> /// <param name="angelListClient">IAngelListClient</param> /// <param name="logWriter">LogWriter</param> public InvestorIndustriesLoader(IAngelListClient angelListClient, LogWriter logWriter) { if (angelListClient == null) { throw new ArgumentNullException("angelListClient"); } this.AngelListClient = angelListClient; if (logWriter == null) { throw new ArgumentNullException("logWriter"); } this.defaultLogWriter = logWriter; int maxRangeLength = Properties.Settings.Default.MaxRangeLength; int maxRanges = Properties.Settings.Default.MaxRanges; this.paramParser = new QueryParameterParser(maxRangeLength, maxRanges); ConfigurationProvider config = new ConfigurationProvider(); config.Add(ConfigName.SqlConnectionString, Screen.Vc.DataAccess.Investors.Properties.Settings.Default.ScreenVcConnectionString); config.Add(ConfigName.SqlConnectTimeoutInSeconds, Screen.Vc.DataAccess.Investors.Properties.Settings.Default.SqlConnectTimeoutInSeconds); this.configurationProvider = config; }
public void GetStartupsOfUsersBatch_Success() { var ids = new List <int> { 155, 160 }; // investor:true IAngelListClient angelListClient = AngelListClient; var idLists = paramParser.ParseIntList(ids); foreach (List <int> idList in idLists) { var query = new GetUsersStartupIdsQuery(idList, angelListClient); Dictionary <int, List <int> > usersStartupIds = query.Execute(); HashSet <int> uniqueStartupIds = new HashSet <int>(); foreach (List <int> startupIds in usersStartupIds.Values) { foreach (int startupId in startupIds) { uniqueStartupIds.Add(startupId); } } string startupIdsString = String.Join(",", uniqueStartupIds); var startupsBatchCallback = new AsyncCallback(GetStartupsBatch_Success_ProcessResults); var startupsBatchQuery = new GetStartupsBatchQuery(uniqueStartupIds.ToList(), startupsBatchCallback, angelListClient, defaultLogWriter); var result = startupsBatchQuery.BeginExecute(); result.AsyncWaitHandle.WaitOne(20 * 1000); } }
public AngelListQuery(IAngelListClient angelListClient) { if (angelListClient == null) { throw new ArgumentNullException("angelListClient"); } this.AngelListClient = angelListClient; }
public GetUsersBatchQuery(List <int> ids, IAngelListClient angelListClient, LogWriter logWriter) : base(angelListClient, logWriter) { if (ids == null) { throw new ArgumentNullException("ids"); } this.Ids = ids; }
public void GetStartupsBatch_Success_ProcessResults(IAsyncResult iaResult) { var aresult = (BatchAsyncResult <List <AngelList.JsonTypes.Startup> >)iaResult; List <AngelList.JsonTypes.Startup> startups = aresult.Result; IAngelListClient angelListClient = AngelListClient; Assert.IsNotNull(startups); Assert.AreNotEqual(0, startups.Count); // Expect one startup for each id, so no more startups returned than the number of ids sent in a query. Assert.IsTrue(startups.Count <= angelListClient.QueryParameterLimit); }
public AngelListPagedQuery(object state, IAngelListClient angelListClient, LogWriter logWriter) { if (logWriter == null) { throw new ArgumentNullException("logWriter"); } if (angelListClient == null) { throw new ArgumentNullException("angelListClient"); } this.defaultLogWriter = logWriter; this.AngelListClient = angelListClient; this.State = state; }
public GetStartupsMarketsQuery(List <int> startupIds, object state, IAngelListClient angelListClient, LogWriter logWriter) : base(state, angelListClient, logWriter) { this.Ids = startupIds; }
public GetStartupsMarketsQuery(List <int> startupIds, IAngelListClient angelListClient, LogWriter logWriter) : this(startupIds, null, angelListClient, logWriter) { }
public GetUserStartupIdsQuery(int id, IAngelListClient angelListClient) : base(angelListClient) { this.Id = id; }
public GetUsersStartupIdsQuery(List <int> ids, IAngelListClient angelListClient) : base(angelListClient) { this.Ids = ids; }
public GetInvestorsQuery(List <int> ids, IAngelListClient angelListClient, LogWriter logWriter) : base(angelListClient, logWriter) { this.Ids = ids; }
public AngelListPagedQuery(IAngelListClient angelListClient, LogWriter logWriter) : this(null, angelListClient, logWriter) { }
public GetUserRolesQuery(int id, AsyncCallback batchCallback, IAngelListClient angelListClient, LogWriter logWriter) : base(batchCallback, angelListClient, logWriter) { this.Id = id; }