public override int Update(Android.Net.Uri uri, ContentValues values, string selection, string[] selectionArgs) { string clubIdValue = values.GetAsString("ClubId"); string memberIdValue = values.GetAsString("MemberId"); string value = " clubId = '" + clubIdValue + "'" + ", memberId = '" + memberIdValue + "'"; var query = QueryBuilder.BuildUpdate(TABLENAME, value, selection); return(dataProvider.Update(query, selectionArgs)); }
private void PersistString(String name, ContentValues values) { if (values == null) { throw new InvalidOperationException(" values is null!!!"); } String kString = values.GetAsString(PREF_KEY); String vString = values.GetAsString(PREF_VALUE); GetDPreference(name).SetPrefString(kString, vString); }
public override Android.Net.Uri Insert(Android.Net.Uri uri, ContentValues values) { Goal goal = new Goal(); goal.MemberId = values.GetAsString("MemberId"); goal.ClubId = values.GetAsString("ClubId"); goal.Type = values.GetAsInteger("Type"); goal.GoalValue = values.GetAsInteger("GoalValue"); var insertedId = dataProvider.Insert(goal); Android.Net.Uri insertUrl = Android.Net.Uri.Parse(GaugeAuthorities.Content + GaugeAuthorities.GoalContentProviderAuthorities + "/" + insertedId); return(insertUrl); }
private void PersistDateTime(string name, ContentValues values) { if (values == null) { throw new InvalidOperationException(" values is null!!!"); } String kDatetime = values.GetAsString(PREF_KEY); long vDateTimeTicks = values.GetAsLong(PREF_VALUE); GetDPreference(name).SetPrefLong(kDatetime, vDateTimeTicks); }
private void PersistBoolean(String name, ContentValues values) { if (values == null) { throw new InvalidOperationException(" values is null!!!"); } String kBoolean = values.GetAsString(PREF_KEY); bool vBoolean = values.GetAsBoolean(PREF_VALUE); GetDPreference(name).SetPrefBoolean(kBoolean, vBoolean); }
private void PersistInt(String name, ContentValues values) { if (values == null) { throw new InvalidOperationException(" values is null!!!"); } String kInteger = values.GetAsString(PREF_KEY); int vInteger = values.GetAsInteger(PREF_VALUE); GetDPreference(name).SetPrefInt(kInteger, vInteger); }
public override Uri Insert(Uri uri, ContentValues values) { if (LOGV) { Log.Verbose(TAG, "insert(uri=" + uri + ", values=" + values.ToString() + ")"); } SQLiteDatabase db = mOpenHelper.WritableDatabase; int match = sUriMatcher.Match(uri); switch (match) { case BLOCKS: { db.InsertOrThrow(ScheduleDatabase.Tables.BLOCKS, null, values); Context.ContentResolver.NotifyChange(uri, null); return(ScheduleContract.Blocks.BuildBlockUri(values.GetAsString(ScheduleContract.Blocks.BLOCK_ID))); } case TRACKS: { db.InsertOrThrow(ScheduleDatabase.Tables.TRACKS, null, values); Context.ContentResolver.NotifyChange(uri, null); return(ScheduleContract.Tracks.BuildTrackUri(values.GetAsString(ScheduleContract.Tracks.TRACK_ID))); } case ROOMS: { db.InsertOrThrow(ScheduleDatabase.Tables.ROOMS, null, values); Context.ContentResolver.NotifyChange(uri, null); return(ScheduleContract.Rooms.BuildRoomUri(values.GetAsString(ScheduleContract.Rooms.ROOM_ID))); } case SESSIONS: { db.InsertOrThrow(ScheduleDatabase.Tables.SESSIONS, null, values); Context.ContentResolver.NotifyChange(uri, null); return(ScheduleContract.Sessions.BuildSessionUri(values.GetAsString(ScheduleContract.Sessions.SESSION_ID))); } case SESSIONS_ID_SPEAKERS: { db.InsertOrThrow(ScheduleDatabase.Tables.SESSIONS_SPEAKERS, null, values); Context.ContentResolver.NotifyChange(uri, null); return(ScheduleContract.Speakers.BuildSpeakerUri(values.GetAsString(ScheduleDatabase.SessionsSpeakers.SPEAKER_ID))); } case SESSIONS_ID_TRACKS: { db.InsertOrThrow(ScheduleDatabase.Tables.SESSIONS_TRACKS, null, values); Context.ContentResolver.NotifyChange(uri, null); return(ScheduleContract.Tracks.BuildTrackUri(values.GetAsString(ScheduleDatabase.SessionsTracks.TRACK_ID))); } case SPEAKERS: { db.InsertOrThrow(ScheduleDatabase.Tables.SPEAKERS, null, values); Context.ContentResolver.NotifyChange(uri, null); return(ScheduleContract.Speakers.BuildSpeakerUri(values.GetAsString(ScheduleContract.Speakers.SPEAKER_ID))); } case VENDORS: { db.InsertOrThrow(ScheduleDatabase.Tables.VENDORS, null, values); Context.ContentResolver.NotifyChange(uri, null); return(ScheduleContract.Vendors.BuildVendorUri(values.GetAsString(ScheduleContract.Vendors.VENDOR_ID))); } case SEARCH_SUGGEST: { db.InsertOrThrow(ScheduleDatabase.Tables.SEARCH_SUGGEST, null, values); Context.ContentResolver.NotifyChange(uri, null); return(ScheduleContract.SearchSuggest.CONTENT_URI); } default: { throw new Exception("Unknown uri: " + uri); } } }