public void DeleteAccountsSoup() { if (_store.HasSoup(AccountsSoup)) { _store.DropSoup(AccountsSoup); } }
public void RecreateClearSoup() { if (_store.HasSoup(SoupName)) { _store.DropSoup(SoupName); } SetupSyncsSoupIfNotExists(); }
public void RecreateClearSoup() { if (_store.HasSoup(SoupName)) { _store.DropSoup(SoupName); } SetupNewCategoryContentSoupIfNotExists(); }
public static QuerySpec RemoveLimit(this QuerySpec querySpec, SmartStore store) { if (string.IsNullOrWhiteSpace(querySpec.SoupName) == false && store.HasSoup(querySpec.SoupName) == false) { return(querySpec); } var count = (int)store.CountQuery(querySpec); switch (querySpec.QueryType) { case QuerySpec.SmartQueryType.Exact: return(QuerySpec.BuildExactQuerySpec(querySpec.SoupName, querySpec.Path, querySpec.MatchKey, count)); case QuerySpec.SmartQueryType.Like: return(QuerySpec.BuildLikeQuerySpec(querySpec.SoupName, querySpec.Path, querySpec.LikeKey, querySpec.Order, count)); case QuerySpec.SmartQueryType.Range: return(QuerySpec.BuildRangeQuerySpec(querySpec.SoupName, querySpec.Path, querySpec.BeginKey, querySpec.EndKey, querySpec.Order, count)); default: case QuerySpec.SmartQueryType.Smart: return(QuerySpec.BuildSmartQuerySpec(querySpec.SmartSql, count)); } }
public async void LoadDataFromSmartStore(bool includeEdit) { if (!_store.HasSoup(NotesSoup)) { NotifyNotesSynced(); return; } QuerySpec querySpec = QuerySpec.BuildAllQuerySpec(NotesSoup, NoteObject.TitleField, QuerySpec.SqlOrder.ASC, Limit); CoreDispatcher core = CoreApplication.MainView.CoreWindow.Dispatcher; JArray results = _store.Query(querySpec, 0); if (results == null) { NotifyNotesSynced(); return; } NoteObject[] notes; if (includeEdit) { notes = (from note in results let model = new NoteObject(note.Value <JObject>()) select model).ToArray(); } else { notes = (from note in results let model = new NoteObject(note.Value <JObject>()) where !model.ObjectId.Contains("local") orderby model.Title select model).ToArray(); } string[] references = (from note in notes let title = note.Title[0].ToString().ToLower() group note by title into g orderby g.Key select g.Key).ToArray(); await core.RunAsync(CoreDispatcherPriority.Normal, () => IndexReference.Clear()); await core.RunAsync(CoreDispatcherPriority.Normal, () => IndexReference.Add("all")); for (int i = 0, max = references.Length; i < max; i++) { int closure = i; await core.RunAsync(CoreDispatcherPriority.Normal, () => IndexReference.Add(references[closure])); } for (int i = 0, max = notes.Length; i < max; i++) { NoteObject t = notes[i]; await UpdateNote(t); } NotifyNotesSynced(); await core.RunAsync(CoreDispatcherPriority.Normal, () => MainPage.MainPageReference.UpdateTable()); }
private void SetupSyncsSoupIfNotExistsNeeded() { if (_store.HasSoup(SoupName)) { return; } _store.RegisterSoup(SoupName, _indexSpecs); }
private void SetupSyncsSoupIfNotExistsNeeded() { IndexSpec[] indexSpecs = { new IndexSpec("UserId", SmartStoreType.SmartString) }; if (!_store.HasSoup(SoupName)) { _store.RegisterSoup(SoupName, indexSpecs); } }
public async void LoadDataFromSmartStore(bool includeEdit) { if (!_store.HasSoup(ContactSoup)) { NotifyContactsSynced(); return; } QuerySpec querySpec = QuerySpec.BuildAllQuerySpec(ContactSoup, ContactObject.LastNameField, QuerySpec.SqlOrder.ASC, Limit); CoreDispatcher core = CoreApplication.MainView.CoreWindow.Dispatcher; JArray results = _store.Query(querySpec, 0); if (results == null) { NotifyContactsSynced(); return; } ContactObject[] contacts; if (includeEdit) { contacts = (from contact in results let model = new ContactObject(contact.Value <JObject>()) select model).ToArray(); } else { contacts = (from contact in results let model = new ContactObject(contact.Value <JObject>()) where !model.ObjectId.Contains("local") orderby model.ContactName select model).ToArray(); } var references = (from contact in contacts let first = contact.ContactName[0].ToString().ToLower() group contact by first into g orderby g.Key select g.Key).ToArray(); await core.RunAsync(CoreDispatcherPriority.Normal, () => IndexReference.Clear()); await core.RunAsync(CoreDispatcherPriority.Normal, () => IndexReference.Add("all")); for (int i = 0, max = references.Length; i < max; i++) { var closure = i; await core.RunAsync(CoreDispatcherPriority.Normal, () => IndexReference.Add(references[closure])); } for (int i = 0, max = contacts.Length; i < max; i++) { ContactObject t = contacts[i]; await UpdateContact(t); } NotifyContactsSynced(); await core.RunAsync(CoreDispatcherPriority.Normal, () => MainPage.MainPageReference.UpdateTable()); }