Ejemplo n.º 1
0
        public async Task <List <Job2> > GetAllAsync()
        {
            try
            {
#if OFFLINE_SYNC_ENABLED
                if (syncItems)
                {
                    await this.SyncAsync();
                }
#endif
                List <Job2> items = await job2Table.ToListAsync();



                return(items);
            }
            catch (MobileServiceInvalidOperationException msioe)
            {
                Debug.WriteLine(@"Invalid sync operation: {0}", msioe.Message);
            }
            catch (Exception e)
            {
                Debug.WriteLine(@"Sync error: {0}", e.Message);
            }
            return(null);
        }
Ejemplo n.º 2
0
        public async Task <List <Item> > GetListSortedByAge()
        {
            var itemsSerach = await table.ToListAsync();

            itemsSerach.Sort((Item a, Item b) => b.Date.CompareTo(a.Date));
            return(itemsSerach);
        }
Ejemplo n.º 3
0
        public async Task <List <User> > GetUser()
        {
            await UserTable.PurgeAsync();

            await SyncUserAsync();

            return(await UserTable.ToListAsync());
        }
Ejemplo n.º 4
0
        public async Task <IEnumerable <Users> > GetLocations()
        {
            await SyncAsync("user111111", true);

            var locations = await azureSyncTable.ToListAsync();

            return(locations);
        }
Ejemplo n.º 5
0
        public async Task <List <Perso> > GetPersons()
        {
            await SyncAsync(true);

            var locations = await azureSyncTable.ToListAsync();

            return(locations);
        }
        public async Task <List <Session> > GetSessionsAsync()
        {
            await InitAsync();
            await SyncAsync();

            return(await sessionTable.ToListAsync());
        }
Ejemplo n.º 7
0
        public async Task <List <WalkDataModel> > GetWalkEntries()
        {
            await Initialize();
            await SyncWalkEntries();

            return(await WalkEntryTable.ToListAsync());
        }
Ejemplo n.º 8
0
        public async Task <List <Users> > GetAllUsers()
        {
            //await Initialize();
            await SyncUsers();

            return(await _users.ToListAsync());
        }
        public async Task <List <Speaker> > GetSpeakersAsync()
        {
            await InitAsync();
            await SyncAsync();

            return(await speakerTable.ToListAsync());
        }
Ejemplo n.º 10
0
        public async Task <List <Activities> > GetActivitiesList()
        {
            //await Initialize();
            await SyncActivties();

            return(await _activities.ToListAsync());
        }
Ejemplo n.º 11
0
        public async Task <List <Platillo> > ObtenerPlatillos()
        {
            await Initialize();
            await SyncPlatillos();

            return(await _tablaPlatillo.ToListAsync());
        }
Ejemplo n.º 12
0
        public async Task <List <QuizQuestion> > GetQuestions()
        {
            await Initialize();
            await SyncQuestions();

            return(await table.ToListAsync());
        }
Ejemplo n.º 13
0
        public async Task <List <EmployeeInfo> > GetEmployees()
        {
            await Initialize();
            await SyncEmployees();

            return(await table.ToListAsync());
        }
    public async Task <List <TModel> > GetAll()
    {
        await InitLocalStoreAsync();
        await SyncAsync();

        return(await syncTable.ToListAsync());
    }
Ejemplo n.º 15
0
        public async Task <IEnumerable <Notas> > ObtenerNotas()
        {
            await Initialize();
            await SyncNotas();

            return(await tablaNotas.ToListAsync());
        }
        public async Task <IList <FavouriteSpot> > SearchForLocationsAsync(string searchText, double latitude, double longitude)
        {
            await Initialize();

            List <FavouriteSpot> items;

            if (String.IsNullOrEmpty(searchText))
            {
                items = await favouriteSpotsTable.ToListAsync();
            }
            else
            {
                items = await favouriteSpotsTable
                        .Where(spot => spot.Name.Contains(searchText)).ToListAsync();
            }

            return(items
                   .Select(spot => new FavouriteSpot()
            {
                Id = spot.Id,
                Name = spot.Name,
                Address = spot.Address,
                Category = spot.Category,
                Description = spot.Description,
                Latitude = spot.Latitude,
                Longitude = spot.Longitude,
                AddedById = spot.AddedById,
                MainImageUrl = spot.MainImageUrl,
                RatingOutOfFive = spot.RatingOutOfFive
            })
                   .ToList());
        }
Ejemplo n.º 17
0
        public async Task Initialize()
        {
            if (Client?.SyncContext?.IsInitialized ?? false)
            {
                return;
            }

            var appUrl = "http://lazybook.azurewebsites.net";

            Client = new MobileServiceClient(appUrl);

            var path = "syncstore_users.db";

            path = Path.Combine(MobileServiceClient.DefaultDatabasePath, path);

            //tworzenie lokalnej bazy danych
            var store = new MobileServiceSQLiteStore(path);

            //definiowanie tabeli
            store.DefineTable <Item>();

            //inicjalizownie synchronizacji
            await Client.SyncContext.InitializeAsync(store, new MobileServiceSyncHandler());

            //tabela polaczona z Azure
            table = Client.GetSyncTable <User>();
            users = await table.ToListAsync();
        }
Ejemplo n.º 18
0
        public async Task Initialize()
        {
            if (client?.SyncContext?.IsInitialized ?? false)
            {
                return;
            }

            var azureUrl = "https://microsofthelpdesk.azurewebsites.net";

            //Create our client
            client = new MobileServiceClient(azureUrl);

            //InitializeDatabase for path
            var path = "requestDatabase.db";

            path = Path.Combine(MobileServiceClient.DefaultDatabasePath, path);

            //setup our local sqlite store and initialize our table
            var store = new MobileServiceSQLiteStore(path);

            //Define table
            store.DefineTable <Request>();

            //Initialize SyncContext
            await client.SyncContext.InitializeAsync(store, new MobileServiceSyncHandler());

            table = client.GetSyncTable <Request>();

            var current = table.ToListAsync();
        }
Ejemplo n.º 19
0
        public async Task <List <Volunteering> > TestbyIDAsync(string email, string id)
        {
            try
            {
#if OFFLINE_SYNC_ENABLED
                if (syncItems)
                {
                    await this.SyncAsync();
                }
#endif
                List <Volunteering> items = await volunteeringTable
                                            // .Where(couItem => couItem.Email1 == email && couItem.Courseid == id)
                                            .ToListAsync();

                return(items);
            }
            catch (MobileServiceInvalidOperationException msioe)
            {
                Debug.WriteLine(@"Invalid sync operation: {0}", msioe.Message);
            }
            catch (Exception e)
            {
                Debug.WriteLine(@"Sync error: {0}", e.Message);
            }
            return(null);
        }
Ejemplo n.º 20
0
    public async Task <List <Log> > GetAllLogs()
    {
        await Initialize();
        await SyncLog();

        return(await LogTable.ToListAsync());
    }
        public async Task <IEnumerable <RecentContact> > GetRecentContacts()
        {
            await SyncAsyncRecentContact(true);

            var recentContacts = await azureSyncTableRecentContact.ToListAsync();

            return(recentContacts);
        }
        public async Task <IEnumerable <Contact> > GetContacts()
        {
            await SyncAsyncContact(true);

            var contacts = await azureSyncTableContact.ToListAsync();

            return(contacts);
        }
Ejemplo n.º 23
0
 public async Task <List <ToDoItem> > Get()
 {
     if (!initialized)
     {
         await Initialize();
     }
     return(await toDoTable.ToListAsync());
 }
Ejemplo n.º 24
0
        public async Task <List <UserAuthorizations> > GetAllAuthUsers()
        {
            //await Initialize();
            currentUserID = Login.Default.CurrentUser.id;
            await SyncAuthUsers();

            return(await _userAuthorizations.ToListAsync());
        }
Ejemplo n.º 25
0
        public async Task <List <Measurements> > GetMeasurementsList()
        {
            _measurements = _mobileServiceClient.GetSyncTable <Measurements>();
            currentUserID = Login.Default.CurrentUser.id;
            await SyncMeasurements();

            return(await _measurements.ToListAsync());
        }
Ejemplo n.º 26
0
        public async Task <List <ToDoItem> > GetAllToDoItems()
        {
            await this.Initializer();

            //var table = client.GetSyncTable<ToDoItem>();

            return(await table.ToListAsync());
        }
Ejemplo n.º 27
0
        public async Task <DataStoreSyncResult <T> > GetItemsAsync <T>(bool syncItems = false, bool includeNavigationProperties = false)
            where T : class, ISyncEntity
        {
            try
            {
                var result = new DataStoreSyncResult <T>();
                if (syncItems)
                {
                    result.Code = await SyncAsync();
                }

                IEnumerable <T> items = null;
                if (typeof(T).Equals(typeof(Tag)))
                {
                    items = (IEnumerable <T>)(await _tagTable.ToEnumerableAsync());
                }
                else if (typeof(T).Equals(typeof(Contact)))
                {
                    items = (IEnumerable <T>)(await _contactTable.ToEnumerableAsync());
                }
                else if (typeof(T).Equals(typeof(Transaction)))
                {
                    if (includeNavigationProperties)
                    {
                        var transactions = await _transactionTable.ToListAsync();

                        var contactKeys = transactions.GroupBy(p => p.ContactId).Select(p => p.Key);
                        var contacts    = await _contactTable.Where(p => contactKeys.Contains(p.Id)).ToEnumerableAsync();

                        foreach (var transaction in transactions)
                        {
                            transaction.Contact = contacts.Single(p => p.Id == transaction.ContactId);
                        }
                        items = (IEnumerable <T>)transactions;
                    }
                    else
                    {
                        items = (IEnumerable <T>)(await _transactionTable.ToEnumerableAsync());
                    }
                }

                if (result.Code == DataStoreSyncCode.None)
                {
                    result.Code = DataStoreSyncCode.Success;
                }
                result.Items = new ObservableCollection <T>(items);
                return(result);
            }
            catch (MobileServiceInvalidOperationException msioe)
            {
                Debug.WriteLine($"Invalid sync operation: {msioe.Message}");
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Sync Error: {ex.Message}");
            }
            return(null);
        }
Ejemplo n.º 28
0
        public async Task <List <Request> > GetRequests()
        {
            await Initialize();
            await SyncRequests();

            var result = await table.ToListAsync();

            return(result);
        }
Ejemplo n.º 29
0
        protected override async Task <IEnumerable <Category> > LoadDataFromTable()
        {
            if (Table == null)
            {
                await Initialize();
            }

            return(await Table.ToListAsync());
        }
        public async Task <IList <TModel> > GetItemsAsync(bool forceRefresh = true)
        {
            if (forceRefresh)
            {
                await PullLatestAsync();
            }

            return(await _mobileServiceSyncTable.ToListAsync());
        }