public bool Fill(ExerciseDTO exercise, IEnumerable <ExerciseDTO> exercises, bool readOnly = false) { bool isReadOnly = readOnly || exercise.Status != PublishStatus.Private || (exercise.Profile == null && exercise.GlobalId != Guid.Empty); setReadOnly(isReadOnly); this.exercise = exercise.Clone(); txtUrl.Text = exercise.GetLocalizedUrl(); txtDescription.Text = exercise.GetLocalizedDescription(); txtName.Text = exercise.GetLocalizedName(); txtShortcut.Text = exercise.GetLocalizedShortcut(); cmbExerciseType.EditValue = exercise.ExerciseType; cmbMechanicsType.SelectedIndex = (int)exercise.MechanicsType; cmbForce.SelectedIndex = (int)exercise.ExerciseForceType; zoomDifficuilt.Value = (int)exercise.Difficult; if (exercises != null) { this.exercises = exercises; } bool showComments = exercise.Status != PublishStatus.Private && exercise.GlobalId != Guid.Empty; tpComments.PageVisible = showComments; if (showComments && xtraTabControl.SelectedTabPage == tpComments) { usrWorkoutCommentsList1.CannotVote = exercise.IsMine(); usrWorkoutCommentsList1.Fill(exercise); } validateData(); return(isReadOnly); }
public void Fill(ExerciseDTO exercise, IEnumerable <ExerciseDTO> exercises) { this.exercise = exercise; setReadOnly(); Url = exercise.GetLocalizedUrl(); Description = exercise.GetLocalizedDescription(); ExerciseName = exercise.GetLocalizedName(); Shortcut = exercise.GetLocalizedShortcut(); ExerciseType = exercise.ExerciseType; Mechanics = exercise.MechanicsType; Force = exercise.ExerciseForceType; Met = exercise.Met; Difficult = (double)exercise.Difficult; if (exercises != null) { this.exercises = exercises; } }