Esempio n. 1
0
            private void UpdateNote(long noteId, string title, ObservableCollection <TodoNote.TodoEntry> TodoEntries)
            {
                string           timeStamp = TimeUtil.GetStringTimestamp();
                ISQLiteStatement statement = dbConn.Prepare(UPDATE_TODO_NOTE);

                statement.Bind(1, title);
                statement.Bind(2, timeStamp);
                statement.Bind(3, null);
                statement.Bind(4, noteId);
                statement.Step();
                TodoNote todoNote = (TodoNote)GetNoteById(noteId);

                // Delete all todo note contents
                foreach (TodoNote.TodoEntry entry in ((TodoNote)GetNoteById(noteId)).TodoEntries)
                {
                    statement.Reset();
                    statement.ClearBindings();
                    statement = dbConn.Prepare(DELETE_TODO_NOTE_CONTENT);
                    statement.Bind(1, entry.Id);
                    statement.Step();
                }
                // Add all todo note new contents
                foreach (TodoNote.TodoEntry entry in TodoEntries)
                {
                    statement.Reset();
                    statement.ClearBindings();
                    statement = dbConn.Prepare(INSERT_TODO_NOTE_CONTENT);
                    statement.Bind(1, entry.Content);
                    statement.Bind(2, ConvertBoolToInt(entry.IsDone));
                    statement.Bind(3, noteId);
                    statement.Bind(4, timeStamp);
                    statement.Step();
                }
            }
Esempio n. 2
0
            public void AddNote(string title, ObservableCollection <TodoNote.TodoEntry> entries, string schedulingId, DateTimeOffset dateTime)
            {
                long             notificationId = NotificationHelper.AddNotification(schedulingId, dateTime);
                ISQLiteStatement statement      = dbConn.Prepare(INSERT_TODO_NOTE);

                statement.Bind(1, title);
                statement.Bind(2, TimeUtil.GetStringTimestamp());
                statement.Bind(3, notificationId);
                statement.Step();
                foreach (TodoNote.TodoEntry entry in entries)
                {
                    statement = dbConn.Prepare(INSERT_TODO_NOTE_CONTENT);
                    statement.Bind(1, entry.Content);
                    int done = ConvertBoolToInt(entry.IsDone);
                    statement.Bind(2, done);
                    ISQLiteStatement stat = dbConn.Prepare(SELECT_LAST_NOTE_INSERT_ID);
                    stat.Step();
                    long noteID = (long)stat[0];
                    statement.Bind(3, noteID);
                    statement.Bind(4, TimeUtil.GetStringTimestamp());
                    statement.Step();
                    statement.Reset();
                    statement.ClearBindings();
                }
            }
Esempio n. 3
0
		public Cursor (ISQLiteStatement statement)
		{
			this.statement = statement;
			currentRow = -1;

			hasRows = statement.Step () == SQLiteResult.ROW;
			statement.Reset ();
		}
Esempio n. 4
0
        public Cursor(ISQLiteStatement statement)
        {
            this.statement = statement;
            currentRow     = -1;

            hasRows = statement.Step() == SQLiteResult.ROW;
            statement.Reset();
        }
Esempio n. 5
0
            public void DeleteNote(long id)
            {
                ISQLiteStatement statement = dbConn.Prepare(DELETE_PHOTO_NOTE);

                statement.Bind(1, id);
                statement.Step();
                statement.Reset();
                statement.ClearBindings();
                DeleteNotificationByNoteId(id);
            }
Esempio n. 6
0
            public void DeleteNote(long id)
            {
                ISQLiteStatement statement = dbConn.Prepare(DELETE_TODO_NOTE_CONTENT);
                TodoNote         todoNote  = (TodoNote)GetNoteById(id);

                foreach (TodoNote.TodoEntry entry in todoNote.TodoEntries)
                {
                    statement.Bind(1, entry.Id);
                    statement.Step();
                    statement.Reset();
                    statement.ClearBindings();
                }
                statement = dbConn.Prepare(DELETE_TODO_NOTE);
                statement.Bind(1, id);
                statement.Step();
                DeleteNotificationByNoteId(id);
            }
        protected override void OnNavigatedTo(NavigationEventArgs ne)
        {
            id = ne.Parameter.ToString();

            string CategoryName = @"SELECT * FROM categories WHERE id=" + id;

            var title = objConn.Prepare(CategoryName);

            title.Step();
            CBTitle.Text = title[1] + " - Quiz {}";

            string QuestionPhrase = @"SELECT * FROM questions WHERE categoryid=" + id;

            question = objConn.Prepare(QuestionPhrase);

            while (question.Step() == SQLiteResult.ROW)
            {
                questiontotal++;
            }

            question.Reset();

            ChangeQuestion();
        }
        protected override void OnNavigatedTo(NavigationEventArgs ne)
        {
            id = ne.Parameter.ToString();

            string CategoryName = @"SELECT * FROM categories WHERE id=" + id;

            var title = objConn.Prepare(CategoryName);
            title.Step();
            CBTitle.Text = title[1] + " - Quiz {}";

            string QuestionPhrase = @"SELECT * FROM questions WHERE categoryid=" + id;
            question = objConn.Prepare(QuestionPhrase);

            while (question.Step() == SQLiteResult.ROW)
            {
                questiontotal++;
            }

            question.Reset();

            ChangeQuestion();
        }
 public static void ResetAndClearBindings(this ISQLiteStatement statement)
 {
     statement.Reset();
     statement.ClearBindings();
 }