/// <summary> /// Delete all local buffer data from database /// and query again /// </summary> /// <returns></returns> private async Task DeleteAll() { CurrentDialogType = DatabaseViewDialogType.WaitingDialog; await FaiCollectionHelper.DeleteByDateTimeAsync(DatabaseBuffer.FaiCollectionBuffers, NameConstants.SqlConnectionString); await QueryByIntervalAsync(); ShouldDisplayDialog = false; }
private async Task DeleteSelection() { CurrentDialogType = DatabaseViewDialogType.WaitingDialog; // Delete in database await FaiCollectionHelper.DeleteByDateTimeAsync(SelectedCollections, NameConstants.SqlConnectionString); // Get last index in buffer before selections var indexOfFirstSelectedCollections = DatabaseBuffer.FaiCollectionBuffers.IndexOf(SelectedCollections[0]); var lastIndexBeforeSelections = indexOfFirstSelectedCollections == 0 ? 0 : indexOfFirstSelectedCollections - 1; // Calculate the page index of lastIndexBeforeSelection var pageIndex = (int)Math.Floor(lastIndexBeforeSelections / (double)DatabaseBuffer.RowsPerPage); // Remove selections from buffer DatabaseBuffer.Remove(SelectedCollections); // Navigate to page where the first selection is deleted DatabaseBuffer.NavigateToPage(pageIndex); ShouldDisplayDialog = false; }