Example #1
0
        private async void startup()
        {
            foodDatabase = new FoodsTableDatabaseAzure();
            var details = await foodDatabase.GetFood();

            foreach (var detail in details)
            {
                Meals.Add(detail);
            }
        }
Example #2
0
        public async void Init(FoodsTableAutoCompleteResult parameters)
        {
            foodDetails  = parameters;
            foodDatabase = new FoodsTableDatabaseAzure();
            var details = await foodDatabase.GetFood();

            foreach (var detail in details)
            {
                if (detail.Id == foodDetails.Id) //detail.FoodName == "ramen")
                {
                    _foodid      = detail.Id;
                    Food         = detail.FoodName;
                    Calorie      = "" + detail.Calories;
                    Fat          = "" + detail.Fat;
                    Carbohydrate = "" + detail.Carbohydrate;
                    Protein      = "" + detail.Protein;
                    Fiber        = "" + detail.Fiber;
                    Cholesterol  = "" + detail.Cholesterol;
                    Sodium       = "" + detail.Sodium;
                }
            }
        }
        private async Task ShowList()
        {
            string userid = await getuserid();

            string foodid = "";

            Meals.Clear();
            //Meals = new ObservableCollection<FoodsTable>();
            enteredFood  = new FoodEnteredTableDatabaseAzure();
            foodDatabase = new FoodsTableDatabaseAzure();

            var mealdetails = await enteredFood.GetFood();

            foreach (var detail in mealdetails)
            {
                if (detail.UserID == userid)
                {
                    foodid = detail.FoodID;
                    var datas = await foodDatabase.GetFood();

                    foreach (var data in datas)
                    {
                        if (data.Id == foodid)
                        {
                            Meals.Add(data);
                            eatenValue    += data.Calories;
                            Eaten          = "" + eatenValue;
                            remainingValue = remainder();
                            Remaining      = "" + remainingValue;
                        }
                    }
                }
            }

            string exerciseid = "";

            Exercises.Clear();
            //Exercises = new ObservableCollection<ExerciseTable>();
            enteredExer  = new ExerciseEnteredTableDatabaseAzure();
            exerDatabase = new ExerciseTableDatabaseAzure();

            var exerdetails = await enteredExer.GetExercise();

            foreach (var detail in exerdetails)
            {
                if (detail.UserID == userid)
                {
                    exerciseid = detail.ExerciseID;
                    var datas = await exerDatabase.GetExercise();

                    foreach (var data in datas)
                    {
                        if (data.Id == exerciseid)
                        {
                            Exercises.Add(data);
                            burnedValue   += data.Calories;
                            Burned         = "" + burnedValue;
                            remainingValue = remainder();
                            Remaining      = "" + remainingValue;
                        }
                    }
                }
            }
        }