protected override void OnNavigatedTo(NavigationEventArgs e) { selectedExercise = (Exercise)e.Parameter; txtName.Text = selectedExercise.Name; lstLogEntries = _dao.GetLogEntries(selectedExercise.ExerciseID); LogEntrieList.ItemsSource = lstLogEntries; }
public void UpdateExercise(Exercise myExercise) { using (var dbConn = new SQLiteConnection(App.DB_PATH)) { dbConn.Update(myExercise); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter.GetType() == typeof(Exercise)) { selectedExercise = (Exercise)e.Parameter; int lastSetNo = _logEntryDao.GetLastSetNo(selectedExercise, pckDate.Date.Date); int newSetNo = ++lastSetNo; txtSet.Text = newSetNo.ToString(); } else if (e.Parameter.GetType() == typeof(PayLoad)) { PayLoad myPayload = new PayLoad(); myPayload = (PayLoad)e.Parameter; selectedLogEntry = myPayload.Entry; selectedExercise = _exerciseDao.GetExerciseById(selectedLogEntry.ExerciseID); pckDate.Date = selectedLogEntry.LogDate; txtSet.Text = selectedLogEntry.SetNo; txtReps.Text = selectedLogEntry.Reps; txtWeight.Text = selectedLogEntry.Weight; txtComments.Text = selectedLogEntry.Comments; if (myPayload.Status == "View") { SetViewReadOnly(); } else { SetViewEdit(); } } lblTitle.Text = selectedExercise.Name; }
public void CreateExercise(string name) { using (var dbConn = new SQLiteConnection(App.DB_PATH)) { Exercise newExercise = new Exercise(); newExercise.Name = name; dbConn.Insert(newExercise); } }
internal int GetLastSetNo(Exercise selectedExercise, DateTime date) { int setNo = 0; using (var dbConn = new SQLiteConnection(App.DB_PATH)) { var output = dbConn.Query<LogEntry>("select * from logentry where ExerciseID = ? and LogDate = ?", selectedExercise.ExerciseID, date); setNo = output.Count(); } return setNo; }
protected override void OnNavigatedTo(NavigationEventArgs e) { selectedExercise = (Exercise)e.Parameter; if (selectedExercise == null) { lblTitle.Text = "New Exercise"; } else { lblTitle.Text = "Edit Exercise"; txtName.Text = selectedExercise.Name; } }