internal void DeleteBodyExercise(BodyExerciseKey key) { _bodyExerciseModule.Delete(key); //Update Translation Name Translation.DeleteInDB(BodyExerciseTransformer.GetTranslationKey(key.Id), DbContext); }
public BodyExercise GetBodyExercise(BodyExerciseKey key) { var bodyExercise = _module.Get(key); if (bodyExercise != null) bodyExercise.Name = Translation.GetInDB(BodyExerciseTransformer.GetTranslationKey(bodyExercise.Id)); return bodyExercise; }
private void CompleteTranslation(BodyExercise bodyExercise) { if (bodyExercise != null) { string trKey = BodyExerciseTransformer.GetTranslationKey(bodyExercise.Id); bodyExercise.Name = Translation.GetInDB(trKey, DbContext); } }
private void SaveTranslation(BodyExercise bodyExercise) { if (bodyExercise != null) { string trKey = BodyExerciseTransformer.GetTranslationKey(bodyExercise.Id); Translation.UpdateInDB(trKey, bodyExercise.Name, DbContext); } }
private void SaveTranslation(Muscle muscle) { if (muscle != null) { string trKey = BodyExerciseTransformer.GetTranslationKey(muscle.Id); Translation.UpdateInDB(trKey, muscle.Name, DbContext); } }
public BodyExercise CreateBodyExercise(BodyExercise bodyExercise) { string name = bodyExercise.Name; bodyExercise = _module.Create(bodyExercise); if (bodyExercise != null && bodyExercise.Id > 0) { //Update Translation Name string trKey = BodyExerciseTransformer.GetTranslationKey(bodyExercise.Id); /*Translation.UpdateInDB(trKey, name, _dbContext);*/ bodyExercise.Name = Translation.GetInDB(trKey); } return bodyExercise; }
public List<BodyExercise> FindBodyExercises(BodyExerciseCriteria bodyExerciseCriteria = null) { var bodyExerciseList = _module.Find(bodyExerciseCriteria); if (bodyExerciseList != null) { foreach (var bodyExercise in bodyExerciseList) { if (bodyExercise != null) bodyExercise.Name = Translation.GetInDB(BodyExerciseTransformer.GetTranslationKey(bodyExercise.Id)); } } return bodyExerciseList; }
private async Task SynchronizeDataAsync() { var unit = await GetExerciseUnit(); string weightUnit = "kg"; if (unit == TUnitType.Imperial) { weightUnit = Translation.Get(TRS.POUND); } ExerciseTitle = Translation.GetInDB(BodyExerciseTransformer.GetTranslationKey(_trainingExercise.BodyExerciseId)); RestTime = _trainingExercise.RestTime; EccentricContractionTempo = _trainingExercise.EccentricContractionTempo; StretchPositionTempo = _trainingExercise.StretchPositionTempo; ConcentricContractionTempo = _trainingExercise.ConcentricContractionTempo; ContractedPositionTempo = _trainingExercise.ContractedPositionTempo; string urlImages = HttpConnector.Instance.BaseUrl + "images/bodyexercises/{0}"; var imageName = string.Format("{0}.png", _trainingExercise.BodyExerciseId); var urlImage = string.Format(urlImages, imageName); var localImagePath = Path.Combine(AppTools.BodyExercisesImagesDirectory, imageName); await AppTools.Instance.CachingImageAsync(_trainingExercise, urlImage, localImagePath, null); ExerciseImageSource = localImagePath; if (BindingTrainingExerciseSetReps == null) { BindingTrainingExerciseSetReps = new ObservableCollection <BindingTrainingExerciseSetRep>(); } else { BindingTrainingExerciseSetReps.Clear(); } if (_trainingExercise != null) { BindingTrainingExerciseSetRep bindingSetRep; if (_trainingExercise.TrainingExerciseSets == null || _trainingExercise.TrainingExerciseSets.Count == 0) { bindingSetRep = new BindingTrainingExerciseSetRep(); bindingSetRep.RepsLabel = Translation.Get(TRS.REPS); bindingSetRep.WeightsLabel = Translation.Get(TRS.WEIGHT) + "(" + weightUnit + ")"; bindingSetRep.Reps = 8; bindingSetRep.Weights = 0; BindingTrainingExerciseSetReps.Add(bindingSetRep); } else { int count = 0; foreach (var trainingExerciseSet in _trainingExercise.TrainingExerciseSets) { for (int i = 0; i < trainingExerciseSet.NumberOfSets; i++) { bindingSetRep = new BindingTrainingExerciseSetRep(); if (count == 0) { bindingSetRep.RepsLabel = Translation.Get(TRS.REPS); bindingSetRep.WeightsLabel = Translation.Get(TRS.WEIGHT) + "(" + weightUnit + ")"; } else { bindingSetRep.RepsLabel = bindingSetRep.WeightsLabel = string.Empty; // necessary for trigger Text.Length } bindingSetRep.Reps = trainingExerciseSet.NumberOfReps; bindingSetRep.Weights = trainingExerciseSet.Weight; BindingTrainingExerciseSetReps.Add(bindingSetRep); count++; } } } if (BindingTrainingExerciseSetReps.Count > 0) { BindingTrainingExerciseSetReps[BindingTrainingExerciseSetReps.Count - 1].BtnPlusVisible = true; } } }