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 UpdateCellsReadOnlyMode(GridRow row) { var entry = row.Tag as MapperEntry; setCellReadOnly(grid1.GetCell(row.Index, FromExerciseColumn), false); setCellReadOnly(grid1.GetCell(row.Index, ToExerciseColumn), entry == null); ExerciseDTO fromExercise = null; if (entry != null) { fromExercise = ObjectsReposidory.GetExercise(entry.FromExerciseId); } bool cantDelete = fromExercise == null || !fromExercise.IsMine() || fromExercise.Status == PublishStatus.Published; setCellReadOnly(grid1.GetCell(row.Index, OperationColumn), cantDelete); if (cantDelete) { var cell = (Cell)grid1.GetCell(row.Index, OperationColumn); //cell.Value = MapperEntryOperation.OnlyReMap; var selectedItem = from t in ((SourceGrid.Cells.Editors.ComboBox)cell.Editor).Control.Items.Cast <ComboBoxItem>() where (MapperEntryOperation)t.Tag == MapperEntryOperation.OnlyReMap select t; cell.Value = selectedItem.SingleOrDefault(); } usrProgressIndicatorButtons1.OkButton.Enabled = grid1.RowsCount > 2; grid1.Refresh(); }
private void xtraTabControl_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) { if (e.Page == tpComments) { usrWorkoutCommentsList1.CannotVote = exercise.IsMine(); usrWorkoutCommentsList1.Fill(exercise); } }
public static bool CanRemoveFromFavorites(this ExerciseDTO exercise) { return(!(exercise == null || exercise.Profile == null || !exercise.IsFavorite() || exercise.IsMine())); }