public void UpdateCal(){ if (!SyncCalendar) { SyncCalendar = true; Note n; foreach (String[] e in getEvents()) { //Debug.WriteLine (e); /* * 0=id * 1=title * 2=dstart * 3=dend * 4=desc * 5=loc */ n = new Note (e [1], mstoDateTime (e [2]), e [5], e [4], ""); n.CalId = int.Parse (e [0]); Debug.WriteLine (n.titleText); Debug.WriteLine (n.TimeStamp); database.CalendarInsertOrUpdateNote (n); } SyncCalendar = false; } }
public int CalendarInsertOrUpdateNote(Note note) { if (database.Table<Note> ().Where (x => x.CalId == note.CalId).Count () > 0) { var n = database.Table<Note> ().First (t => t.CalId == note.CalId); note.NoteId = n.NoteId; note.Attendees = n.Attendees; } return InsertOrUpdateNote (note); }
public int InsertOrUpdateNote(Note note) { return database.Table<Note> ().Where (x => x.NoteId == note.NoteId).Count () > 0 ? database.Update (note) : database.Insert (note); }