コード例 #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
        }
コード例 #2
0
        public void ChangeMemberStatus(IEMember member, int newStatus)
        {
            switch (member.Status)
            {
            case IEMember.MEMBER_NEW:
                NewItems.Remove(member);
                break;

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

            default:
                ActiveItems.Remove(member);
                break;
            }
            member.Status = newStatus;

            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();

            SaveMember(member);
        }