Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public BLProfile()
        {
            db = DataLinkLayer.DBconnect();

            BLRoutine bl = new BLRoutine();

            //DeleteProfile(12);
            //ReadProfile(db);
        }
Ejemplo n.º 3
0
        public BLPlanned()
        {
            db = DataLinkLayer.DBconnect();

            bLExercise = new BLExercise();
            bLRoutine  = new BLRoutine();

            exercises = bLExercise.ReadExercise();
            routines  = bLRoutine.ReadRoutine();
            //Planned rpd = new Planned();
            //  Int32 d = InsertRoutinePlanned(rpd);
        }
Ejemplo n.º 4
0
        public List<RoutineShow> RoutineShowSend()
        {
            Routine rt = new Routine();
            //BLRoutine r = new BLRoutine();
            //Int32 c = r.InsertRoutine(rt);

            Planned rpd = new Planned();
            // Int32 d = InsertRoutinePlanned(rpd);

            Exercise ex = new Exercise();
            BLExercise addExerciseData = new BLExercise();
           // int exCount = addExerciseData.InsertExcercise(ex);

            BLRoutine addRoutineData = new BLRoutine();
//            int rCount = addRoutineData.InsertRoutine(rt);


           // int d = InsertRoutinePlanned(rpd);



            List<Routine> routine = DataLinkLayer.DBread<Routine>(new Routine());
            List<Exercise> exercise = DataLinkLayer.DBread<Exercise>(new Exercise());


            List<Planned> routinePlanned = DataLinkLayer.DBread<Planned>(rpd);
            Console.WriteLine(routinePlanned);

            List<RoutineShow> myRoutine = new List<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;
                    myRoutine.Add(new RoutineShow { RoutineName = a, ExcerciseName = b });
                    Console.WriteLine(a + "-" + b);
                }
            };


            return myRoutine;


        }
Ejemplo n.º 5
0
        public int RoutineShowInsert(List<RoutineShow> rsList)
        {

            Planned rp = new Planned();
            Routine routine = new Routine();
            Exercise exercise = new Exercise();
            BLRoutine bLRoutine = new BLRoutine();

            Int32 Exerciseid,routineAdded,routineID = 0;

            List<Exercise> exerciseList = DataLinkLayer.DBread<Exercise>(new Exercise());
            List<Routine> routineList = DataLinkLayer.DBread<Routine>(new Routine());

            Console.WriteLine(routineList);

            foreach (RoutineShow routineShow in rsList)
            {

                Exerciseid = exerciseList.Find(x => x.Name.Equals(routineShow.ExcerciseName)).ExcerciseID;

               // add record in Routine table
                routine.RoutineName = routineShow.RoutineName;
                routineAdded= bLRoutine.InsertRoutine(routine);

                routineList = DataLinkLayer.DBread<Routine>(new Routine());
                routineID = routineList.Find(x => x.RoutineName.Equals(routineShow.RoutineName)).RoutineID;

                if (routineAdded != 0)
                {
                    rp.ExcerciseID = Exerciseid;
                    rp.RoutineID = routineID;

                    return InsertRoutinePlanned(rp);
                }


            }

            return 0;
        }
Ejemplo n.º 6
0
        public Int32 RoutineShowInsert(ExerciseShow exerciseShow)
        {
            List <RoutineShow> rsList = new List <RoutineShow>();

            Planned   rp        = new Planned();
            Routine   routine   = new Routine();
            Exercise  exercise  = new Exercise();
            BLRoutine bLRoutine = new BLRoutine();
            BLPlanned bLPlanned = new BLPlanned();

            Int32 Exerciseid, routineAdded, routineID = 0;

            List <Exercise> exerciseList = DataLinkLayer.DBread <Exercise>(new Exercise());
            List <Routine>  routineList  = DataLinkLayer.DBread <Routine>(new Routine());

            Exerciseid = exerciseList.Find(x => x.Name.Equals(exerciseShow.ExcerciseName)).ExcerciseID;

            // add record in Routine table
            routine.RoutineName = exerciseShow.RoutineName;
            routineAdded        = bLRoutine.InsertRoutine(routine);

            routineList = DataLinkLayer.DBread <Routine>(new Routine());

            if (routineAdded != 0)
            {
                Console.WriteLine();
                routineID      = routineList.Find(x => x.RoutineName.Equals(exerciseShow.RoutineName)).RoutineID;
                rp.ExcerciseID = Exerciseid;
                rp.RoutineID   = routineID;
                rp.Date        = exerciseShow.ExTime;
                rp.Sets        = exerciseShow.Sets;
                rp.Reps        = exerciseShow.Reps;
                rp.Lbs         = exerciseShow.Lbs;
                Console.WriteLine();

                return(bLPlanned.InsertRoutinePlanned(rp));
            }
            return(0);
        }