private IEDataSource() { _logger = DependencyService.Get <ILogging>(); RejectedItems = new ObservableCollection <IEMember>(); ActiveItems = new ObservableCollection <IEMember>(); NewItems = new ObservableCollection <IEMember>(); SearchResults = new ObservableCollection <IEMember>(); Members = new Dictionary <string, IEMember>(); //string dbPath = DependencyService.Get<IFileHelper>().GetLocalFilePath("iedb.db3"); //_database = new SQLiteAsyncConnection(dbPath); //_database.CreateTableAsync<IEMember>( CreateFlags.None ).Wait(); _externalDb = new ExternalDBService(); _logger.LogInfo("Reading database table for existing members"); /* * var table = _database.Table<IEMember>().ToListAsync(); * table.Wait(); */ /* * var table = _externalDb.FetchAllMembers(Settings.UserName); * table.Wait(); * * _logger.LogInfo("Found " + table.Result.Count + " members in databse"); * foreach( var member in table.Result) * { * 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(); */ _session = new IESession(_logger); Running = false; }
public async Task RunExternalDBTest2() { ExternalDBService dbService = new ExternalDBService(); IEMember member = new IEMember(); member.ProfileId = "8888888"; member.Username = "******"; member.EyeColour = "Blue"; IEMember reply = await dbService.AddNewMember("kiss me slowly", member); Console.WriteLine("Reply Found " + reply); }
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); }