private static Record SqliteStmtToRecord(ISQLiteStatement stmt)
 {
     return(new Record(stmt.GetText(RecordColumns.KEY),
                       stmt.DataType(RecordColumns.VALUE) == SQLiteType.NULL ? null : stmt.GetText(RecordColumns.VALUE),
                       stmt.GetInteger(RecordColumns.SYNC_COUNT),
                       new DateTime(long.Parse(stmt.GetText(RecordColumns.LAST_MODIFIED_TIMESTAMP), CultureInfo.InvariantCulture.NumberFormat), DateTimeKind.Utc),
                       stmt.DataType(RecordColumns.LAST_MODIFIED_BY) == SQLiteType.NULL ? string.Empty : stmt.GetText(RecordColumns.LAST_MODIFIED_BY),
                       new DateTime(long.Parse(stmt.GetText(RecordColumns.DEVICE_LAST_MODIFIED_TIMESTAMP), CultureInfo.InvariantCulture.NumberFormat), DateTimeKind.Utc),
                       stmt.GetInteger(RecordColumns.MODIFIED) == 1));
 }
 private static DatasetMetadata SqliteStmtToDatasetMetadata(ISQLiteStatement stmt)
 {
     return(new DatasetMetadata(
                stmt.DataType(RecordColumns.DATASET_NAME) == SQLiteType.NULL ? string.Empty : stmt.GetText(DatasetColumns.DATASET_NAME),
                new DateTime(long.Parse(stmt.GetText(DatasetColumns.CREATION_TIMESTAMP))),
                new DateTime(long.Parse(stmt.GetText(DatasetColumns.LAST_MODIFIED_TIMESTAMP))),
                stmt.DataType(DatasetColumns.LAST_MODIFIED_BY) == SQLiteType.NULL ? string.Empty : stmt.GetText(DatasetColumns.LAST_MODIFIED_BY),
                stmt.GetInteger(DatasetColumns.STORAGE_SIZE_BYTES),
                stmt.GetInteger(DatasetColumns.RECORD_COUNT)
                ));
 }
Example #3
0
        private static ForecastInfo ParseForecast(ISQLiteStatement row)
        {
            var forecast = new ForecastInfo();

            for (int x = 0; x < row.ColumnCount; x++)
            {
                var columnLabel = row.ColumnName(x);
                if (typeof(ForecastInfo).HasProperty(columnLabel))
                {
                    SQLiteType dataType = row.DataType(x);
                    if (columnLabel == "Name")
                    {
                        forecast.Name = row[x] as string;
                    }
                    else if (columnLabel == "Id")
                    {
                        forecast.Id = int.Parse(row[x].ToString());
                    }
                    else if (columnLabel == "CategoryId")
                    {
                        forecast.CategoryId = int.Parse(row[x].ToString());
                    }
                    else if (columnLabel == "ForecastNumber")
                    {
                        forecast.ForecastNumber = int.Parse(row[x].ToString());
                    }
                }
            }
            return(forecast);
        }
Example #4
0
        private static Region ParseRegion(ISQLiteStatement row)
        {
            var region = new Region();

            for (int x = 0; x < row.ColumnCount; x++)
            {
                var columnLabel = row.ColumnName(x);
                if (typeof(Region).HasProperty(columnLabel))
                {
                    SQLiteType dataType = row.DataType(x);
                    if (dataType == SQLiteType.INTEGER)
                    {
                        region.Id = int.Parse(row[x].ToString());
                    }
                    else
                    {
                        region.Name = row[x] as string;
                    }
                }
            }
            return(region);
        }
 private static Record SqliteStmtToRecord(ISQLiteStatement stmt)
 {
     return new Record(stmt.GetText(RecordColumns.KEY),
                        stmt.GetText(RecordColumns.VALUE),
                        stmt.GetInteger(RecordColumns.SYNC_COUNT),
                        new DateTime(long.Parse(stmt.GetText(RecordColumns.LAST_MODIFIED_TIMESTAMP))),
                        stmt.DataType(RecordColumns.LAST_MODIFIED_BY) == SQLiteType.NULL ? string.Empty : stmt.GetText(RecordColumns.LAST_MODIFIED_BY),
                        new DateTime(long.Parse(stmt.GetText(RecordColumns.DEVICE_LAST_MODIFIED_TIMESTAMP))),
                        stmt.GetInteger(RecordColumns.MODIFIED) == 1);
 }
 private static DatasetMetadata SqliteStmtToDatasetMetadata(ISQLiteStatement stmt)
 {
     return new DatasetMetadata(
         stmt.DataType(RecordColumns.DATASET_NAME) == SQLiteType.NULL ?string.Empty:stmt.GetText(DatasetColumns.DATASET_NAME),
         new DateTime(long.Parse(stmt.GetText(DatasetColumns.CREATION_TIMESTAMP))),
         new DateTime(long.Parse(stmt.GetText(DatasetColumns.LAST_MODIFIED_TIMESTAMP))),
         stmt.DataType(DatasetColumns.LAST_MODIFIED_BY) == SQLiteType.NULL ? string.Empty : stmt.GetText(DatasetColumns.LAST_MODIFIED_BY),
         stmt.GetInteger(DatasetColumns.STORAGE_SIZE_BYTES),
         stmt.GetInteger(DatasetColumns.RECORD_COUNT)
     );
 }