public static async Task CreateEmptyExerciseSets(SQLiteAsyncConnection _connection, string exercise, Models.Persistence.Workout workout, DateTime date) { //DateTime date = await CreateExerciseRecordForWorkout(_connection, exercise, workout); var exerciseRecords = await Models.Persistence.Exercise.GetAllExerciseRecordsByDate(_connection, date); //var testing = await Models.Persistence.Exercise.GetAllExercise(_connection); int exerciseId = exerciseRecords[0].Id; List <int> setReps = new List <int>(new int[] { 12, 10, 8, 6, 4 }); foreach (var s in setReps) { //add set record DateTime d = DateTime.Now; var set = new Models.Persistence.Set { ExerciseId = exerciseId, TimeOfSet = d, Weight = 0m, Reps = s }; await _connection.InsertAsync(set); Task.Delay(100).Wait(); } }
public async Task AddSetToInternalDb(DateTime date, string pickerOne, string pickerTwo) { //guid later var weight = System.Convert.ToDecimal(pickerOne); var rep = System.Convert.ToInt16(pickerTwo); //add set record var set = new Models.Persistence.Set { ExerciseId = ExerciseId, TimeOfSet = date, Weight = weight, Reps = rep }; await _connection.InsertAsync(set); var sets = await Set.GetSetsByDate(_connection, date); if (sets.Count != 1) { await Navigation.PushAsync(new Views.Workout.ViewWorkoutsPage()); Navigation.RemovePage(this); } else { ExerciseList exerciseList = new ExerciseList() { Id = sets[0].ExerciseId }; await Navigation.PushAsync(new Views.Workout.ViewSetsPage(exerciseList)); Navigation.RemovePage(this); } }
public async Task UpdateSetInternally(string pickerOne, string pickerTwo) { //guid later var weight = System.Convert.ToDecimal(pickerOne); var rep = System.Convert.ToInt16(pickerTwo); //add set record var set = new Models.Persistence.Set { Id = SetId, ExerciseId = ExerciseId, Weight = weight, Reps = rep, TimeOfSet = Date }; await _connection.UpdateAsync(set); ExerciseList exerciseList = new ExerciseList() { Id = ExerciseId }; await Navigation.PushAsync(new Views.Workout.ViewSetsPage(exerciseList)); Navigation.RemovePage(this); }
private static async Task CreateSetsWithValues(SQLiteAsyncConnection _connection, int exerciseIdForSets, int repValue, decimal weightValue, decimal increment) { List <int> setReps = new List <int>(new int[] { 12, 10, 8, 6, 4 }); decimal oneRepMaxEstimation = oneRepMax(weightValue + increment, repValue, 2.5m, false); foreach (var s in setReps) { //add set record DateTime d = DateTime.Now; var set = new Models.Persistence.Set { ExerciseId = exerciseIdForSets, TimeOfSet = d, Weight = weightForSet(oneRepMaxEstimation, s, 2.5m), Reps = s }; await _connection.InsertAsync(set); Task.Delay(50).Wait(); } }