Exemplo n.º 1
0
        public Int32 RoutineShowInsertExecuted(ExerciseShow exerciseShow)
        {
            rsList = new List <RoutineShow>();

            Int32 Exerciseid, routineAdded, routineID = 0;


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

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

            routineList = bLRoutine.ReadRoutine();

            if (routineAdded != 0)
            {
                Console.WriteLine();
                routineID = routineList.Find(x => x.RoutineName.Equals(exerciseShow.RoutineName)).RoutineID;
                rExecuted.RoutinePlannedID = planneds.Find(x => (x.ExcerciseID == Exerciseid) && (x.RoutineID == routineID)).ID;
                rExecuted.ExerciseID       = Exerciseid;
                rExecuted.RoutineID        = routineID;
                rExecuted.Date             = exerciseShow.ExTime;
                rExecuted.Sets             = exerciseShow.Sets;
                rExecuted.Reps             = exerciseShow.Reps;
                rExecuted.lbs = exerciseShow.Lbs;
                Console.WriteLine();

                return(InsertRoutineExecuted(rExecuted));
            }
            return(0);
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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);
        }