Ejemplo n.º 1
0
        private async Task <TimeSpan> LoadFromExternalDatabase()
        {
            var table = await _externalDb.FetchAllMembers(Settings.UserName);

            _logger.LogInfo("Found " + table.Count + " members in databse");
            foreach (var member in table)
            {
                Members.Add(member.ProfileId, member);
                switch (member.Status)
                {
                case IEMember.MEMBER_NEW:
                    NewItems.Add(member);
                    break;

                case IEMember.MEMBER_REJECTED:
                    RejectedItems.Add(member);
                    break;

                default:
                    ActiveItems.Add(member);
                    break;
                }
            }

            NewItems.Sort();
            RejectedItems.Sort();
            ActiveItems.Sort();

            TimeScheduler.GetTimeScheduler().AddTask(DS_TASK_NAME, TimeSpan.FromSeconds(INITIAL_DELAY), () => OnTimedEvent());
            return(TimeScheduler.STOP_TIMER);                           // This stops us being re-scheduled
        }
Ejemplo n.º 2
0
        public async Task RunExternalDBTest()
        {
            ExternalDBService dbService = new ExternalDBService();

            List <IEMember> members = await dbService.FetchAllMembers("kiss me slowly");

            Console.WriteLine("Found " + members.Count + " members in externalDB");

            foreach (var member in members)
            {
                Console.WriteLine("Last Activity = " + member.LastActivityTimestamp);
                Console.WriteLine("First Activity = " + member.FirstContactTimestamp);
                Console.WriteLine("Extra Activity = " + member.FetchedExtraData);
            }
            Assert.True(members.Count != 0);
        }