public void UpdateNoteToParse(long rowId, string noteTitle, string noteBody) { if (!ConnectedToNetwork(context)) { return; } NoteScripture n = GetNoteByParseId(rowId); // Initialize Parse Parse.Initialize(context, "scBTJphDK8yVGGtNhcL9cYee89GbEKuRkygGYXKa", "wlXg6dWeJBCxD3uNbnoCTnnZlpSvvZWOdfyoeREZ"); ParseQuery notes = new ParseQuery("Note"); notes.GetInBackground(n.NWTId, new MyGetCallback(n, "update")); }
public void DeleteNoteFromParse(NoteScripture note) { if (!ConnectedToNetwork(context)) { return; } // Initialize Parse Parse.Initialize(context, "scBTJphDK8yVGGtNhcL9cYee89GbEKuRkygGYXKa", "wlXg6dWeJBCxD3uNbnoCTnnZlpSvvZWOdfyoeREZ"); ParseQuery notes = new ParseQuery("Note"); notes.GetInBackground(note.NWTId, new MyGetCallback(note, "delete")); }
public void SyncUserNotesToParse(NotesActivity notesActivity, List<NoteScripture> notes) { if (!ConnectedToNetwork(context)) { return; } Parse.Initialize(context, "scBTJphDK8yVGGtNhcL9cYee89GbEKuRkygGYXKa", "wlXg6dWeJBCxD3uNbnoCTnnZlpSvvZWOdfyoeREZ"); List<ParseObject> parseItems = new List<ParseObject>(); List<NoteScripture> dbNotes = new List<NoteScripture>(); foreach (NoteScripture note in notes) { ParseQuery query = new ParseQuery("Note"); query.WhereEqualTo("objectId", note.NWTId); IEnumerable<ParseObject> existedObjects = query.Find(); // Does not exist in Parse if (existedObjects.Count() == 0) { ParseObject testObject = new ParseObject("Note"); testObject.Put("book", note.Book); testObject.Put("bookName", note.Book); testObject.Put("chapter", note.Chapter); testObject.Put("name", ParseUser.CurrentUser.Username); testObject.Put("title", note.NoteTitle); testObject.Put("note", note.NoteBody); testObject.Put("text", note.Scripture); testObject.Put("verse", note.Verses); testObject.Put("nwtId", note.NWTId); parseItems.Add(testObject); dbNotes.Add(note); } // Exists in Parse else if (existedObjects.Count() == 1) { query.GetInBackground(note.NWTId, new MyGetCallback(note, "update")); } } ParseObject.SaveAllInBackground(parseItems, new MySyncUploadSaveCallback(notesActivity, parseItems, dbNotes)); }