public void updateMapResource(MapDownloadResource mapResource) { ContentValues values = new ContentValues(); values.Put(STATE, mapResource.DownloadState); values.Put(NO_DOWNLOADED_BYTES, mapResource.NoDownloadedBytes); values.Put(SKM_FILE_PATH, mapResource.getSKMFilePath()); values.Put(SKM_FILE_SIZE, mapResource.getSkmFileSize()); values.Put(TXG_FILE_PATH, mapResource.getTXGFilePath()); values.Put(TXG_FILE_SIZE, mapResource.getTXGFileSize()); values.Put(ZIP_FILE_PATH, mapResource.getZipFilePath()); values.Put(SKM_AND_ZIP_FILES_SIZE, mapResource.getSkmAndZipFilesSize()); values.Put(UNZIPPED_FILE_SIZE, mapResource.getUnzippedFileSize()); values.Put(DOWNLOAD_PATH, mapResource.DownloadPath); try { resourcesDAO.getDatabase().BeginTransaction(); resourcesDAO.getDatabase().Update(MAPS_TABLE, values, CODE + "=?", new String[] { mapResource.Code }); resourcesDAO.getDatabase().SetTransactionSuccessful(); } catch (SQLException e) { SKLogging.WriteLog(TAG, "SQL EXCEPTION SAVE MAP DATA " + e.Message, SKLogging.LogError); } finally { resourcesDAO.getDatabase().EndTransaction(); } }
private void removeNullValuesIfExist(MapDownloadResource currentMap) { if (currentMap.ParentCode == null) { currentMap.ParentCode = (""); } if (currentMap.DownloadPath == null) { currentMap.DownloadPath = (""); } if (currentMap.getSKMFilePath() == null) { currentMap.setSkmFilePath(""); } if (currentMap.getZipFilePath() == null) { currentMap.setZipFilePath(""); } if (currentMap.getTXGFilePath() == null) { currentMap.setTXGFilePath(""); } }