Ejemplo n.º 1
0
        public Int32 InsertRoutineExecuted(Executed ExecutedRoutine)
        {
            var maxPK = db.Table <Executed>().OrderByDescending(c => c.ID).FirstOrDefault();

            if (maxPK != null)
            {
                rExecuted = new Executed()
                {
                    ID         = (maxPK == null ? 1 : (maxPK.ID + 1)),
                    RoutineID  = ExecutedRoutine.RoutineID,
                    ExerciseID = ExecutedRoutine.ExerciseID,
                    Date       = ExecutedRoutine.Date,
                    Reps       = ExecutedRoutine.Reps,
                    Sets       = ExecutedRoutine.Sets,
                    lbs        = ExecutedRoutine.lbs
                };
            }
            else
            {
                db.CreateTable <Executed>();
                rExecuted = new Executed()
                {
                    ID         = 0,
                    RoutineID  = ExecutedRoutine.RoutineID,
                    ExerciseID = ExecutedRoutine.ExerciseID,
                    Date       = ExecutedRoutine.Date,
                    Reps       = ExecutedRoutine.Reps,
                    Sets       = ExecutedRoutine.Sets,
                    lbs        = ExecutedRoutine.lbs
                };
            }
            return(DataLinkLayer.DBinsert <Executed>(rExecuted));
        }
Ejemplo n.º 2
0
        public Int32 InsertRoutinePlanned(Planned routinePlanned)
        {
            //int count = 0;


            //foreach (Planned rp in GetRoutinePlanned())
            //{
            //    Int32 x = DataLinkLayer.DBinsert<Planned>(rp);
            //    count += x;
            //}
            //return count;

            var maxPK = db.Table<Planned>().OrderByDescending(c => c.ID).FirstOrDefault();

            Planned plannedRoutine = new Planned()
            {
                ID = (maxPK == null ? 1 : (maxPK.ID + 1)),
                RoutineID = routinePlanned.RoutineID,
                ExcerciseID = routinePlanned.ExcerciseID

            };

            return DataLinkLayer.DBinsert<Planned>(plannedRoutine);




        }
Ejemplo n.º 3
0
        public Int32 InsertExcercise(Exercise e)
        {
            int count = 0;

            foreach (Exercise ex in GetExercises())
            {
                Int32 x = DataLinkLayer.DBinsert <Exercise>(ex);
                count += x;
            }


            return(count);
        }
Ejemplo n.º 4
0
        public void InsertData(object sender, EventArgs e)
        {
            Profile profile = new Profile();

            profile.Name = txt_name.Text;

            // Metrix = matrix.SelectedItem.ToString() == "US" ? false : true,

            if (matrix.SelectedItem.ToString() == "US")
            {
                profile.Metrix = false;
            }
            else
            {
                profile.Metrix = true;
            }

            if (gender.SelectedItem.ToString() == "Male")
            {
                profile.Gender = 1;
            }
            else if (gender.SelectedItem.ToString() == "Female")
            {
                profile.Gender = 2;
            }
            else
            {
                profile.Gender = 3;
            }

            profile.Height = Double.Parse(txt_height.Text.ToString());
            profile.Weight = Double.Parse(txt_weight.Text.ToString());

            profile.DOB = dob.Date.ToString();

            // Actually insert data in database

            DataLinkLayer    dll = new DataLinkLayer();
            SQLiteConnection db  = DataLinkLayer.DBconnect();
            int insertConfirm    = DataLinkLayer.DBinsert(profile);

            if (insertConfirm > 0)
            {
                Console.WriteLine("User Name" + profile.Name);
                //System.Diagnostics.Debug.WriteLine(""+ profile.Name);
                //await DisplayAlert(null, profile.Name + "Saved", "ok");
            }

            // dll.ReadProfile(db);
            DataLinkLayer.DBclose(db);
        }
Ejemplo n.º 5
0
        public Int32 InsertRoutinePlanned(RoutinePlanned routinePlanned)
        {
            int count = 0;


            db.CreateTable <RoutinePlanned>();

            foreach (RoutinePlanned rp in GetRoutinePlanned())
            {
                Int32 x = DataLinkLayer.DBinsert <RoutinePlanned>(rp);
                count += x;
            }


            return(count);
        }
Ejemplo n.º 6
0
        public int InsertProfile(Profile p)
        {
            var maxPK = db.Table <Profile>().OrderByDescending(c => c.ProfileID).FirstOrDefault();

            Profile profile = new Profile()
            {
                ProfileID = (maxPK == null ? 1 : (maxPK.ProfileID + 1)),
                Name      = p.Name,
                Metrix    = p.Metrix,
                Height    = p.Height,
                Weight    = p.Weight,
                Gender    = p.Gender,
                DOB       = p.DOB
            };

            return(DataLinkLayer.DBinsert <Profile>(profile));
        }
Ejemplo n.º 7
0
        public Int32 InsertRoutine(Routine r)
        {
            //foreach (Routine rp in AddRoutineDB())
            //{
            //    Int32 x = DataLinkLayer.DBinsert<Routine>(rp);
            //    count += x;
            //}

            var maxPK = db.Table <Routine>().OrderByDescending(c => c.RoutineID).FirstOrDefault();

            Routine routine = new Routine()
            {
                RoutineID   = (maxPK == null ? 1 : (maxPK.RoutineID + 1)),
                RoutineName = r.RoutineName
            };

            return(DataLinkLayer.DBinsert <Routine>(routine));
        }