//save exercise session to memory //add exercise session to user history info //delete exercise session //This constructor is for when a health care professional adds an exercise to the patient's //profile, rep number not defined //Default Constructor public ExerciseSession() { this.type = exerciseType.pinch; this.state = exerciseState.incomplete; this.addedDate = DateTime.Now; this.attempts = 0; //default number of reps if not indicated this.reps = 5; this.completedReps = 0; }
//This constructor is for when a health care professional adds an exercise to the patient's //profile, rep number defined public ExerciseSession(UserInfo user, exerciseType type, int reps) { //for (UserHistoryData this.user = user; this.type = type; this.state = exerciseState.incomplete; this.addedDate = DateTime.Now; this.attempts = 0; this.reps = reps; this.completedReps = 0; }
public ExerciseSession(UserInfo user, exerciseType type) { //for (UserHistoryData this.user = user; this.type = type; this.state = exerciseState.incomplete; this.addedDate = DateTime.Now; this.attempts = 0; //default number of reps if not indicated this.reps = 5; this.completedReps = 0; }
//This constructor is for copying an existing ExerciseSession, and cancelling the old session ExerciseSession(ExerciseSession old) { this.user = old.user; this.type = old.type; this.state = old.state; old.state = exerciseState.cancelled; this.attempts = old.attempts; this.addedDate = DateTime.Now; old.lastModified = DateTime.Now; this.reps = old.reps; this.completedReps = 0; }
void readSession() { String filename = this.user.getUsername(); StreamReader readstream = new StreamReader(filename + ".txt", true); // add password check? try { this.state = (exerciseState) Int32.Parse(readstream.ReadLine()); this.type = (exerciseType)Int32.Parse(readstream.ReadLine()); this.attempts = Int32.Parse(readstream.ReadLine()); this.reps = Int32.Parse(readstream.ReadLine()); this.completedReps = Int32.Parse(readstream.ReadLine()); this.addedDate = DateTime.Parse(readstream.ReadLine()); this.lastModified = DateTime.Parse(readstream.ReadLine()); this.startTime = DateTime.Parse(readstream.ReadLine()); this.endTime = DateTime.Parse(readstream.ReadLine()); readstream.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }