public List <ExerciseShow> RoutineShowSend(String RoutineName) { List <ExerciseShow> exerciseShows = new List <ExerciseShow>(); RoutineShow routine = RoutineShowSend().Find(x => x.RoutineName.Equals(RoutineName)); List <String> exList = routine.ExcerciseList; String timeList = routine.ExTime; List <Int32> sets = routine.Sets; List <String> reps = routine.Reps; List <String> lbs = routine.Lbs; for (int i = 0; i < routine.ExcerciseList.Count; i++) { ExerciseShow exerciseShow = new ExerciseShow(); exerciseShow.ExcerciseName = exList[i]; char firstChar = Char.ToLower(exerciseShow.ExcerciseName[0]); exerciseShow.ImageURL = "alphabet/" + firstChar; exerciseShow.ExTime = timeList; exerciseShow.Sets = sets[i]; exerciseShow.Reps = reps[i]; exerciseShow.Lbs = lbs[i]; exerciseShow.RoutineName = RoutineName; exerciseShows.Add(exerciseShow); } return(exerciseShows); }
public List <RoutineShow> RoutineShowSend() { Routine rt = new Routine(); Planned rpd = new Planned(); Exercise ex = new Exercise(); BLExercise addExerciseData = new BLExercise(); BLRoutine addRoutineData = new BLRoutine(); RoutineShow eachRoutineShow = new RoutineShow(); //db.DropTable<Routine>(); //db.CreateTable<Routine>(); //BLRoutine bL = new BLRoutine(); //bL.InsertRoutine(new Routine()); //db.DropTable<Planned>(); //db.CreateTable<Planned>(); List <Routine> routine = DataLinkLayer.DBread <Routine>(new Routine()); List <Exercise> exercise = DataLinkLayer.DBread <Exercise>(new Exercise()); List <RoutineShow> finalList = new List <RoutineShow>(); finalList.Clear(); List <Planned> routinePlanned = DataLinkLayer.DBread <Planned>(rpd); Console.WriteLine(routinePlanned); RoutineShow myRoutineShow = new RoutineShow(); foreach (Planned rp in routinePlanned) { String a = routine.Find(x => x.RoutineID == rp.RoutineID).RoutineName; String b = exercise.Find(x => x.ExcerciseID == (rp.ExcerciseID)).Name; Console.WriteLine(a + "-" + b + "-" + rp.Date); if (finalList.Find(x => x.RoutineName.Equals(a)) == null) { RoutineShow routineShow = new RoutineShow(); routineShow.RoutineName = a; routineShow.ExcerciseList.Add(b); routineShow.ExTime = rp.Date; routineShow.Sets.Add(rp.Sets); routineShow.Reps.Add(rp.Reps); routineShow.Lbs.Add(rp.Lbs); finalList.Add(routineShow); } else { finalList.Find(x => x.RoutineName.Equals(a)).ExcerciseList.Add(b); finalList.Find(x => x.RoutineName.Equals(a)).ExTime = rp.Date; finalList.Find(x => x.RoutineName.Equals(a)).Sets.Add(rp.Sets); finalList.Find(x => x.RoutineName.Equals(a)).Reps.Add(rp.Reps); finalList.Find(x => x.RoutineName.Equals(a)).Lbs.Add(rp.Lbs); } } return(finalList); }
void Handle_ItemSelected(object sender, Xamarin.Forms.SelectedItemChangedEventArgs e) { if (frompage.Equals("EXERCISE")) { App.Current.MainPage.Navigation.PushModalAsync(new ExerciseView()); } else { var selectedCategory = e.SelectedItem as Model.Exercise; String lblName = selectedCategory.Name; RoutineShow my = new RoutineShow(); my.ExcerciseName = lblName; my.Time = "00:00"; my.ImageURL = "alphabet/" + Char.ToLower(lblName[0]) + ""; new MyExercisesViewModel().AddData(my); Console.WriteLine("--Data on exercise Click" + my.ImageURL); } }
void onBackClick(object sender, System.EventArgs e) { //Dao.GetMyExercises.Clear(); RoutineShow rs = new RoutineShow(); List <RoutineShow> rsList = new List <RoutineShow>(); ObservableCollection <RoutineShow> allEx = Dao.GetMyExercises; for (int i = 0; i < allEx.Count; i++) { rs.RoutineName = entry_routine.Text; rs.ExcerciseName = allEx[i].ExcerciseName; rsList.Add(rs); } BLPlanned bLPlanned = new BLPlanned(); int rowInserted = bLPlanned.RoutineShowInsert(rsList); RoutineDataViewModel rdvm = new RoutineDataViewModel(); App.Current.MainPage.Navigation.PopModalAsync(); }
public void AddData(RoutineShow myExercises) { Dao.GetMyExercises.Add(myExercises); }