/* Sets the deleted attribute of the exercise to true. */ public void DeleteExercise(Exercise e) { Dictionary<string, object> parameters = new Dictionary<string, object>(){ { "@exerciseName", e.exerciseName }, { "@exerciseVersion", e.exerciseVersion }}; this.db.DoNonQueryPrepared(this.db.GetPreparedStatement("setExerciseDeletedTrue", parameters)); }
/* Inserts a new exercise if it does not exist, othervise replaces the existing one. */ public void InsertExercise(Exercise e) { Dictionary<string, object> parameters = new Dictionary<string, object>() { { "@exerciseName", e.exerciseName }, { "@format", e.exerciseFormat }, { "@exerciseVersion", e.exerciseVersion }, { "@deleted", e.deleted }}; this.db.DoNonQueryPrepared(this.db.GetPreparedStatement("insertExercise", parameters)); }
/* Returns the index of the first exercise in the exercise list with the same name. * If no exercises with the same name exists, this.noMatches is returned. */ private int GetExerciseIndex(List<Exercise> eList, Exercise e) { for (int i = 0; i < eList.Count; i++) { if (eList[i].exerciseName == e.exerciseName) { return i; } } return noMatches; }
/** End of exercise right click menu callbacks **/ /* Adds the most recent exercise with the same name as e to the list of selected * exercises for this workout. The exercise name must exists in this.allExercises. * Also adds the exercise to this.dropAreaFlp. */ private void AddExerciseToWorkout(Exercise e, int index, string numSets = "") { this.selectedExercises.Insert(index, this.allExercises[GetExerciseIndex(this.allExercises, e)]); ExerciseSetCountSelectorControl escsc = new ExerciseSetCountSelectorControl( e.exerciseName, DeleteExerciseFromDropAreaByControl); escsc.Width = this.dropAreaFlp.Width; escsc.numberOfSetsTxtBox.Text = numSets; this.dropAreaFlp.Controls.Add(escsc); this.dropAreaFlp.Controls.SetChildIndex(escsc, index); escsc.exerciseNameLbl.MouseDown += new MouseEventHandler(DropField_MouseDown); }
/* Fills the form with the passed exercise. */ public void FillForm(Exercise e) { this.unitsSelectorControl.SelectUnits(e.exerciseFormatList); this.nameTxtBox.Text = e.exerciseName; }
public SetActivityExercise(Set set, Activity activity, Exercise exercise) { this.set = set; this.activity = activity; this.exercise = exercise; }
public ActivityExercise(Activity activity, Exercise exercise) { this.activity = activity; this.exercise = exercise; }