示例#1
0
        public void GetInvestorsQuery_Success()
        {
            int startId = 155; // investor:true
            int endId   = 156; // investor:false

            var idLists = paramParser.ParseIntRange(startId, endId);

            foreach (List <int> idList in idLists)
            {
                var investorsQuery = new GetInvestorsQuery(idList, new AsyncCallback(GetInvestors_Success_ProcessResult), AngelListClient, defaultLogWriter);

                var asyncResult = investorsQuery.BeginExecute();
                asyncResult.AsyncWaitHandle.WaitOne(20 * 1000);
            }
        }
        /// <summary>
        /// Given a range of AngelList user ids, retrieves investors and their industries from AngelList and stores them in a database.
        /// Range of ids is restricted by MaxRangeLength and MaxRanges.
        /// </summary>
        /// <param name="startId">AngelList user id to start the range.</param>
        /// <param name="endId">AngelList user id to end the range.</param>
        public void LoadInvestorsAndLoadUsersMarkets(int startId, int endId)
        {
            var idLists = paramParser.ParseIntRange(startId, endId);

            foreach (List <int> idList in idLists)
            {
                try
                {
                    var         investorsQuery = new GetInvestorsQuery(idList, AngelListClient, defaultLogWriter);
                    List <User> result         = (List <User>)investorsQuery.Execute();
                    ProcessLoadInvestorsAndLoadUsersMarkets(result);
                }
                catch (AngelListClientException ex)
                {
                    var entry = new LogEntry();
                    entry.Categories = new string[] { "General", "Warning" };
                    entry.Message    = string.Format("An exception occurred when calling the service. No further ids will be processed. Id list: {0}. Exception: {1}.", String.Join(",", idList), ex);
                    entry.Severity   = TraceEventType.Error;
                    defaultLogWriter.Write(entry);
                }
            }
        }