Exemplo n.º 1
0
        public ExerciseSchedule GetExerciseSchedule()
        {
            var schedule = ExerciseSchedules.First();

            schedule.ScheduledDays = GetScheduleDays(schedule);
            return(schedule);
        }
Exemplo n.º 2
0
        private void Initalize(SQLiteConnection conn)
        {
            _db = conn;

            _db.CreateTable <SystemStatus>();

            if (!SystemStatus.Any())
            {
                _db.Insert(new SystemStatus {
                    IsFirstRun = true
                });
            }
            _db.CreateTable <ExerciseSchedule>();

            var hasExerciseSchedule = ExerciseSchedules.Any();

            if (!hasExerciseSchedule)
            {
                var defaultSchedule = ExerciseSchedule.CreateDefaultSchedule();
                _db.Insert(defaultSchedule);
            }

            _db.CreateTable <ExerciseBlock>();
            _db.CreateTable <MostRecentExercise>();

            if (!hasExerciseSchedule && !ExerciseBlocks.Any())
            {
                var defaultExercises = ExerciseBlock.CreateDefaultExercises();
                _db.InsertAll(defaultExercises);
            }

            _db.CreateTable <ExerciseHistory>();

            _db.CreateTable <MovementLocation>();

#if DEBUG
            var now = DateTime.Now.Date;
            if (!ExerciseHistories.Any(eh => eh.RecordedDate < now))
            {
                _db.InsertAll(new List <ExerciseHistory>
                {
                    new ExerciseHistory
                    {
                        QuantityNotified  = 10,
                        ExerciseName      = "test",
                        RecordedDate      = DateTime.Now.AddDays(-1),
                        QuantityCompleted = 10
                    },
                    new ExerciseHistory
                    {
                        QuantityNotified  = 10,
                        ExerciseName      = "test",
                        RecordedDate      = DateTime.Now.AddDays(-2),
                        QuantityCompleted = 10
                    },
                    new ExerciseHistory
                    {
                        QuantityNotified  = 10,
                        ExerciseName      = "test",
                        RecordedDate      = DateTime.Now.AddDays(-3),
                        QuantityCompleted = 10
                    },
                });
            }
#endif
        }