Exemplo n.º 1
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     selectedExercise = (Exercise)e.Parameter;
     txtName.Text = selectedExercise.Name;
     lstLogEntries = _dao.GetLogEntries(selectedExercise.ExerciseID);
     LogEntrieList.ItemsSource = lstLogEntries;
 }
Exemplo n.º 2
0
 public void UpdateExercise(Exercise myExercise)
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         dbConn.Update(myExercise);
     }
 }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
 public void CreateExercise(string name)
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         Exercise newExercise = new Exercise();
         newExercise.Name = name;
         dbConn.Insert(newExercise);
     }
 }
Exemplo n.º 5
0
        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;
            }
        }