public static UserEventInfo addNewGoal(string titleA, string descriptionA, DateTime startTimeA, DateTime endTimeA, string phoneConnection) { //TODO //Figure out how to access the database on a phone. This will be used instead of hmhy-global. // Open the connection for the query. SQLiteDatabase db = SQLiteDatabase.OpenDatabase(phoneConnection, null, DatabaseOpenFlags.OpenReadwrite); string query = @"INSERT INTO Goal Values(id, @title, @description, @startTime, @endTime, reminderId)"; // Add the values passed in to a Content Vales Android.Content.ContentValues values = new Android.Content.ContentValues(5); values.Put("0", "0"); values.Put("1", titleA); values.Put("2", descriptionA); values.Put("3", startTimeA.ToString()); values.Put("4", endTimeA.ToString()); // Execute the query to inset into the phone database. db.Insert(query, "id, title, goalDescription, StartTime, EndTime", values); // Add the goal as an event to the calendar. AndroidCalendar userCalendar = new AndroidCalendar(); userCalendar.AddEvent("0", titleA, startTimeA, endTimeA, descriptionA); UserEventInfo info = new UserEventInfo(); info.Id = "0"; info.Title = titleA; info.StartDate = startTimeA; info.EndDate = endTimeA; return(info); }
public static void addNewNote(string title, int userID, string body, string phoneConnection) { // Open the connection for the query. SQLiteDatabase db = SQLiteDatabase.OpenDatabase(phoneConnection, null, DatabaseOpenFlags.OpenReadwrite); string query = @"INSERT INTO Note Values(id, @title, @userID, @body)"; // Add the values passed in to a Content Vales Android.Content.ContentValues values = new Android.Content.ContentValues(4); values.Put("0", "0"); values.Put("1", title); values.Put("2", userID.ToString()); values.Put("3", body); // Execute the query to inset into the phone database. db.Insert(query, "id, title, userId, body", values); }
public static UserReminderInfo addNewReminder(string message, DateTime remindTime, string phoneConnection) { // Open the connection for the query. SQLiteDatabase db = SQLiteDatabase.OpenDatabase(phoneConnection, null, DatabaseOpenFlags.OpenReadwrite); string query = @"INSERT INTO Reminder Values(id, @message, @startTime)"; // Add the values passed in to a Content Vales Android.Content.ContentValues values = new Android.Content.ContentValues(3); values.Put("0", "0"); values.Put("1", message); values.Put("2", remindTime.ToString()); // Execute the query to inset into the phone database. db.Insert(query, "id, messageText, reminderTime", values); // Create the reminder. UserReminderInfo info = new UserReminderInfo(); info.Title = message; info.StartTime = remindTime; info.Id = "0"; return(info); }
public static void addNewUser(string userName, bool priv, string phoneConnection) { // Open the connection for the query. SQLiteDatabase db = SQLiteDatabase.OpenDatabase(phoneConnection, null, DatabaseOpenFlags.OpenReadwrite); string query = @"INSERT INTO Goal Values(id, @userName, @privlage, goalId, noteId, calendarId, userGroupId)"; // Add the values passed in to a Content Vales Android.Content.ContentValues values = new Android.Content.ContentValues(7); values.Put("0", "0"); values.Put("1", userName); values.Put("2", priv.ToString()); values.Put("3", "0"); values.Put("4", "0"); values.Put("5", "0"); values.Put("6", "0"); // Execute the query to inset into the phone database. db.Insert(query, "id, userName, privelage, goalId, noteId, calendarId, userGroupId", values); }