Пример #1
0
        public void FillTrainingFromPlan(TrainingPlanDay planDay, StrengthTrainingEntryDTO strengthEntry)
        {
            strengthEntry.Entries.Clear();
            foreach (TrainingPlanEntry trainingPlanEntry in planDay.Entries)
            {
                var strengthItem = new StrengthTrainingItemDTO();
                strengthItem.ExerciseId         = trainingPlanEntry.ExerciseId;
                strengthItem.TrainingPlanItemId = trainingPlanEntry.GlobalId;
                strengthEntry.AddEntry(strengthItem);
                foreach (var set in trainingPlanEntry.Sets)
                {
                    var serie = new SerieDTO();
                    if (FillRepetitionNumber && set.RepetitionNumberMax.HasValue && set.RepetitionNumberMin.HasValue && set.RepetitionNumberMax == set.RepetitionNumberMin)
                    {
                        serie.RepetitionNumber = set.RepetitionNumberMax.Value;
                    }
                    serie.DropSet            = set.DropSet;
                    serie.SetType            = (SetType)set.RepetitionsType;
                    serie.TrainingPlanItemId = set.GlobalId;
                    strengthItem.AddSerie(serie);
                }
            }
            strengthEntry.TrainingPlanItemId = planDay.GlobalId;
            strengthEntry.TrainingPlanId     = planDay.TrainingPlan.GlobalId;

            fillSuperSets(planDay, strengthEntry);
        }
Пример #2
0
        public override void OnValueChanged(SourceGrid.CellContext sender, EventArgs e)
        {
            base.OnValueChanged(sender, e);
            Grid grid1 = (Grid)sender.Grid;

            StrengthTrainingItemDTO entry = null;
            var row = grid1.Rows[sender.Position.Row];

            if (row == null)
            {
                return;
            }
            if (row.Tag == null)
            {
                entry   = new StrengthTrainingItemDTO();
                row.Tag = entry;

                strengthEntry.AddEntry(entry);
                parent.AddEmptyRow(parent.GetSeriesNumber());
            }
            else
            {
                entry = (StrengthTrainingItemDTO)row.Tag;
            }
            Guid newId = (Guid)sender.Value;

            if (newId == Guid.Empty)
            {
                sender.Value = entry.ExerciseId;
                return;
            }
            entry.ExerciseId = newId;
            parent.UpdateCellsReadOnlyMode(row);

            if (!(grid1[row.Index, usrStrengthTrainingSourceGridBase.DeleteRowColumnIndex] is SourceGrid.Cells.Button))
            {
                grid1[row.Index, usrStrengthTrainingSourceGridBase.ExerciseColumnIndex].View.ForeColor = Color.Black;

                if (parent.ReadOnly)
                {
                    return;
                }
                var bnCol1 = new SourceGrid.Cells.Button(null);
                bnCol1.Image       = StrengthTrainingResources.Delete;
                bnCol1.ToolTipText = StrengthTrainingEntryStrings.DeleteThisEntryBtn;
                var ctrButton1 = new SourceGrid.Cells.Controllers.Button();
                ctrButton1.Executed += new EventHandler(deleteRowBtn_Execute);
                bnCol1.View          = new SourceGrid.Cells.Views.Button();
                bnCol1.AddController(ctrButton1);
                grid1[row.Index, usrStrengthTrainingSourceGridBase.DeleteRowColumnIndex] = bnCol1;
            }
        }
Пример #3
0
        public void UpdateEntryObject()
        {
            usrReportStatus1.Save(strengthEntry);
            var entries = usrTrainingDaySourceGrid1.GetTrainingDayEntries();

            strengthEntry.Entries = new List <StrengthTrainingItemDTO>();
            foreach (StrengthTrainingItemDTO dayEntry in entries)
            {
                strengthEntry.AddEntry(dayEntry);
            }
            strengthEntry.Comment   = txtComment.Text;
            strengthEntry.Intensity = usrIntensity1.Intensity;
            strengthEntry.StartTime = DateHelper.GetCorrectDateTime(teStart.Time);
            strengthEntry.EndTime   = DateHelper.GetCorrectDateTime(teEndTime.Time);
        }
Пример #4
0
        public void FillTrainingFromPlan(TrainingPlanDay planDay, StrengthTrainingEntryDTO strengthEntry)
        {
            strengthEntry.Entries.Clear();
            foreach (TrainingPlanEntry trainingPlanEntry in planDay.Entries)
            {
                var strengthItem = new StrengthTrainingItemDTO();
                strengthItem.Exercise           = trainingPlanEntry.Exercise;
                strengthItem.DoneWay            = trainingPlanEntry.DoneWay;
                strengthItem.SuperSetGroup      = trainingPlanEntry.GroupName;
                strengthItem.TrainingPlanItemId = trainingPlanEntry.GlobalId;
                strengthEntry.AddEntry(strengthItem);
                foreach (var set in trainingPlanEntry.Sets)
                {
                    var serie = new SerieDTO();
                    if (strengthItem.Exercise.ExerciseType == ExerciseType.Cardio)
                    {
                        if (FillRepetitionNumber && set.RepetitionNumberMin.HasValue)
                        {
                            serie.Weight = set.RepetitionNumberMin.Value;
                        }
                    }
                    else
                    {
                        if (FillRepetitionNumber && set.RepetitionNumberMax.HasValue && set.RepetitionNumberMin.HasValue && set.RepetitionNumberMax == set.RepetitionNumberMin)
                        {
                            serie.RepetitionNumber = set.RepetitionNumberMax.Value;
                        }
                    }


                    serie.IsSuperSlow        = set.IsSuperSlow;
                    serie.IsRestPause        = set.IsRestPause;
                    serie.DropSet            = set.DropSet;
                    serie.SetType            = (SetType)set.RepetitionsType;
                    serie.TrainingPlanItemId = set.GlobalId;
                    strengthItem.AddSerie(serie);
                }
            }
            strengthEntry.TrainingPlanItemId = planDay.GlobalId;
            strengthEntry.TrainingPlanId     = planDay.TrainingPlan.GlobalId;
        }